Java Code Examples for org.wso2.carbon.automation.engine.context.beans.User#setUserName()
The following examples show how to use
org.wso2.carbon.automation.engine.context.beans.User#setUserName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NonAdminUserCreationTestCase.java From micro-integrator with Apache License 2.0 | 5 votes |
@BeforeTest(alwaysRun = true) public void addNonAdminUser() throws Exception { AutomationContext esbContext = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN); String sessionCookie = new LoginLogoutClient(esbContext).login(); ResourceAdminServiceClient resourceAdmin = new ResourceAdminServiceClient( esbContext.getContextUrls().getBackEndUrl(), sessionCookie); UserManagementClient userManagementClient = new UserManagementClient( esbContext.getContextUrls().getBackEndUrl(), sessionCookie); //done this change due to a bug in UM - please refer to carbon dev mail // "G-Reg integration test failures due to user mgt issue." String[] permissions = { "/permission/admin/configure/", "/permission/admin/login", "/permission/admin/manage/", "/permission/admin/monitor", "/permission/protected" }; if (!userManagementClient.roleNameExists(ROLE_NAME)) { userManagementClient.addRole(ROLE_NAME, null, permissions); resourceAdmin.addResourcePermission("/", ROLE_NAME, "3", "1"); resourceAdmin.addResourcePermission("/", ROLE_NAME, "2", "1"); resourceAdmin.addResourcePermission("/", ROLE_NAME, "4", "1"); resourceAdmin.addResourcePermission("/", ROLE_NAME, "5", "1"); } userManagementClient.addUser("nonadminuser", "password", new String[] { ROLE_NAME }, null); //check user creation nonAdminUser = new User(); nonAdminUser.setUserName("nonadminuser"); nonAdminUser.setPassword("password"); }
Example 2
Source File: NonAdminUserCreationTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@BeforeTest(alwaysRun = true) public void addNonAdminUser() throws Exception { AutomationContext esbContext = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN); String sessionCookie = new LoginLogoutClient(esbContext).login(); ResourceAdminServiceClient resourceAdmin = new ResourceAdminServiceClient(esbContext.getContextUrls().getBackEndUrl(), sessionCookie); UserManagementClient userManagementClient = new UserManagementClient(esbContext.getContextUrls().getBackEndUrl(), sessionCookie); //done this change due to a bug in UM - please refer to carbon dev mail // "G-Reg integration test failures due to user mgt issue." String[] permissions = {"/permission/admin/configure/", "/permission/admin/login", "/permission/admin/manage/", "/permission/admin/monitor", "/permission/protected"}; if (!userManagementClient.roleNameExists(ROLE_NAME)) { userManagementClient.addRole(ROLE_NAME, null, permissions); resourceAdmin.addResourcePermission("/", ROLE_NAME, "3", "1"); resourceAdmin.addResourcePermission("/", ROLE_NAME, "2", "1"); resourceAdmin.addResourcePermission("/", ROLE_NAME, "4", "1"); resourceAdmin.addResourcePermission("/", ROLE_NAME, "5", "1"); } userManagementClient.addUser("nonadminuser", "password", new String[]{ROLE_NAME}, null); //check user creation nonAdminUser = new User(); nonAdminUser.setUserName("nonadminuser"); nonAdminUser.setPassword("password"); }