@Test
  @Ignore
  public void testPopulateAndassociateIdentity1() throws Exception {
    String pfxUsr = "******";
    String pfxGrp = "grpXtestPopulateAndassociateIdentity1";
    String pfxRol = "rolXtestPopulateAndassociateIdentity1";

    String ORGANIZATION = "ORGANIZATION";

    IdentitySession identitySession =
        identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
    identitySession.beginTransaction();

    //   logger.info("start creating first group!");
    Group group =
        identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP", ORGANIZATION);
    //   logger.info("stop creating first group!");

    // RoleType role = identitySession.getRoleManager().createRoleType(pfxRol+"manager");

    //    logger.info("start creating first user!");
    User user1 =
        identitySession
            .getPersistenceManager()
            .createUser("FirsttestPopulateAndassociateIdentity1User");
    //    logger.info("------------------");
    User user2 =
        identitySession
            .getPersistenceManager()
            .createUser("SecondtestPopulateAndassociateIdentity1User");
    //    logger.info("------------------");
    User user3 =
        identitySession
            .getPersistenceManager()
            .createUser("ThirdtestPopulateAndassociateIdentity1User");
    //    logger.info("stop creating first user!");

    //    logger.info("start associating first user!");
    identitySession.getRelationshipManager().associateUser(group, user1);
    //    logger.info("------------------");
    identitySession.getRelationshipManager().associateUser(group, user2);
    //     logger.info("------------------");
    identitySession.getRelationshipManager().associateUser(group, user3);
    //    logger.info("stop associating first user!");
    identitySession.getTransaction().commit();

    identitySession.close();
  }
  public void testDisassociateUsers() throws Exception {

    resetMeasure();

    int n = USER_NUM;

    String pfxUsr = "******" + worker_id + ".";
    String pfxGrp = "grpDAsG" + worker_id + ".";
    String pfxRol = "rolDAsG" + worker_id + ".";

    String ORGANIZATION = "ORGANIZATION";

    IdentitySession identitySession =
        identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
    identitySession.beginTransaction();

    Group group =
        identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP" + n, ORGANIZATION);
    RoleType role = identitySession.getRoleManager().createRoleType(pfxRol + "manager");

    Collection<User> userList = new ArrayList<User>();

    for (int i = 0; i < n; i++) {
      User user = identitySession.getPersistenceManager().createUser(pfxUsr + i);
      userList.add(user);
    }

    identitySession.getTransaction().commit();
    identitySession.close();
    identitySession.beginTransaction();

    int c = 0;
    for (User user : userList) {
      identitySession.getRelationshipManager().associateUser(group, user);
    }

    startStopwatch();
    identitySession.getRelationshipManager().disassociateUsers(group, userList);
    stopStopwatch();
    storeStopwatch(c++);

    identitySession.getTransaction().commit();
    identitySession.close();
    generateGraph(getGraphNamePfx() + ".testAssociateUsers()", this.getClass().getName());
  }
 public void createUser(
     String pfxUsr, IdentitySession identitySession, Group group, RoleType role, int i)
     throws IdentityException, FeatureNotSupportedException {
   User user = identitySession.getPersistenceManager().createUser(pfxUsr + i);
   identitySession.getAttributesManager().updatePassword(user, "oldPassword");
   identitySession.getAttributesManager().updatePassword(user, "newPassword");
   identitySession.getRelationshipManager().associateUser(group, user);
   identitySession.getRoleManager().createRole(role, user, group);
 }
  @Test
  public void testAssociateUsersInManyTransactions() throws Exception {
    // logger = null;

    int n = 500;
    String pfxUsr = "******";
    String pfxGrp = "grpAsManytestAssociateUsersInManyTransactions";

    List<User> userList = new ArrayList<User>();

    String ORGANIZATION = "ORGANIZATION";

    IdentitySession identitySession =
        identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm");

    identitySession.beginTransaction();
    Group group =
        identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP" + n, ORGANIZATION);
    identitySession.getTransaction().commit();
    identitySession.close();

    for (int i = 0; i < n; i++) {
      identitySession.beginTransaction();
      User user = identitySession.getPersistenceManager().createUser(pfxUsr + i);
      userList.add(user);
      identitySession.getTransaction().commit();
      identitySession.close();
    }
    identitySession.beginTransaction();

    System.gc();
    for (User u : userList) {
      identitySession =
          identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
      identitySession.beginTransaction();
      identitySession.getRelationshipManager().associateUser(group, u);
      identitySession.getTransaction().commit();
      identitySession.close();
      System.gc();
    }

    identitySession.close();
  }