@Test void onOrganizationNameUpdatedByAdminEvent_WillPersistChanges_WhenFieldsHaveChanged() { var persistableOrganization = createPersistableOrganization(); when(organizationsRepository.findById(ORGANIZATION_ID)).thenReturn(Optional.of(persistableOrganization)); organizationsEventHandler.on(new OrganizationNameChangedEvent(ORGANIZATION_ID, ORGANIZATION_NAME_UPDATE, ADMIN_ID)); assertEquals(ORGANIZATION_NAME_UPDATE, persistableOrganization.getOrganizationName()); verify(organizationsRepository).save(persistableOrganization); }
@EventHandler void on(OrganizationRegisteredEvent event, @Timestamp Instant creationTime) { LOGGER.info("Creating new registered organization {}", event.getOrganizationId()); var organizationAddress = new OrganizationAddress(event.getStreet(), event.getCity(), event.getState(), event.getCountry(), event.getPostalCode()); organizationsRepository.createOrganization(event.getOrganizationId(), event.getOrganizationName(), organizationAddress, event.getWebsiteUrl(), event.getContactName(), event.getContactPhoneNumber(), event.getContactEmail(), false, creationTime); }
OrganizationsEventHandler implements ReplayCompletionAware { @EventHandler void on(OrganizationRegisteredEvent event, @Timestamp Instant creationTime) { LOGGER.info("Creating new registered organization {}", event.getOrganizationId()); var organizationAddress = new OrganizationAddress(event.getStreet(), event.getCity(), event.getState(), event.getCountry(), event.getPostalCode()); organizationsRepository.createOrganization(event.getOrganizationId(), event.getOrganizationName(), organizationAddress, event.getWebsiteUrl(), event.getContactName(), event.getContactPhoneNumber(), event.getContactEmail(), false, creationTime); } }
OrganizationsEventHandler implements ReplayCompletionAware { @EventHandler void on(OrganizationRegisteredEvent event, @Timestamp Instant creationTime) { LOGGER.info("Creating new registered organization {}", event.getOrganizationId()); var organizationAddress = new OrganizationAddress(event.getStreet(), event.getCity(), event.getState(), event.getCountry(), event.getPostalCode()); organizationsRepository.createOrganization(event.getOrganizationId(), event.getOrganizationName(), organizationAddress, event.getWebsiteUrl(), event.getContactName(), event.getContactPhoneNumber(), event.getContactEmail(), false, creationTime); } @Autowired  OrganizationsEventHandler(OrganizationsRepository organizationsRepository); }
OrganizationsEventHandler implements ReplayCompletionAware { @EventHandler void on(OrganizationRegisteredEvent event, @Timestamp Instant creationTime) { LOGGER.info("Creating new registered organization {}", event.getOrganizationId()); var organizationAddress = new OrganizationAddress(event.getStreet(), event.getCity(), event.getState(), event.getCountry(), event.getPostalCode()); organizationsRepository.createOrganization(event.getOrganizationId(), event.getOrganizationName(), organizationAddress, event.getWebsiteUrl(), event.getContactName(), event.getContactPhoneNumber(), event.getContactEmail(), false, creationTime); } @Autowired  OrganizationsEventHandler(OrganizationsRepository organizationsRepository); @ResetHandler void prepareForReplay(); }
OrganizationsEventHandler implements ReplayCompletionAware { @EventHandler void on(OrganizationRegisteredEvent event, @Timestamp Instant creationTime) { LOGGER.info("Creating new registered organization {}", event.getOrganizationId()); var organizationAddress = new OrganizationAddress(event.getStreet(), event.getCity(), event.getState(), event.getCountry(), event.getPostalCode()); organizationsRepository.createOrganization(event.getOrganizationId(), event.getOrganizationName(), organizationAddress, event.getWebsiteUrl(), event.getContactName(), event.getContactPhoneNumber(), event.getContactEmail(), false, creationTime); } @Autowired  OrganizationsEventHandler(OrganizationsRepository organizationsRepository); @ResetHandler void prepareForReplay();  }