Search in sources :

Example 16 with UserManagementClient

use of org.wso2.identity.scenarios.commons.clients.UserManagementClient in project product-is by wso2.

the class UserManagementServiceAbstractTest method doInit.

public void doInit() throws Exception {
    // creating context as super admin
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    userMgtClient = new UserManagementClient(backendURL, getSessionCookie());
    authenticatorClient = new AuthenticatorClient(backendURL);
    setUserName();
    setUserPassword();
    setUserRole();
    Assert.assertNotNull(newUserName, "Please set a value to userName");
    Assert.assertNotNull(newUserRole, "Please set a value to userRole");
}
Also used : AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient)

Example 17 with UserManagementClient

use of org.wso2.identity.scenarios.commons.clients.UserManagementClient in project product-is by wso2.

the class UserMgtTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    logManger = new AuthenticatorClient(backendURL);
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    if (!nameExists(userMgtClient.listAllUsers("testAdminUser", 100), "testAdminUser")) {
        userMgtClient.addUser("testAdminUser", "testAdminUser@123", new String[] { "admin" }, "default");
    }
    userMgtClient.addUser("user1", "passWord1@", null, "default");
    userMgtClient.addUser("user2", "passWord1@", null, "default");
    userMgtClient.addUser("user3", "passWord1@", new String[] { "admin" }, "default");
    userMgtClient.addRole("umRole1", null, new String[] { "login" }, false);
    userMgtClient.addRole("umRole2", new String[] { "user1" }, new String[] { "login" }, false);
    userMgtClient.addRole("umRole3", null, new String[] { "login" }, false);
}
Also used : AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 18 with UserManagementClient

use of org.wso2.identity.scenarios.commons.clients.UserManagementClient in project product-is by wso2.

the class UserMgtTestCase method testChangePasswordByUser.

@Test(groups = "wso2.is", description = "Check change logged user password")
public void testChangePasswordByUser() throws Exception {
    userMgtClient.addUser("user6", "passWord1@", new String[] { "admin" }, "default");
    Assert.assertTrue(nameExists(userMgtClient.listAllUsers("user6", 10), "user6"), "Adding user 'user6' is failed.");
    UserManagementClient userMgtClient1 = new UserManagementClient(isServer.getContextUrls().getBackEndUrl(), "user6", "passWord1@");
    userMgtClient.changePasswordByUser("user6@carbon.super", "passWord1@", "passwordS1@");
    String value = this.logManger.login("user6", "passwordS1@", isServer.getInstance().getHosts().get("default"));
    Assert.assertTrue((value.indexOf("JSESSIONID") != -1), "User password change failed.");
    userMgtClient.deleteUser("user6");
}
Also used : UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 19 with UserManagementClient

use of org.wso2.identity.scenarios.commons.clients.UserManagementClient in project product-is by wso2.

the class RemoteAuthorizationManagerServiceTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    remoteAuthorizationManagerServiceClient = new RemoteAuthorizationManagerServiceClient(backendURL, sessionCookie);
    // Create users
    userMgtClient.addUser("user1", "passWord1@", null, "default");
    userMgtClient.addUser("user2", "passWord1@", null, "default");
    userMgtClient.addUser("user3", "passWord1@", null, "default");
    userMgtClient.addUser("user4", "passWord1@", null, "default");
    // Create roles
    userMgtClient.addRole("role1", null, null);
    userMgtClient.addRole("role2", null, null);
    userMgtClient.addRole("role3", null, null);
    userMgtClient.addRole("role4", null, null);
    userMgtClient.addRole("role5", null, null);
    userMgtClient.addRole("role6", null, null);
}
Also used : RemoteAuthorizationManagerServiceClient(org.wso2.identity.integration.common.clients.authorization.mgt.RemoteAuthorizationManagerServiceClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 20 with UserManagementClient

use of org.wso2.identity.scenarios.commons.clients.UserManagementClient in project product-is by wso2.

the class UserAccountConnectorTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
    serviceClient = new UserAccountConnectorServiceClient(sessionCookie, backendURL, configContext);
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
}
Also used : UserAccountConnectorServiceClient(org.wso2.identity.integration.common.clients.user.account.connector.UserAccountConnectorServiceClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

UserManagementClient (org.wso2.identity.integration.common.clients.UserManagementClient)47 BeforeClass (org.testng.annotations.BeforeClass)30 AuthenticatorClient (org.wso2.carbon.integration.common.admin.client.AuthenticatorClient)19 File (java.io.File)8 Test (org.testng.annotations.Test)8 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)8 ServerConfigurationManager (org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager)7 SetEnvironment (org.wso2.carbon.automation.engine.annotations.SetEnvironment)6 UserProfileMgtServiceClient (org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient)6 RemoteUserStoreManagerServiceClient (org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient)6 LoginLogoutClient (org.wso2.carbon.integration.common.utils.LoginLogoutClient)5 IdentityProviderMgtServiceClient (org.wso2.identity.integration.common.clients.Idp.IdentityProviderMgtServiceClient)5 ApplicationManagementServiceClient (org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient)4 AfterClass (org.testng.annotations.AfterClass)3 AutomationContext (org.wso2.carbon.automation.engine.context.AutomationContext)3 UserManagementClient (org.wso2.carbon.integration.common.admin.client.UserManagementClient)3 UserInformationRecoveryServiceClient (org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient)3 UserStoreConfigAdminServiceClient (org.wso2.identity.integration.common.clients.user.store.config.UserStoreConfigAdminServiceClient)3 UserManagementClient (org.wso2.identity.scenarios.commons.clients.UserManagementClient)3 XPathExpressionException (javax.xml.xpath.XPathExpressionException)2