@Test public void testConfigurationChange() throws Exception { User user = getTestUser(); Tree userTree = root.getTree(user.getPath()); PasswordHistory history = new PasswordHistory(CONFIG); for (String pw : PASSWORDS) { assertTrue(history.updatePasswordHistory(userTree, pw)); } assertEquals(10, getHistory(user).size()); history = new PasswordHistory(ConfigurationParameters.of(PARAM_PASSWORD_HISTORY_SIZE, 5)); List<String> oldPwds = getHistory(user); assertEquals(10, oldPwds.size()); Iterables.skip(oldPwds, 6); history.updatePasswordHistory(userTree, oldPwds.iterator().next()); assertEquals(5, getHistory(user).size()); history = new PasswordHistory(CONFIG); history.updatePasswordHistory(userTree, "newPwd"); assertEquals(6, getHistory(user).size()); }
boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; }
PasswordHistory implements UserConstants { boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; } }
PasswordHistory implements UserConstants { boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; } PasswordHistory(@NotNull ConfigurationParameters config); }
PasswordHistory implements UserConstants { boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; } PasswordHistory(@NotNull ConfigurationParameters config);  }
PasswordHistory implements UserConstants { boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; } PasswordHistory(@NotNull ConfigurationParameters config);   }