@Test void onUserDetailsUpdatedByAdminEvent_WillIgnoreFieldsThatAreNotBeingChanged() { PersistableUser persistableUser = createPersistableUser(); when(usersRepository.findById(USER_ID)).thenReturn(Optional.of(persistableUser)); usersEventHandler.on(new UserDetailsUpdatedByAdminEvent(USER_ID, ORGANIZATION_ID, NO_CHANGE, NO_CHANGE, NO_CHANGE, ADMIN_ID)); assertEquals("old-display-name", persistableUser.getDisplayName()); assertEquals("old-email", persistableUser.getEmail()); assertEquals("old-password", persistableUser.getEncodedPassword()); verify(usersRepository).save(persistableUser); }
@EventHandler void on(UserCreatedByAdminEvent event, @Timestamp Instant creationTime) { LOGGER.info("User {} created for admin created organization {}", event.getUserId(), event.getOrganizationId()); usersRepository.createUser(event.getUserId(), event.getOrganizationId(), event.getUserDisplayName(), event.getUserEmail(), event.getEncodedPassword(), creationTime); }
UsersEventHandler implements ReplayCompletionAware { @EventHandler void on(UserCreatedByAdminEvent event, @Timestamp Instant creationTime) { LOGGER.info("User {} created for admin created organization {}", event.getUserId(), event.getOrganizationId()); usersRepository.createUser(event.getUserId(), event.getOrganizationId(), event.getUserDisplayName(), event.getUserEmail(), event.getEncodedPassword(), creationTime); } }
UsersEventHandler implements ReplayCompletionAware { @EventHandler void on(UserCreatedByAdminEvent event, @Timestamp Instant creationTime) { LOGGER.info("User {} created for admin created organization {}", event.getUserId(), event.getOrganizationId()); usersRepository.createUser(event.getUserId(), event.getOrganizationId(), event.getUserDisplayName(), event.getUserEmail(), event.getEncodedPassword(), creationTime); } @Autowired  UsersEventHandler(UsersRepository usersRepository); }
UsersEventHandler implements ReplayCompletionAware { @EventHandler void on(UserCreatedByAdminEvent event, @Timestamp Instant creationTime) { LOGGER.info("User {} created for admin created organization {}", event.getUserId(), event.getOrganizationId()); usersRepository.createUser(event.getUserId(), event.getOrganizationId(), event.getUserDisplayName(), event.getUserEmail(), event.getEncodedPassword(), creationTime); } @Autowired  UsersEventHandler(UsersRepository usersRepository); @ResetHandler void prepareForReplay(); }
UsersEventHandler implements ReplayCompletionAware { @EventHandler void on(UserCreatedByAdminEvent event, @Timestamp Instant creationTime) { LOGGER.info("User {} created for admin created organization {}", event.getUserId(), event.getOrganizationId()); usersRepository.createUser(event.getUserId(), event.getOrganizationId(), event.getUserDisplayName(), event.getUserEmail(), event.getEncodedPassword(), creationTime); } @Autowired  UsersEventHandler(UsersRepository usersRepository); @ResetHandler void prepareForReplay();  }