use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.
the class UserInformationRecoveryServiceTestCase method testRegisterUserWithEmptyUserName.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check user registration validation with empty password", dependsOnMethods = "testRegisterUser")
public void testRegisterUserWithEmptyUserName() throws Exception {
UserIdentityClaimDTO[] claims = new UserIdentityClaimDTO[2];
UserIdentityClaimDTO claimEmail = new UserIdentityClaimDTO();
claimEmail.setClaimUri("http://wso2.org/claims/emailaddress");
claimEmail.setClaimValue("user2@wso2.com");
UserIdentityClaimDTO claimLastName = new UserIdentityClaimDTO();
claimLastName.setClaimUri("http://wso2.org/claims/givenname");
claimLastName.setClaimValue("user2");
claims[0] = claimEmail;
claims[1] = claimLastName;
VerificationBean bean = infoRecoveryClient.registerUser(null, "passWord1@", claims, "default", null);
Assert.assertNotNull(bean.getError(), "The expected error message is null with null return");
}
use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.
the class AccountLockEnabledTestCase method testSuccessfulEmailTemplateRetrieval.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check whether the user account lock email " + "template successfully retrieved when admin triggered account lock.", dependsOnMethods = "testSuccessfulLockedInitially")
public void testSuccessfulEmailTemplateRetrieval() throws Exception {
ClaimValue claimValue = new ClaimValue();
claimValue.setClaimURI(defaultLocalityClaimUri);
claimValue.setValue(defaultLocalityClaimValue);
ClaimValue[] claimvalues = { claimValue };
usmClient.addUser(testLockUser2, testLockUser2Password, new String[] { "admin" }, claimvalues, null, false);
String userLocale = usmClient.getUserClaimValue(testLockUser2, defaultLocalityClaimUri, "default");
String emailTemplateResourceName = accountLockTemplateWhenUserExceedsFailedAttempts + "/" + userLocale;
String emailTemplateResourceContent = resourceAdminServiceClient.getTextContent(registryResourcePath + emailTemplateResourceName);
Assert.assertTrue("Test Failure : Email Content applicable for account lock is not available.", StringUtils.isNotEmpty(emailTemplateResourceContent));
String emailTemplateResourceNameAdminTriggered = accountLockTemplateWhenAdminTriggered + "/" + userLocale;
String emailTemplateResourceContentAdminTriggered = resourceAdminServiceClient.getTextContent(registryResourcePath + emailTemplateResourceNameAdminTriggered);
Assert.assertTrue("Test Failure : Email Content applicable for account lock is not available.", StringUtils.isNotEmpty(emailTemplateResourceContentAdminTriggered));
}
use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.
the class AccountLockEnabledTestCase method testSuccessfulEmailTemplateRetrievalAccountUnLock.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check whether the user account unlocklock email " + "template successfully retrieved when admin triggered account lock.")
public void testSuccessfulEmailTemplateRetrievalAccountUnLock() throws Exception {
ClaimValue claimValue = new ClaimValue();
claimValue.setClaimURI(defaultLocalityClaimUri);
claimValue.setValue(defaultLocalityClaimValue);
ClaimValue[] claimvalues = { claimValue };
usmClient.addUser(testLockUser3, testLockUser3Password, new String[] { "admin" }, claimvalues, null, false);
String userLocale = usmClient.getUserClaimValue(testLockUser2, defaultLocalityClaimUri, "default");
String emailTemplateResourceName = accountUnlockTemplateTimeBased + "/" + userLocale;
String emailTemplateResourceContent = resourceAdminServiceClient.getTextContent(registryResourcePath + emailTemplateResourceName);
Assert.assertTrue("Test Failure : Email Content applicable for account unlock is not available.", StringUtils.isNotEmpty(emailTemplateResourceContent));
String emailTemplateResourceNameAdminTriggered = accountUnlockTemplateAdminTriggered + "/" + userLocale;
String emailTemplateResourceContentAdminTriggered = resourceAdminServiceClient.getTextContent(registryResourcePath + emailTemplateResourceNameAdminTriggered);
Assert.assertTrue("Test Failure : Email Content applicable for account unlock is not available.", StringUtils.isNotEmpty(emailTemplateResourceContentAdminTriggered));
}
use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.
the class UserIdentityManagementServiceTestCase method testInit.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
super.init();
changeISConfiguration();
super.init();
timeBeforeUserLogin = System.currentTimeMillis();
loginManger = new AuthenticatorClient(backendURL);
userMgtClient = new UserManagementClient(backendURL, sessionCookie);
userIdentityManagementAdminServiceClient = new UserIdentityManagementAdminServiceClient(backendURL, sessionCookie);
Thread.sleep(5000);
loginManger.login(isServer.getSuperTenant().getTenantAdmin().getUserName(), isServer.getSuperTenant().getTenantAdmin().getPassword(), isServer.getInstance().getHosts().get("default"));
remoteUSMServiceClient = new RemoteUserStoreManagerServiceClient(backendURL, sessionCookie);
remoteUSMServiceClient.addUser(TEST_USER_USERNAME, TEST_USER_PASSWORD, null, null, PROFILE_NAME, false);
userMgtClient.addRole(TEST_ROLE, new String[] { TEST_USER_USERNAME }, new String[] { "/permission/admin/login" }, false);
}
use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.
the class UserIdentityManagementServiceTestCase method testGetChallengeQuestionsOfUser.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Getting challenge questions of a user")
public void testGetChallengeQuestionsOfUser() throws Exception {
UserChallengesDTO userChallengesDTO = new UserChallengesDTO();
userChallengesDTO.setId("http://wso2.org/claims/challengeQuestion1");
userChallengesDTO.setQuestion("Favorite food ?");
userChallengesDTO.setOrder(0);
userChallengesDTO.setAnswer("answer1");
UserChallengesDTO[] userChallengesDTOs = new UserChallengesDTO[] { userChallengesDTO };
userIdentityManagementAdminServiceClient.setChallengeQuestionsOfUser(TEST_USER_USERNAME, userChallengesDTOs);
UserChallengesDTO[] userChallengesDTOsReceived = userIdentityManagementAdminServiceClient.getChallengeQuestionsOfUser(TEST_USER_USERNAME);
Assert.assertEquals(1, userChallengesDTOsReceived.length);
Assert.assertEquals(userChallengesDTOsReceived[0].getQuestion(), "Favorite food ?");
Assert.assertNotNull(userChallengesDTOsReceived[0].getAnswer(), "Answer of the challenge question is null");
}
Aggregations