@Test public void testBootKnownChargingStation() { ChargingStation cs = new ChargingStation(CHARGING_STATION_ID.getId(), CHARGING_STATION_ADDRESS); cs.setRegistered(true); cs.setNumberOfEvses(2); cs.setConfigured(true); chargingStationRepository.createOrUpdate(cs); AttributeMap<String, String> attributes = new AttributeMap<String, String>(). putIfValueNotNull(AttributeMapKeys.CHARGING_STATION_ADDRESS, CHARGING_STATION_ADDRESS). putIfValueNotNull(AttributeMapKeys.VENDOR_ID, CHARGING_STATION_VENDOR). putIfValueNotNull(AttributeMapKeys.MODEL, CHARGING_STATION_MODEL). putIfValueNotNull(AttributeMapKeys.CHARGING_STATION_SERIAL_NUMBER, CHARGING_STATION_SERIAL_NUMBER). putIfValueNotNull(AttributeMapKeys.CHARGE_BOX_SERIAL_NUMBER, CHARGE_BOX_SERIAL_NUMBER). putIfValueNotNull(AttributeMapKeys.FIRMWARE_VERSION, getFirmwareVersion()). putIfValueNotNull(AttributeMapKeys.ICCID, getIccid()). putIfValueNotNull(AttributeMapKeys.IMSI, getImsi()). putIfValueNotNull(AttributeMapKeys.METER_TYPE, getMeterType()). putIfValueNotNull(AttributeMapKeys.METER_SERIAL_NUMBER, getMeterSerialNumber()); BootChargingStationResult bootChargingStationResult = domainService.bootChargingStation(CHARGING_STATION_ID, PROTOCOL, attributes, ADD_ON_IDENTITY); assertTrue(bootChargingStationResult.isAccepted()); cs = chargingStationRepository.findOne(CHARGING_STATION_ID.getId()); assertEquals(cs.getId(), CHARGING_STATION_ID.getId()); assertEquals(cs.getIpAddress(), CHARGING_STATION_ADDRESS); assertEquals(cs.getNumberOfEvses(), 2); assertTrue(cs.isConfigured()); assertTrue(cs.isRegistered()); assertTrue(cs.isRegisteredAndConfigured()); assertEquals(cs.getIpAddress(), CHARGING_STATION_ADDRESS); verify(gateway).send(new BootChargingStationCommand(CHARGING_STATION_ID, PROTOCOL, attributes, NULL_USER_IDENTITY_CONTEXT)); }
public BootChargingStationResult bootChargingStation(ChargingStationId chargingStationId, String protocol, AttributeMap<String, String> attributes, AddOnIdentity addOnIdentity) { ChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId.getId()); IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); if (chargingStation == null) { LOG.debug("Not a known charging station on boot notification, we send a CreateChargingStationCommand."); commandGateway.send(new CreateChargingStationCommand(chargingStationId, userIdentitiesWithAllPermissions, identityContext), new CreateChargingStationCommandCallback( chargingStationId, protocol, attributes, addOnIdentity, chargingStationRepository, this)); return new BootChargingStationResult(false, heartbeatInterval, new Date()); } chargingStation.setIpAddress(attributes.get(AttributeMapKeys.CHARGING_STATION_ADDRESS)); chargingStation = chargingStationRepository.createOrUpdate(chargingStation); commandGateway.send(new BootChargingStationCommand(chargingStationId, protocol, attributes, identityContext)); return new BootChargingStationResult(chargingStation.isRegisteredAndConfigured(), heartbeatInterval, new Date()); }
DomainService { public BootChargingStationResult bootChargingStation(ChargingStationId chargingStationId, String protocol, AttributeMap<String, String> attributes, AddOnIdentity addOnIdentity) { ChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId.getId()); IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); if (chargingStation == null) { LOG.debug("Not a known charging station on boot notification, we send a CreateChargingStationCommand."); commandGateway.send(new CreateChargingStationCommand(chargingStationId, userIdentitiesWithAllPermissions, identityContext), new CreateChargingStationCommandCallback( chargingStationId, protocol, attributes, addOnIdentity, chargingStationRepository, this)); return new BootChargingStationResult(false, heartbeatInterval, new Date()); } chargingStation.setIpAddress(attributes.get(AttributeMapKeys.CHARGING_STATION_ADDRESS)); chargingStation = chargingStationRepository.createOrUpdate(chargingStation); commandGateway.send(new BootChargingStationCommand(chargingStationId, protocol, attributes, identityContext)); return new BootChargingStationResult(chargingStation.isRegisteredAndConfigured(), heartbeatInterval, new Date()); } }
DomainService { public BootChargingStationResult bootChargingStation(ChargingStationId chargingStationId, String protocol, AttributeMap<String, String> attributes, AddOnIdentity addOnIdentity) { ChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId.getId()); IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); if (chargingStation == null) { LOG.debug("Not a known charging station on boot notification, we send a CreateChargingStationCommand."); commandGateway.send(new CreateChargingStationCommand(chargingStationId, userIdentitiesWithAllPermissions, identityContext), new CreateChargingStationCommandCallback( chargingStationId, protocol, attributes, addOnIdentity, chargingStationRepository, this)); return new BootChargingStationResult(false, heartbeatInterval, new Date()); } chargingStation.setIpAddress(attributes.get(AttributeMapKeys.CHARGING_STATION_ADDRESS)); chargingStation = chargingStationRepository.createOrUpdate(chargingStation); commandGateway.send(new BootChargingStationCommand(chargingStationId, protocol, attributes, identityContext)); return new BootChargingStationResult(chargingStation.isRegisteredAndConfigured(), heartbeatInterval, new Date()); }  }
DomainService { public BootChargingStationResult bootChargingStation(ChargingStationId chargingStationId, String protocol, AttributeMap<String, String> attributes, AddOnIdentity addOnIdentity) { ChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId.getId()); IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); if (chargingStation == null) { LOG.debug("Not a known charging station on boot notification, we send a CreateChargingStationCommand."); commandGateway.send(new CreateChargingStationCommand(chargingStationId, userIdentitiesWithAllPermissions, identityContext), new CreateChargingStationCommandCallback( chargingStationId, protocol, attributes, addOnIdentity, chargingStationRepository, this)); return new BootChargingStationResult(false, heartbeatInterval, new Date()); } chargingStation.setIpAddress(attributes.get(AttributeMapKeys.CHARGING_STATION_ADDRESS)); chargingStation = chargingStationRepository.createOrUpdate(chargingStation); commandGateway.send(new BootChargingStationCommand(chargingStationId, protocol, attributes, identityContext)); return new BootChargingStationResult(chargingStation.isRegisteredAndConfigured(), heartbeatInterval, new Date()); }  BootChargingStationResult bootChargingStation(ChargingStationId chargingStationId, String protocol,
                                                         AttributeMap<String, String> attributes, AddOnIdentity addOnIdentity); void incomingDataTransfer(ChargingStationId chargingStationId, String data, String vendorId, String messageId, FutureEventCallback future, AddOnIdentity addOnIdentity); void heartbeat(ChargingStationId chargingStationId, AddOnIdentity addOnIdentity); void meterValues(ChargingStationId chargingStationId, TransactionId transactionId, EvseId evseId, List<MeterValue> meterValues, AddOnIdentity addOnIdentity); void diagnosticsFileNameReceived(ChargingStationId chargingStationId, String diagnosticsFileName, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void authorizationListVersionReceived(ChargingStationId chargingStationId, int currentVersion, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void authorize(ChargingStationId chargingStationId, String idTag, FutureEventCallback future, AddOnIdentity addOnIdentity); void receiveConfigurationItems(ChargingStationId chargingStationId, Set<ConfigurationItem> configurationItems, Set<String> requestedKeys, AddOnIdentity addOnIdentity); void diagnosticsUploadStatusUpdate(ChargingStationId chargingStationId, boolean diagnosticsUploaded, AddOnIdentity addOnIdentity); void firmwareStatusUpdate(ChargingStationId chargingStationId, FirmwareStatus firmwareStatus, AddOnIdentity addOnIdentity); void statusNotification(ChargingStationId chargingStationId, EvseId evseId, StatusNotification statusNotification, AddOnIdentity addOnIdentity); void startTransactionNoAuthorize(ChargingStationId chargingStationId, TransactionId transactionId,
                                            StartTransactionInfo startTransactionInfo, AddOnIdentity addOnIdentity); void startTransaction(ChargingStationId chargingStationId, EvseId evseId, IdentifyingToken idTag, FutureEventCallback futureEventCallback,
                                 AddOnIdentity addOnIdentity); void stopTransaction(ChargingStationId chargingStationId, NumberedTransactionId transactionId, IdentifyingToken idTag, int meterValueStop, Date timeStamp,
                                List<MeterValue> meterValues, AddOnIdentity addOnIdentity); void informRequestStartTransactionAccepted(ChargingStationId chargingStationId, EvseId evseId, IdentifyingToken identifyingToken, IdentityContext identityContext, CorrelationToken correlationToken); void informRequestStartTransactionRejected(ChargingStationId chargingStationId, EvseId evseId, IdentifyingToken identifyingToken, IdentityContext identityContext, CorrelationToken correlationToken); void informRequestStopTransactionAccepted(ChargingStationId chargingStationId, TransactionId transactionId, IdentityContext identityContext, CorrelationToken correlationToken); void informRequestStopTransactionRejected(ChargingStationId chargingStationId, TransactionId transactionId, IdentityContext identityContext, CorrelationToken correlationToken); void informReserved(ChargingStationId chargingStationId, ReservationId reservationId, EvseId evseId, Date expiryDate, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informReservationFaulted(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informReservationRejected(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informChargingStationUnavailable(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informChargingStationOccupied(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informReservationCancelled(ChargingStationId chargingStationId, ReservationId reservationId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informCacheCleared(ChargingStationId chargingStationId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeComponentAvailabilityToOperative(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeComponentAvailabilityToInoperative(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeChargingStationAvailabilityToOperative(ChargingStationId chargingStationId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeChargingStationAvailabilityToInoperative(ChargingStationId chargingStationId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeConfiguration(ChargingStationId chargingStationId, ConfigurationItem configurationItem, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informDataTransferResponse(ChargingStationId chargingStationId, String data, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informUnlockEvse(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void authorizationListChange(ChargingStationId chargingStationId, int version, AuthorizationListUpdateType updateType, Set<IdentifyingToken> identifyingTokens, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void setCommandGateway(DomainCommandGateway commandGateway); void setEventWaitingGateway(EventWaitingGateway eventWaitingGateway); void setChargingStationRepository(ChargingStationRepository chargingStationRepository); void setTransactionRepository(TransactionRepository transactionRepository); void setReservationIdentifierRepository(ReservationIdentifierRepository reservationIdentifierRepository); void setEntityManagerFactory(EntityManagerFactory entityManagerFactory); void setHeartbeatInterval(int heartbeatInterval); void setAuthorizationTimeoutInMillis(long authorizationTimeoutInMillis); void setUserIdentitiesWithAllPermissions(Set<UserIdentity> userIdentitiesWithAllPermissions); String retrieveChargingStationAddress(ChargingStationId id); NumberedReservationId generateReservationIdentifier(ChargingStationId chargingStationId, String protocolIdentifier); Transaction createTransaction(EvseId evseId); }
DomainService { public BootChargingStationResult bootChargingStation(ChargingStationId chargingStationId, String protocol, AttributeMap<String, String> attributes, AddOnIdentity addOnIdentity) { ChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId.getId()); IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); if (chargingStation == null) { LOG.debug("Not a known charging station on boot notification, we send a CreateChargingStationCommand."); commandGateway.send(new CreateChargingStationCommand(chargingStationId, userIdentitiesWithAllPermissions, identityContext), new CreateChargingStationCommandCallback( chargingStationId, protocol, attributes, addOnIdentity, chargingStationRepository, this)); return new BootChargingStationResult(false, heartbeatInterval, new Date()); } chargingStation.setIpAddress(attributes.get(AttributeMapKeys.CHARGING_STATION_ADDRESS)); chargingStation = chargingStationRepository.createOrUpdate(chargingStation); commandGateway.send(new BootChargingStationCommand(chargingStationId, protocol, attributes, identityContext)); return new BootChargingStationResult(chargingStation.isRegisteredAndConfigured(), heartbeatInterval, new Date()); }  BootChargingStationResult bootChargingStation(ChargingStationId chargingStationId, String protocol,
                                                         AttributeMap<String, String> attributes, AddOnIdentity addOnIdentity); void incomingDataTransfer(ChargingStationId chargingStationId, String data, String vendorId, String messageId, FutureEventCallback future, AddOnIdentity addOnIdentity); void heartbeat(ChargingStationId chargingStationId, AddOnIdentity addOnIdentity); void meterValues(ChargingStationId chargingStationId, TransactionId transactionId, EvseId evseId, List<MeterValue> meterValues, AddOnIdentity addOnIdentity); void diagnosticsFileNameReceived(ChargingStationId chargingStationId, String diagnosticsFileName, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void authorizationListVersionReceived(ChargingStationId chargingStationId, int currentVersion, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void authorize(ChargingStationId chargingStationId, String idTag, FutureEventCallback future, AddOnIdentity addOnIdentity); void receiveConfigurationItems(ChargingStationId chargingStationId, Set<ConfigurationItem> configurationItems, Set<String> requestedKeys, AddOnIdentity addOnIdentity); void diagnosticsUploadStatusUpdate(ChargingStationId chargingStationId, boolean diagnosticsUploaded, AddOnIdentity addOnIdentity); void firmwareStatusUpdate(ChargingStationId chargingStationId, FirmwareStatus firmwareStatus, AddOnIdentity addOnIdentity); void statusNotification(ChargingStationId chargingStationId, EvseId evseId, StatusNotification statusNotification, AddOnIdentity addOnIdentity); void startTransactionNoAuthorize(ChargingStationId chargingStationId, TransactionId transactionId,
                                            StartTransactionInfo startTransactionInfo, AddOnIdentity addOnIdentity); void startTransaction(ChargingStationId chargingStationId, EvseId evseId, IdentifyingToken idTag, FutureEventCallback futureEventCallback,
                                 AddOnIdentity addOnIdentity); void stopTransaction(ChargingStationId chargingStationId, NumberedTransactionId transactionId, IdentifyingToken idTag, int meterValueStop, Date timeStamp,
                                List<MeterValue> meterValues, AddOnIdentity addOnIdentity); void informRequestStartTransactionAccepted(ChargingStationId chargingStationId, EvseId evseId, IdentifyingToken identifyingToken, IdentityContext identityContext, CorrelationToken correlationToken); void informRequestStartTransactionRejected(ChargingStationId chargingStationId, EvseId evseId, IdentifyingToken identifyingToken, IdentityContext identityContext, CorrelationToken correlationToken); void informRequestStopTransactionAccepted(ChargingStationId chargingStationId, TransactionId transactionId, IdentityContext identityContext, CorrelationToken correlationToken); void informRequestStopTransactionRejected(ChargingStationId chargingStationId, TransactionId transactionId, IdentityContext identityContext, CorrelationToken correlationToken); void informReserved(ChargingStationId chargingStationId, ReservationId reservationId, EvseId evseId, Date expiryDate, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informReservationFaulted(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informReservationRejected(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informChargingStationUnavailable(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informChargingStationOccupied(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informReservationCancelled(ChargingStationId chargingStationId, ReservationId reservationId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informCacheCleared(ChargingStationId chargingStationId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeComponentAvailabilityToOperative(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeComponentAvailabilityToInoperative(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeChargingStationAvailabilityToOperative(ChargingStationId chargingStationId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeChargingStationAvailabilityToInoperative(ChargingStationId chargingStationId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void changeConfiguration(ChargingStationId chargingStationId, ConfigurationItem configurationItem, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informDataTransferResponse(ChargingStationId chargingStationId, String data, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void informUnlockEvse(ChargingStationId chargingStationId, EvseId evseId, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void authorizationListChange(ChargingStationId chargingStationId, int version, AuthorizationListUpdateType updateType, Set<IdentifyingToken> identifyingTokens, CorrelationToken correlationToken, AddOnIdentity addOnIdentity); void setCommandGateway(DomainCommandGateway commandGateway); void setEventWaitingGateway(EventWaitingGateway eventWaitingGateway); void setChargingStationRepository(ChargingStationRepository chargingStationRepository); void setTransactionRepository(TransactionRepository transactionRepository); void setReservationIdentifierRepository(ReservationIdentifierRepository reservationIdentifierRepository); void setEntityManagerFactory(EntityManagerFactory entityManagerFactory); void setHeartbeatInterval(int heartbeatInterval); void setAuthorizationTimeoutInMillis(long authorizationTimeoutInMillis); void setUserIdentitiesWithAllPermissions(Set<UserIdentity> userIdentitiesWithAllPermissions); String retrieveChargingStationAddress(ChargingStationId id); NumberedReservationId generateReservationIdentifier(ChargingStationId chargingStationId, String protocolIdentifier); Transaction createTransaction(EvseId evseId); static final int CHARGING_STATION_EVSE_ID; static final String ERROR_CODE_KEY; static final String INFO_KEY; static final String VENDOR_ID_KEY; static final String VENDOR_ERROR_CODE_KEY; }