Search in sources :

Example 11 with SetEnvironment

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");
}
Also used : VerificationBean(org.wso2.carbon.identity.mgt.stub.beans.VerificationBean) UserIdentityClaimDTO(org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment) Test(org.testng.annotations.Test) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest)

Example 12 with SetEnvironment

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));
}
Also used : ClaimValue(org.wso2.carbon.um.ws.api.stub.ClaimValue) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 13 with SetEnvironment

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));
}
Also used : ClaimValue(org.wso2.carbon.um.ws.api.stub.ClaimValue) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 14 with SetEnvironment

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);
}
Also used : AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) UserIdentityManagementAdminServiceClient(org.wso2.identity.integration.common.clients.mgt.UserIdentityManagementAdminServiceClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) RemoteUserStoreManagerServiceClient(org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient) BeforeClass(org.testng.annotations.BeforeClass) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment)

Example 15 with SetEnvironment

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");
}
Also used : UserChallengesDTO(org.wso2.carbon.identity.mgt.stub.dto.UserChallengesDTO) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Aggregations

SetEnvironment (org.wso2.carbon.automation.engine.annotations.SetEnvironment)58 Test (org.testng.annotations.Test)45 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)29 Resource (org.apache.wink.client.Resource)16 BasicAuthInfo (org.wso2.identity.integration.test.utils.BasicAuthInfo)16 VerificationBean (org.wso2.carbon.identity.mgt.stub.beans.VerificationBean)14 ClientConfig (org.apache.wink.client.ClientConfig)12 RestClient (org.apache.wink.client.RestClient)12 SCIMResponseHandler (org.wso2.identity.integration.test.scim.utils.SCIMResponseHandler)12 File (java.io.File)9 BeforeClass (org.testng.annotations.BeforeClass)9 UserIdentityClaimDTO (org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO)8 AuthenticatorClient (org.wso2.carbon.integration.common.admin.client.AuthenticatorClient)7 UserManagementClient (org.wso2.identity.integration.common.clients.UserManagementClient)6 ServerConfigurationManager (org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager)5 JSONObject (org.json.simple.JSONObject)4 FlaggedName (org.wso2.carbon.user.mgt.stub.types.carbon.FlaggedName)4 SCIMClient (org.wso2.charon.core.client.SCIMClient)4 RemoteUserStoreManagerServiceClient (org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient)4 ClaimValue (org.wso2.carbon.um.ws.api.stub.ClaimValue)3