@Test public void newChargingStationCreatedShouldCreateChargingStation() { when(chargingStationRepository.findOne(CHARGING_STATION_ID.getId())).thenReturn(null); service.onEvent(new ChargingStationCreatedEvent(CHARGING_STATION_ID, ImmutableSet.<UserIdentity>builder().add(USER_IDENTITY).build(), IDENTITY_CONTEXT)); verify(chargingStationRepository).createOrUpdate(new ChargingStation(CHARGING_STATION_ID.getId())); }
@EventHandler void onEvent(ChargingStationCreatedEvent event) { String chargingStationId = event.getChargingStationId().getId(); ChargingStation chargingStation = repository.findOne(chargingStationId); if (chargingStation == null) { repository.createOrUpdate(new ChargingStation(chargingStationId, defaultAuthorizationProviders)); } }
SelectiveIdentificationAuthorizationService implements IdentificationAuthorizationService { @EventHandler void onEvent(ChargingStationCreatedEvent event) { String chargingStationId = event.getChargingStationId().getId(); ChargingStation chargingStation = repository.findOne(chargingStationId); if (chargingStation == null) { repository.createOrUpdate(new ChargingStation(chargingStationId, defaultAuthorizationProviders)); } } }
SelectiveIdentificationAuthorizationService implements IdentificationAuthorizationService { @EventHandler void onEvent(ChargingStationCreatedEvent event) { String chargingStationId = event.getChargingStationId().getId(); ChargingStation chargingStation = repository.findOne(chargingStationId); if (chargingStation == null) { repository.createOrUpdate(new ChargingStation(chargingStationId, defaultAuthorizationProviders)); } }  }
SelectiveIdentificationAuthorizationService implements IdentificationAuthorizationService { @EventHandler void onEvent(ChargingStationCreatedEvent event) { String chargingStationId = event.getChargingStationId().getId(); ChargingStation chargingStation = repository.findOne(chargingStationId); if (chargingStation == null) { repository.createOrUpdate(new ChargingStation(chargingStationId, defaultAuthorizationProviders)); } }  void setProviders(Map<String, AuthorizationProvider> providers); void setRepository(ChargingStationRepository repository); @Override IdentifyingToken validate(IdentifyingToken token, @Nullable ChargingStationId chargingStationId); void setDefaultAuthorizationProviders(String defaultAuthorizationProviders); }
SelectiveIdentificationAuthorizationService implements IdentificationAuthorizationService { @EventHandler void onEvent(ChargingStationCreatedEvent event) { String chargingStationId = event.getChargingStationId().getId(); ChargingStation chargingStation = repository.findOne(chargingStationId); if (chargingStation == null) { repository.createOrUpdate(new ChargingStation(chargingStationId, defaultAuthorizationProviders)); } }  void setProviders(Map<String, AuthorizationProvider> providers); void setRepository(ChargingStationRepository repository); @Override IdentifyingToken validate(IdentifyingToken token, @Nullable ChargingStationId chargingStationId); void setDefaultAuthorizationProviders(String defaultAuthorizationProviders);  }