public void testCreateGroups() throws Exception { resetMeasure(); int n = USER_NUM; String pfxUsr = "******" + worker_id + "."; String pfxGrp = "grpGrp" + worker_id + "."; String pfxRol = "rolGrp" + worker_id + "."; String ORGANIZATION = "ORGANIZATION"; IdentitySession identitySession = identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm"); identitySession.beginTransaction(); for (int i = 0; i < n; i++) { startStopwatch(); Group group = identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP" + i, ORGANIZATION); stopStopwatch(); storeStopwatch(i); if (triggerGc) { System.gc(); } } identitySession.getTransaction().commit(); identitySession.close(); generateGraph(getGraphNamePfx() + ".testCreateGroups()", 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 testAssociateUsers() throws Exception { resetMeasure(); int n = USER_NUM; String pfxUsr = "******" + worker_id + "."; String pfxGrp = "grpAsG" + worker_id + "."; String pfxRol = "rolAsG" + worker_id + "."; String ORGANIZATION = "ORGANIZATION"; IdentitySession identitySession = identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm"); identitySession.beginTransaction(); Group group = identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP" + n, ORGANIZATION); 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(); int c = 0; for (User user : userList) { identitySession.beginTransaction(); startStopwatch(); identitySession.getRelationshipManager().associateUser(group, user); stopStopwatch(); storeStopwatch(c++); if (triggerGc) { System.gc(); } identitySession.getTransaction().commit(); identitySession.close(); } generateGraph(getGraphNamePfx() + ".testAssociateUsers()", 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()); }
@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()); }
public void testRemoveRoleTypes() throws Exception { resetMeasure(); int n = USER_NUM; String pfxUsr = "******" + worker_id + "."; String pfxGrp = "grpCrRRem" + worker_id + "."; String pfxRol = "rolCrRRem" + worker_id + "."; String ORGANIZATION = "ORGANIZATION"; IdentitySession identitySession = identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm"); identitySession.beginTransaction(); Group group = identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP" + n, ORGANIZATION); Collection<RoleType> roleTypeList = new ArrayList<RoleType>(); for (int i = 0; i < n; i++) { RoleType role = identitySession.getRoleManager().createRoleType(pfxRol + "manager" + i); roleTypeList.add(role); if (triggerGc) { System.gc(); } } int c = 0; for (RoleType roleType : roleTypeList) { startStopwatch(); identitySession.getRoleManager().removeRoleType(roleType); stopStopwatch(); storeStopwatch(c++); if (triggerGc) { System.gc(); } } identitySession.getTransaction().commit(); identitySession.close(); generateGraph(getGraphNamePfx() + ".testRemoveRoleTypes()", 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(); }
@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(); }