@Test public void testFindNotActivatedUsersByCreationDateBefore() { userService.removeNotActivatedUsers(); DateTime now = new DateTime(); List<User> users = userRepository.findNotActivatedUsersByCreationDateBefore(now.minusDays(3)); assertThat(users).isEmpty(); }
@Scheduled(cron = "0 0 1 * * ?") public void removeNotActivatedUsers() { DateTime now = new DateTime(); List<User> users = userRepository.findNotActivatedUsersByCreationDateBefore(now.minusDays(3)); for (User user : users) { log.debug("Deleting not activated user {}", user.getLogin()); userRepository.delete(user); } }
UserService { @Scheduled(cron = "0 0 1 * * ?") public void removeNotActivatedUsers() { DateTime now = new DateTime(); List<User> users = userRepository.findNotActivatedUsersByCreationDateBefore(now.minusDays(3)); for (User user : users) { log.debug("Deleting not activated user {}", user.getLogin()); userRepository.delete(user); } } }
UserService { @Scheduled(cron = "0 0 1 * * ?") public void removeNotActivatedUsers() { DateTime now = new DateTime(); List<User> users = userRepository.findNotActivatedUsersByCreationDateBefore(now.minusDays(3)); for (User user : users) { log.debug("Deleting not activated user {}", user.getLogin()); userRepository.delete(user); } }  }
UserService { @Scheduled(cron = "0 0 1 * * ?") public void removeNotActivatedUsers() { DateTime now = new DateTime(); List<User> users = userRepository.findNotActivatedUsersByCreationDateBefore(now.minusDays(3)); for (User user : users) { log.debug("Deleting not activated user {}", user.getLogin()); userRepository.delete(user); } }  User activateRegistration(String key); User createUserInformation(String login, String password, String firstName, String lastName, String email,
                                      String langKey); User createUser(String login, String password, String firstName, String lastName, String email,
                           String langKey, Authority authority, Domain domain); void updateUserInformation(String firstName, String lastName, String email); void changePassword(String password); User getUserWithAuthorities(); @Scheduled(cron = "0 0 1 * * ?") void removeNotActivatedUsers(); }
UserService { @Scheduled(cron = "0 0 1 * * ?") public void removeNotActivatedUsers() { DateTime now = new DateTime(); List<User> users = userRepository.findNotActivatedUsersByCreationDateBefore(now.minusDays(3)); for (User user : users) { log.debug("Deleting not activated user {}", user.getLogin()); userRepository.delete(user); } }  User activateRegistration(String key); User createUserInformation(String login, String password, String firstName, String lastName, String email,
                                      String langKey); User createUser(String login, String password, String firstName, String lastName, String email,
                           String langKey, Authority authority, Domain domain); void updateUserInformation(String firstName, String lastName, String email); void changePassword(String password); User getUserWithAuthorities(); @Scheduled(cron = "0 0 1 * * ?") void removeNotActivatedUsers();  }