Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ems/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ dependencies {
api "org.jboss.resteasy:resteasy-client-api:$resteasyVersion"
implementation "org.lfenergy.shapeshifter:shapeshifter-core:$shapeshifterVersion"
testImplementation "io.openremote:openremote-test:$openremoteVersion"
// Standalone (shaded) WireMock so its embedded Jetty/Jackson don't clash with the manager's web stack;
// used to mock the GOPACS broker / OAuth2 / address-book HTTP endpoints (the broker send goes through
// java.net.http.HttpClient, which a JAX-RS ClientRequestFilter cannot intercept).
testImplementation "org.wiremock:wiremock-standalone:$wiremockVersion"
}

jar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,52 @@ protected GOPACSHandler(String contractedEAN, String realm, String electricitySu
deploy(container);
}

/**
* Test-support constructor. Wires the message-processing collaborators directly and skips
* remote configuration (OAuth client, private-key file) and JAX-RS deployment, so the
* day-ahead UFTP message flow can be exercised in isolation. Not used in production wiring.
*/
protected GOPACSHandler(String contractedEAN,
String realm,
String electricitySupplierAssetId,
AssetProcessingService assetProcessingService,
AssetPredictedDatapointService assetPredictedDatapointService,
TimerService timerService,
ScheduledExecutorService scheduledExecutorService,
String privateKey) {
this.devMode = false;
this.contractedEAN = contractedEAN;
this.realm = realm;
this.electricitySupplierAssetId = electricitySupplierAssetId;
this.participants = new HashMap<>();

this.assetProcessingService = assetProcessingService;
this.assetPredictedDatapointService = assetPredictedDatapointService;
this.timerService = timerService;
this.scheduledExecutorService = scheduledExecutorService;
this.webService = null;

this.gopacsBrokerUrl = "";
this.responseDelaySeconds = 0;
this.flexOfferDelaySeconds = 0;
this.clientId = null;
this.clientSecret = null;
this.privateKey = privateKey;

this.client = null;
this.gopacsAddressBookResource = null;
this.gopacsAuthResource = null;
this.gopacsServerResource = null;

Comment thread
richturner marked this conversation as resolved.
this.participantResolutionService = new ParticipantResolutionService(this);
this.cryptoService = new UftpCryptoService(participantResolutionService, new LazySodiumFactory(), new LazySodiumBase64Pool());
this.uftpValidationService = new UftpValidationService(new ArrayList<>());
this.uftpReceivedMessageService = new UftpReceivedMessageService(uftpValidationService, this);
this.uftpSendMessageService = new UftpSendMessageService(serializer, cryptoService, participantResolutionService, this, uftpValidationService);

this.objectMapper = new ObjectMapper();
}

protected static String getDeploymentName(String contractedEAN) {
return "GOPACS: " + contractedEAN;
}
Expand Down
Loading
Loading