public void testRemoveRoles() throws Exception { resetMeasure(); int n = USER_NUM; String pfxUsr = "******" + worker_id + "."; String pfxGrp = "grpAsRRem" + worker_id + "."; String pfxRol = "rolAsRRem" + worker_id + "."; String ORGANIZATION = "ORGANIZATION"; IdentitySession identitySession = identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm"); identitySession.beginTransaction(); Group group = identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP" + n, ORGANIZATION); RoleType roleType = 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(); for (User user : userList) { identitySession.getRoleManager().createRole(roleType, user, group); if (triggerGc) { System.gc(); } } int c = 0; for (User user : userList) { startStopwatch(); identitySession.getRoleManager().removeRole(roleType, user, group); stopStopwatch(); storeStopwatch(c++); if (triggerGc) { System.gc(); } } identitySession.getTransaction().commit(); identitySession.close(); generateGraph(getGraphNamePfx() + ".testDisassociateRoles()", this.getClass().getName()); }
@Test @Ignore public void testPopulateIdentity() throws Exception { resetMeasure(); int n = 200; String pfxUsr = "******"; String pfxGrp = "grpXtestPopulateIdentity"; String pfxRol = "rolXtestPopulateIdentity"; 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"); for (int i = 0; i < n; i++) { startStopwatch(); createUser(pfxUsr, identitySession, group, role, i); stopStopwatch(); storeStopwatch(i); } identitySession.getTransaction().commit(); identitySession.close(); generateGraph("populateIdentity", 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); }
public void testRemoveUsers() throws Exception { resetMeasure(); int n = USER_NUM; String pfxUsr = "******" + worker_id + "."; String pfxGrp = "grpUre" + worker_id + "."; String pfxRol = "rolUre" + 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"); identitySession.getTransaction().commit(); identitySession.close(); identitySession.beginTransaction(); for (int i = 0; i < n; i++) { User user = identitySession.getPersistenceManager().createUser(pfxUsr + i); if (triggerGc) { System.gc(); } } identitySession.getTransaction().commit(); identitySession.close(); identitySession.beginTransaction(); for (int i = 0; i < n; i++) { startStopwatch(); identitySession.getPersistenceManager().removeUser(pfxUsr + i, true); stopStopwatch(); storeStopwatch(i); if (triggerGc) { System.gc(); } } identitySession.getTransaction().commit(); identitySession.close(); generateGraph(getGraphNamePfx() + ".testRemoveUsers()", this.getClass().getName()); }
@Test @Ignore public void testCreateUsersInManyTransactions() throws Exception { // logger.info("testCreateUsersInManyTransactions"); resetMeasure(); int n = USER_NUM; String pfxUsr = "******"; String pfxGrp = "grpCrManytestCreateUsersInManyTransactions"; String pfxRol = "rolCrManytestCreateUsersInManyTransactions"; String ORGANIZATION = "ORGANIZATION"; IdentitySession identitySession = identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm"); identitySession.beginTransaction(); identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP" + n, ORGANIZATION); identitySession.getRoleManager().createRoleType(pfxRol + "managerMany"); identitySession.getTransaction().commit(); identitySession.close(); for (int i = 0; i < n; i++) { identitySession.beginTransaction(); startStopwatch(); identitySession.getPersistenceManager().createUser(pfxUsr + i); stopStopwatch(); storeStopwatch(i); identitySession.getTransaction().commit(); identitySession.close(); } generateGraph("testCreateUsersInManyTransactions", this.getClass().getName()); }
@Test @Ignore public void testPopulateIdentity1() throws Exception { String pfxUsr = "******"; String pfxGrp = "grpXtestPopulateIdentity1"; String pfxRol = "rolXtestPopulateIdentity1"; String ORGANIZATION = "ORGANIZATION"; IdentitySession identitySession = identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm"); identitySession.beginTransaction(); Group group = identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP", ORGANIZATION); RoleType role = identitySession.getRoleManager().createRoleType(pfxRol + "manager"); // logger.info("start creating first user!"); identitySession.getPersistenceManager().createUser("FirstUser"); // logger.info("stop creating first user!"); identitySession.getTransaction().commit(); identitySession.close(); }