]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
refactor(ocpp): extract version-specific logic from consumer layer
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 31 Mar 2026 00:30:22 +0000 (02:30 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 31 Mar 2026 00:30:22 +0000 (02:30 +0200)
commit24a6d645f6224b3ae95d075d9e5a2e96eee0e585
tree21d54b7603e5bba17abc69f570ccecc3dc1547a0
parentf753beb9a75a7306b8f94ba6254220b6e805a6b3
refactor(ocpp): extract version-specific logic from consumer layer

Move remaining version-specific logic from charging-station/ consumer
layer into the ocpp/ component:

- Create OCPPServiceFactory.ts with createOCPPServices() factory that
  instantiates version-specific OCPP services, removing 6 version-
  specific class imports from ChargingStation.ts
- Move createBootNotificationRequest from Helpers.ts into version-
  specific buildBootNotificationRequest methods in OCPP16ServiceUtils
  and OCPP20ServiceUtils, with dispatcher in OCPPServiceOperations.ts

ChargingStation.ts no longer has any direct knowledge of OCPP version-
specific service classes. All version dispatch is handled by the ocpp/
component through factories and dispatchers.

Add unit tests for createOCPPServices (4 tests) and
buildBootNotificationRequest (6 tests) in existing test files.
src/charging-station/ChargingStation.ts
src/charging-station/Helpers.ts
src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts
src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts
src/charging-station/ocpp/OCPPServiceFactory.ts [new file with mode: 0644]
src/charging-station/ocpp/OCPPServiceOperations.ts
src/charging-station/ocpp/index.ts
tests/charging-station/ocpp/OCPPServiceFactory.test.ts [new file with mode: 0644]
tests/charging-station/ocpp/OCPPServiceOperations.test.ts