/** @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;
  }
示例#2
0
 @Test
 public void testCreateUser() throws Exception {
   boolean found = false;
   user1UserManagementClient.addUser(
       NEW_USER,
       NEW_USER_PW,
       new String[] {PermissionTestConstants.EVERYONE_ROLE},
       "testUserAProfile");
   FlaggedName[] flaggedNames = adminUserManagementClient.getRolesOfUser(NEW_USER, "*", 100);
   for (FlaggedName name : flaggedNames) {
     if (PermissionTestConstants.EVERYONE_ROLE.equalsIgnoreCase(name.getItemName())) {
       found = true;
     }
   }
   Assert.assertTrue(found, NEW_USER + " is not in internal/everyone");
 }
示例#3
0
  @BeforeClass(alwaysRun = true)
  public void init() throws Exception {
    int userId = 1;
    UserInfo userInfo = UserListCsvReader.getUserInfo(userId);
    EnvironmentBuilder builderAdmin = new EnvironmentBuilder().greg(ProductConstant.ADMIN_USER_ID);
    ManageEnvironment adminEnvironment = builderAdmin.build();

    EnvironmentBuilder builderUser1 = new EnvironmentBuilder().greg(userId);
    ManageEnvironment user1Environment = builderUser1.build();

    adminUserManagementClient =
        new UserManagementClient(
            adminEnvironment.getGreg().getBackEndUrl(),
            adminEnvironment.getGreg().getSessionCookie());
    user1UserManagementClient =
        new UserManagementClient(
            user1Environment.getGreg().getBackEndUrl(),
            user1Environment.getGreg().getSessionCookie());
    ROLE_USERS = new String[] {userInfo.getUserNameWithoutDomain()};
    // setup roles
    adminUserManagementClient.addRole(ROLE_NAME, ROLE_USERS, SECURITY_PERMISSION_LIST);
    adminUserManagementClient.updateUserListOfRole(EXISTING_ROLE, new String[] {}, ROLE_USERS);
  }
 @Test(
     groups = {"wso2.greg"},
     dependsOnMethods = {"addResource"})
 public void searchActivityByUnAvailableUser()
     throws RegistryExceptionException, RemoteException,
         GetAllRolesNamesUserAdminExceptionException {
   int id = 0;
   String unAvailableUser = "******" + id;
   while (userManagementClient.userNameExists(unAvailableUser, unAvailableUser)) {
     if (!userManagementClient.userNameExists(unAvailableUser, unAvailableUser)) {
       id++;
     }
     unAvailableUser = "******" + id;
   }
   assertNull(
       activityAdminServiceClient
           .getActivities(
               environment.getGreg().getSessionCookie(), unAvailableUser, "", "", "", "", 0)
           .getActivity());
 }
示例#5
0
 @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);
   }
 }
示例#7
0
 @Test(dependsOnMethods = "testCreateRole")
 public void testAddUserToRole() throws Exception {
   user1UserManagementClient.updateUserListOfRole(
       NEW_ROLE, new String[] {NEW_USER}, new String[] {});
   Assert.assertTrue(adminUserManagementClient.userNameExists(NEW_ROLE, NEW_USER));
 }
示例#8
0
 @Test(dependsOnMethods = "testCreateUser")
 public void testCreateRole() throws Exception {
   user1UserManagementClient.addRole(NEW_ROLE, new String[] {}, DUMMY_ROLE_PERMISSION_LIST);
   Assert.assertTrue(adminUserManagementClient.roleNameExists(NEW_ROLE));
 }