use of org.wso2.carbon.user.mgt.common.FlaggedName in project product-is by wso2.
the class ReadOnlyLDAPUserStoreManagerTestCase method testUpdateUsersOfRole.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
@Test(groups = "wso2.is", description = "Check update users of role")
public void testUpdateUsersOfRole() {
String[] userList = new String[] { newUserName };
FlaggedName[] userFlagList = new FlaggedName[userList.length];
for (int i = 0; i < userFlagList.length; i++) {
FlaggedName flaggedName = new FlaggedName();
flaggedName.setItemName(userList[i]);
flaggedName.setSelected(true);
userFlagList[i] = flaggedName;
}
try {
userMgtClient.updateUsersOfRole("admin", userFlagList);
} catch (Exception e) {
Assert.assertEquals(e.getMessage(), "UserAdminUserAdminException", "Error Message mismatched");
}
}
use of org.wso2.carbon.user.mgt.common.FlaggedName in project product-is by wso2.
the class ReadOnlyLDAPUserStoreManagerTestCase method testListByClaimUsers.
@Test(groups = "wso2.is", description = "Check delete role")
public void testListByClaimUsers() throws Exception {
ClaimValue claimValue = new ClaimValue();
claimValue.setClaimURI("http://wso2.org/claims/lastname");
claimValue.setValue("*");
FlaggedName[] flaggedNames = userMgtClient.listUserByClaim(claimValue, "*", 1000);
for (FlaggedName name : flaggedNames) {
if (name.getItemName().equals("krbtgt") || name.getItemName().equals("ldap")) {
Assert.fail("invalid user retrieved with claim : " + name.getItemName());
}
}
}
use of org.wso2.carbon.user.mgt.common.FlaggedName in project product-is by wso2.
the class UserMgtServiceAbstractTestCase method testUpdateRolesOfUser.
public void testUpdateRolesOfUser() throws Exception {
List<String> newRoleList = new ArrayList<String>();
FlaggedName[] currentRoleList = userMgtClient.getRolesOfUser("user3", null, 0);
if (currentRoleList != null) {
for (FlaggedName role : currentRoleList) {
if (role.getSelected()) {
newRoleList.add(role.getItemName());
}
}
}
if (!newRoleList.contains("umRole1")) {
newRoleList.add("umRole1");
}
userMgtClient.updateRolesOfUser("user3", newRoleList.toArray(new String[newRoleList.size()]));
Assert.assertTrue(nameExists(userMgtClient.getRolesOfUser("user3", "umRole1", 10), "umRole1"), "Adding umRole1 to user has failed");
newRoleList.remove("umRole1");
userMgtClient.updateRolesOfUser("user3", newRoleList.toArray(new String[newRoleList.size()]));
Assert.assertFalse(nameExists(userMgtClient.getUsersOfRole("user3", "umRole1", 10), "umRole1"), "Deleting umRole1 from user has failed");
}
use of org.wso2.carbon.user.mgt.common.FlaggedName in project product-is by wso2.
the class UserMgtServiceAbstractTestCase method testListUsers.
public void testListUsers() throws Exception {
boolean exists = false;
FlaggedName[] usersList = userMgtClient.listAllUsers("user1", 100);
for (FlaggedName user : usersList) {
if ("user1".equals(user.getItemName())) {
exists = true;
break;
}
}
Assert.assertTrue(exists, "List users has failed");
}
use of org.wso2.carbon.user.mgt.common.FlaggedName in project product-is by wso2.
the class UserMgtServiceAbstractTestCase method testListUserByClaim.
public void testListUserByClaim() throws Exception {
ClaimValue claimValue = new ClaimValue();
claimValue.setClaimURI("http://wso2.org/claims/lastname");
claimValue.setValue("user3");
loginManger.login(isServer.getSuperTenant().getTenantAdmin().getUserName(), isServer.getSuperTenant().getTenantAdmin().getPassword(), isServer.getInstance().getHosts().get("default"));
FlaggedName[] allNames = userMgtClient.listUserByClaim(claimValue, "user3", 10);
Assert.assertTrue(nameExists(allNames, "user3"), "List user with claim value has failed");
loginManger.logOut();
}
Aggregations