/** @throws Exception */ @AfterClass() public void clear() throws Exception { String servicePathToDelete = absPath; if (wsRegistryServiceClient.resourceExists(servicePathToDelete)) { resourceAdminServiceClient.deleteResource(servicePathToDelete); } /* String schemaPathToDelete = "/_system/governance/trunk/schemas/org/bar/purchasing/purchasing.xsd"; if (wsRegistryServiceClient.resourceExists(schemaPathToDelete)) { resourceAdminServiceClient.deleteResource(schemaPathToDelete); } String wsdlPathToDelete = "/_system/governance/trunk/wsdls/com/foo/IntergalacticService.wsdl"; if (wsRegistryServiceClient.resourceExists(wsdlPathToDelete)) { resourceAdminServiceClient.deleteResource(wsdlPathToDelete); }*/ lifeCycleManagementClient.deleteLifeCycle(LC_NAME); if (userManagementClient.roleNameExists("archrole")) { userManagementClient.deleteRole("archrole"); } if (userManagementClient.roleNameExists("managerrole")) { userManagementClient.deleteRole("managerrole"); } governanceServiceClient = null; wsRegistryServiceClient = null; lifeCycleAdminServiceClient = null; lifeCycleManagementClient = null; governanceServiceClient = null; listMetadataServiceClient = null; resourceAdminServiceClient = null; resourceAdminServiceClient = null; userManagementClient = null; }
@AfterClass(alwaysRun = true) public void cleanup() throws Exception { adminUserManagementClient.deleteRole(ROLE_NAME); adminUserManagementClient.updateUserListOfRole(EXISTING_ROLE, ROLE_USERS, new String[] {}); if (adminUserManagementClient.roleNameExists(NEW_ROLE)) { adminUserManagementClient.deleteRole(NEW_ROLE); } FlaggedName[] flaggedNames = adminUserManagementClient.getRolesOfUser(NEW_USER, "*", 100); for (FlaggedName name : flaggedNames) { if (name.getItemName().equals(PermissionTestConstants.EVERYONE_ROLE)) { adminUserManagementClient.deleteUser(NEW_USER); } } adminUserManagementClient = null; user1UserManagementClient = null; }
/** * @param roleName name of the role needs to be added to the current user * @throws Exception */ private void addRole(String roleName, String userName) throws Exception { String[] permissions = {"/permission/admin/manage/"}; if (!userManagementClient.roleNameExists(roleName)) { userManagementClient.addRole(roleName, new String[] {userName}, permissions); } }
@Test(dependsOnMethods = "testCreateUser") public void testCreateRole() throws Exception { user1UserManagementClient.addRole(NEW_ROLE, new String[] {}, DUMMY_ROLE_PERMISSION_LIST); Assert.assertTrue(adminUserManagementClient.roleNameExists(NEW_ROLE)); }