Search in sources :

Example 1 with SetEnvironment

use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.

the class UserInformationRecoveryServiceTenantEmailUserTestCase method testInit.

@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    String carbonHome = Utils.getResidentCarbonHome();
    identityMgtServerFile = new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "identity" + File.separator + "identity-mgt.properties");
    File identityMgtConfigFile = new File(getISResourceLocation() + File.separator + "identityMgt" + File.separator + "identity-mgt-enabled.properties");
    File defaultTomlFile = getDeploymentTomlFile(carbonHome);
    File configuredTomlFile = new File(getISResourceLocation() + File.separator + "identityMgt" + File.separator + "user_mgt_regex_changed.toml");
    scm = new ServerConfigurationManager(isServer);
    scm.applyConfigurationWithoutRestart(identityMgtConfigFile, identityMgtServerFile, true);
    scm.applyConfigurationWithoutRestart(configuredTomlFile, defaultTomlFile, true);
    scm.restartGracefully();
    super.init();
    tenantServiceClient = new TenantManagementServiceClient(isServer.getContextUrls().getBackEndUrl(), sessionCookie);
    tenantServiceClient.addTenant(TENANT_DOMAIN, TENANT_ADMIN_TENANT_AWARE_USERNAME, TENANT_ADMIN_PASSWORD, TENANT_ADMIN_USERNAME, "Info", "Recovery");
    loginManger = new AuthenticatorClient(backendURL);
    sessionCookie = this.loginManger.login(TENANT_ADMIN_USERNAME, TENANT_ADMIN_PASSWORD, isServer.getInstance().getHosts().get(profileName));
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    infoRecoveryClient = new UserInformationRecoveryServiceClient(backendURL, sessionCookie);
    userMgtClient.addUser(TENANT_USER, "passWord1@", null, profileName);
}
Also used : AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) ServerConfigurationManager(org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) File(java.io.File) TenantManagementServiceClient(org.wso2.identity.integration.common.clients.TenantManagementServiceClient) UserInformationRecoveryServiceClient(org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient) BeforeClass(org.testng.annotations.BeforeClass) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment)

Example 2 with SetEnvironment

use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.

the class UserInformationRecoveryServiceTenantEmailUserTestCase method testVerifyUserAccount.

@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check user account verification")
public void testVerifyUserAccount() throws Exception {
    UserIdentityClaimDTO[] claims = new UserIdentityClaimDTO[1];
    UserIdentityClaimDTO claimEmail = new UserIdentityClaimDTO();
    claimEmail.setClaimUri(USERNAME_CLAIM_URI);
    claimEmail.setClaimValue(TENANT_USER);
    claims[0] = claimEmail;
    VerificationBean bean = infoRecoveryClient.verifyAccount(claims, null, TENANT_DOMAIN);
    Assert.assertTrue(bean.getVerified(), "Verifying user account has failed 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) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 3 with SetEnvironment

use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.

the class UserInformationRecoveryServiceTestCase method testConfirmUserSelfRegistration.

@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check user registration confirmation", dependsOnMethods = "testRegisterUser")
public void testConfirmUserSelfRegistration() throws Exception {
    VerificationBean bean = infoRecoveryClient.confirmUserSelfRegistration("user2", confKey, null, null);
    Assert.assertNotNull(bean, "Confirmation of user registration has failed with null return");
}
Also used : VerificationBean(org.wso2.carbon.identity.mgt.stub.beans.VerificationBean) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment) Test(org.testng.annotations.Test) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest)

Example 4 with SetEnvironment

use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.

the class UserInformationRecoveryServiceTestCase method testVerifyUserAccount.

// @SetEnvironment(executionEnvironments = { ExecutionEnvironment.integration_all })
// @Test(groups = "wso2.is", description = "Check getting supported claims")
// public void testGetUserIdentitySupportedClaims() throws Exception {
// loginManger.login("admin", "admin", isServer.getBackEndUrl());
// UserIdentityClaimDTO[] bean = infoRecoveryClient.getUserIdentitySupportedClaims("http://wso2.org/claims");
// Assert.assertNotNull(bean, "Getting supported claims has failed with null return");
// }
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check user account verification", dependsOnMethods = "testVerifyUserChallengeAnswer")
public void testVerifyUserAccount() throws Exception {
    UserIdentityClaimDTO[] claims = new UserIdentityClaimDTO[2];
    UserIdentityClaimDTO claimEmail = new UserIdentityClaimDTO();
    claimEmail.setClaimUri("http://wso2.org/claims/emailaddress");
    claimEmail.setClaimValue("user11@wso2.com");
    UserIdentityClaimDTO claimLastName = new UserIdentityClaimDTO();
    claimLastName.setClaimUri("http://wso2.org/claims/givenname");
    claimLastName.setClaimValue("user11");
    claims[0] = claimEmail;
    claims[1] = claimLastName;
    VerificationBean bean = infoRecoveryClient.verifyAccount(claims, null, null);
    Assert.assertNotNull(bean, "Verifying user account has failed 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 5 with SetEnvironment

use of org.wso2.carbon.automation.engine.annotations.SetEnvironment in project product-is by wso2.

the class UserInformationRecoveryServiceTestCase method testGetCaptcha.

@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check get captcha", dependsOnMethods = "testListUsers")
public void testGetCaptcha() throws Exception {
    CaptchaInfoBean bean = infoRecoveryClient.getCaptcha();
    Assert.assertNotNull(bean, "Getting the captcha call failed with null return");
    Assert.assertNotNull(bean.getImagePath(), "Getting image path from captcha has failed.");
    Assert.assertNotNull(bean.getSecretKey(), "Getting secret key from captcha has failed.");
}
Also used : CaptchaInfoBean(org.wso2.carbon.captcha.mgt.beans.xsd.CaptchaInfoBean) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment) Test(org.testng.annotations.Test) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest)

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