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