@Test public void chargingStationCreatedEvent() { assertNull(chargingStationRepository.findOne(CHARGING_STATION_ID.getId())); eventHandler.handle( new ChargingStationCreatedEvent( CHARGING_STATION_ID, USER_IDENTITIES_WITH_ALL_PERMISSIONS, NULL_USER_IDENTITY_CONTEXT)); ChargingStation cs = chargingStationRepository.findOne(CHARGING_STATION_ID.getId()); assertNotNull(cs); assertEquals(cs.getId(), CHARGING_STATION_ID.getId()); }
@Test public void chargingStationBootedEvent() { eventHandler.handle( new ChargingStationCreatedEvent( CHARGING_STATION_ID, USER_IDENTITIES_WITH_ALL_PERMISSIONS, NULL_USER_IDENTITY_CONTEXT)); ChargingStation cs = chargingStationRepository.findOne(CHARGING_STATION_ID.getId()); Assert.assertNull(cs.getProtocol()); eventHandler.handle( new UnconfiguredChargingStationBootedEvent( CHARGING_STATION_ID, PROTOCOL, BOOT_NOTIFICATION_ATTRIBUTES, IDENTITY_CONTEXT)); cs = chargingStationRepository.findOne(CHARGING_STATION_ID.getId()); Assert.assertEquals(PROTOCOL, cs.getProtocol()); }
@Test public void chargingStationConfiguredEvent() { eventHandler.handle( new ChargingStationCreatedEvent( CHARGING_STATION_ID, USER_IDENTITIES_WITH_ALL_PERMISSIONS, NULL_USER_IDENTITY_CONTEXT)); ChargingStation cs = chargingStationRepository.findOne(CHARGING_STATION_ID.getId()); assertFalse(cs.isConfigured()); assertNotSame(cs.getNumberOfEvses(), EVSES.size()); eventHandler.handle( new ChargingStationConfiguredEvent(CHARGING_STATION_ID, EVSES, NULL_USER_IDENTITY_CONTEXT)); cs = chargingStationRepository.findOne(CHARGING_STATION_ID.getId()); assertTrue(cs.isConfigured()); assertEquals(cs.getNumberOfEvses(), EVSES.size()); }
@Test public void unknownChargingStationConfiguredEvent() { eventHandler.handle( new ChargingStationConfiguredEvent(CHARGING_STATION_ID, EVSES, NULL_USER_IDENTITY_CONTEXT)); ChargingStation cs = chargingStationRepository.findOne(CHARGING_STATION_ID.getId()); assertTrue(cs.isConfigured()); assertEquals(cs.getNumberOfEvses(), EVSES.size()); }
@Test public void chargingStationAcceptedEvent() { eventHandler.handle( new ChargingStationCreatedEvent( CHARGING_STATION_ID, USER_IDENTITIES_WITH_ALL_PERMISSIONS, NULL_USER_IDENTITY_CONTEXT)); eventHandler.handle( new ChargingStationAcceptedEvent(CHARGING_STATION_ID, ROOT_IDENTITY_CONTEXT)); ChargingStation cs = chargingStationRepository.findOne(CHARGING_STATION_ID.getId()); assertTrue(cs.isRegistered()); }