@Test public void testHandleConfigurationItemsReceivedEventShouldOnlyCreateUpdateRequestedKeys() { ChargingStation cs = repository.findOne(CHARGING_STATION_ID.getId()); assertTrue(cs.getConfItems().isEmpty()); String key = "io.motown.sockets.amount"; String expectedValue = "2"; Set<ConfigurationItem> configurationItems = ImmutableSet.<ConfigurationItem>builder() .add(new ConfigurationItem(key, expectedValue)) .add(new ConfigurationItem("io.motown.random.config.item", "true")) .add(new ConfigurationItem("io.motown.another.random.config.item", "12")) .add(new ConfigurationItem("io.motown.yet.another.one", "blue")) .build(); Set<String> requestedConfigurationKeys = ImmutableSet.<String>builder() .add(key) .build(); listener.handle(new ConfigurationItemsReceivedEvent(CHARGING_STATION_ID, configurationItems, requestedConfigurationKeys, IDENTITY_CONTEXT)); cs = repository.findOne(CHARGING_STATION_ID.getId()); assertEquals(requestedConfigurationKeys.size(), cs.getConfItems().size()); assertEquals(expectedValue, cs.getConfItems().get(key)); }
@EventHandler public void handle(ChargingStationCreatedEvent event) { LOG.debug("ChargingStationCreatedEvent creates [{}] in operator api repo", event.getChargingStationId()); ChargingStation station = new ChargingStation(event.getChargingStationId().getId()); repository.createOrUpdate(station); }
ChargingStationEventListener { @EventHandler public void handle(ChargingStationCreatedEvent event) { LOG.debug("ChargingStationCreatedEvent creates [{}] in operator api repo", event.getChargingStationId()); ChargingStation station = new ChargingStation(event.getChargingStationId().getId()); repository.createOrUpdate(station); } }
ChargingStationEventListener { @EventHandler public void handle(ChargingStationCreatedEvent event) { LOG.debug("ChargingStationCreatedEvent creates [{}] in operator api repo", event.getChargingStationId()); ChargingStation station = new ChargingStation(event.getChargingStationId().getId()); repository.createOrUpdate(station); }  }
ChargingStationEventListener { @EventHandler public void handle(ChargingStationCreatedEvent event) { LOG.debug("ChargingStationCreatedEvent creates [{}] in operator api repo", event.getChargingStationId()); ChargingStation station = new ChargingStation(event.getChargingStationId().getId()); repository.createOrUpdate(station); }  @EventHandler void handle(ChargingStationCreatedEvent event); @EventHandler void handle(ChargingStationBootedEvent event); @EventHandler void handle(ChargingStationAcceptedEvent event); @EventHandler void handle(ChargingStationPlacedEvent event); @EventHandler void handle(ChargingStationMovedEvent event); @EventHandler void handle(ChargingStationLocationImprovedEvent event); @EventHandler void handle(ChargingStationOpeningTimesSetEvent event); @EventHandler void handle(ChargingStationOpeningTimesAddedEvent event); @EventHandler void handle(ChargingStationConfiguredEvent event); @EventHandler void handle(ChargingStationMadeReservableEvent event); @EventHandler void handle(ChargingStationMadeNotReservableEvent event); @EventHandler void handle(ChargingStationStatusNotificationReceivedEvent event); @EventHandler void handle(ComponentStatusNotificationReceivedEvent event); @EventHandler void handle(ConfigurationItemsReceivedEvent event); @EventHandler void handle(AuthorizationListVersionReceivedEvent event); @EventHandler void handle(AuthorizationListChangedEvent event); @EventHandler void handle(ChargingStationAvailabilityChangedToInoperativeEvent event); @EventHandler void handle(ChargingStationAvailabilityChangedToOperativeEvent event); @EventHandler void handle(ComponentAvailabilityChangedToInoperativeEvent event); @EventHandler void handle(ComponentAvailabilityChangedToOperativeEvent event); void setRepository(ChargingStationRepository repository); }
ChargingStationEventListener { @EventHandler public void handle(ChargingStationCreatedEvent event) { LOG.debug("ChargingStationCreatedEvent creates [{}] in operator api repo", event.getChargingStationId()); ChargingStation station = new ChargingStation(event.getChargingStationId().getId()); repository.createOrUpdate(station); }  @EventHandler void handle(ChargingStationCreatedEvent event); @EventHandler void handle(ChargingStationBootedEvent event); @EventHandler void handle(ChargingStationAcceptedEvent event); @EventHandler void handle(ChargingStationPlacedEvent event); @EventHandler void handle(ChargingStationMovedEvent event); @EventHandler void handle(ChargingStationLocationImprovedEvent event); @EventHandler void handle(ChargingStationOpeningTimesSetEvent event); @EventHandler void handle(ChargingStationOpeningTimesAddedEvent event); @EventHandler void handle(ChargingStationConfiguredEvent event); @EventHandler void handle(ChargingStationMadeReservableEvent event); @EventHandler void handle(ChargingStationMadeNotReservableEvent event); @EventHandler void handle(ChargingStationStatusNotificationReceivedEvent event); @EventHandler void handle(ComponentStatusNotificationReceivedEvent event); @EventHandler void handle(ConfigurationItemsReceivedEvent event); @EventHandler void handle(AuthorizationListVersionReceivedEvent event); @EventHandler void handle(AuthorizationListChangedEvent event); @EventHandler void handle(ChargingStationAvailabilityChangedToInoperativeEvent event); @EventHandler void handle(ChargingStationAvailabilityChangedToOperativeEvent event); @EventHandler void handle(ComponentAvailabilityChangedToInoperativeEvent event); @EventHandler void handle(ComponentAvailabilityChangedToOperativeEvent event); void setRepository(ChargingStationRepository repository);  }