コード例 #1
0
  @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());
  }
コード例 #2
0
  @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());
  }
コード例 #3
0
  @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());
  }
コード例 #4
0
  @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());
  }
コード例 #5
0
  @Before
  public void setUp() {
    EntityManager entityManager = entityManagerFactory.createEntityManager();
    entityManager.clear();
    deleteFromDatabase(entityManager, ChargingStation.class);

    eventHandler = new OcppEventHandler();

    eventHandler.setChargingStationRepository(chargingStationRepository);
  }
コード例 #6
0
  @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());
  }
コード例 #7
0
 @Test
 public void unknownChargingStationAcceptedEvent() {
   // no exception expected on unknown charging station
   eventHandler.handle(
       new ChargingStationAcceptedEvent(CHARGING_STATION_ID, ROOT_IDENTITY_CONTEXT));
 }