]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
refactor(ocpp): extract responseHandler and incomingRequestHandler into base classes
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 15 Mar 2026 22:57:20 +0000 (23:57 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 15 Mar 2026 22:57:20 +0000 (23:57 +0100)
commitef86be68d6b8ed032921d85b37315629ad6cf0f2
treef9039323226243e74ca76993aabae626c6319e23
parent3de193f999a0750fac951e09682e860c68d88c5a
refactor(ocpp): extract responseHandler and incomingRequestHandler into base classes

Both methods were 95% identical across OCPP 1.6 and 2.0 subclasses
(~160 lines of pure duplication). Move the shared logic into the base
classes, parameterized by 3 abstract properties each subclass provides:
- bootNotificationRequestCommand / pendingStateBlockedCommands
- csmsName ('central system' vs 'CSMS')
- isRequestCommandSupported / isIncomingRequestCommandSupported

Zero behavior change — pure refactoring validated by 1853 passing tests.
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20ResponseService.ts
src/charging-station/ocpp/OCPPIncomingRequestService.ts
src/charging-station/ocpp/OCPPResponseService.ts