@Test public void testProcessRoleDefinitions() throws InterruptedException { realm = new TestRealm() { public void test(Thread runnable) throws InterruptedException { ROLES_LOCK.writeLock().lock(); try { runnable.start(); Thread.sleep(500); assertFalse("role exists when it shouldn't", realm.roleExists("role1")); } finally { ROLES_LOCK.writeLock().unlock(); } } }; TestThread testThread = new TestThread(new Runnable() { public void run() { try { realm.processRoleDefinitions(); } catch (ParseException e) { fail("Unable to parse role definitions"); } } }); setRoles(); Thread testTask = new Thread(testThread); realm.test(testTask); testTask.join(500); assertTrue("role doesn't exist when it should", realm.roleExists("role1")); testThread.test(); }
protected void processRoleDefinitions() throws ParseException { String roleDefinitions = getRoleDefinitions(); if (roleDefinitions == null) { return; } Map<String, String> roleDefs = toMap(toLines(roleDefinitions)); processRoleDefinitions(roleDefs); }
TextConfigurationRealm extends SimpleAccountRealm { protected void processRoleDefinitions() throws ParseException { String roleDefinitions = getRoleDefinitions(); if (roleDefinitions == null) { return; } Map<String, String> roleDefs = toMap(toLines(roleDefinitions)); processRoleDefinitions(roleDefs); } }
TextConfigurationRealm extends SimpleAccountRealm { protected void processRoleDefinitions() throws ParseException { String roleDefinitions = getRoleDefinitions(); if (roleDefinitions == null) { return; } Map<String, String> roleDefs = toMap(toLines(roleDefinitions)); processRoleDefinitions(roleDefs); } TextConfigurationRealm(); }
TextConfigurationRealm extends SimpleAccountRealm { protected void processRoleDefinitions() throws ParseException { String roleDefinitions = getRoleDefinitions(); if (roleDefinitions == null) { return; } Map<String, String> roleDefs = toMap(toLines(roleDefinitions)); processRoleDefinitions(roleDefs); } TextConfigurationRealm(); String getUserDefinitions(); void setUserDefinitions(String userDefinitions); String getRoleDefinitions(); void setRoleDefinitions(String roleDefinitions); }
TextConfigurationRealm extends SimpleAccountRealm { protected void processRoleDefinitions() throws ParseException { String roleDefinitions = getRoleDefinitions(); if (roleDefinitions == null) { return; } Map<String, String> roleDefs = toMap(toLines(roleDefinitions)); processRoleDefinitions(roleDefs); } TextConfigurationRealm(); String getUserDefinitions(); void setUserDefinitions(String userDefinitions); String getRoleDefinitions(); void setRoleDefinitions(String roleDefinitions);  }