Skip to content

Commit

Permalink
PR remark
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed May 6, 2024
1 parent ea27c91 commit 3a3784e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,22 @@ public void initialize() {
getMonitor().warning("The runtime is configured as an anonymous participant. DO NOT DO THIS IN PRODUCTION.");
}

var connectorName = getSetting(EDC_CONNECTOR_NAME, null);
if (connectorName != null) {
getMonitor().warning("Setting %s has been deprecated, please use %s instead".formatted(EDC_CONNECTOR_NAME, RUNTIME_ID));
}

runtimeId = getSetting(RUNTIME_ID, null);
if (runtimeId == null) {
getMonitor().warning("Runtime id is not configured so a random UUID is used. It is recommended to provide a static one.");
runtimeId = UUID.randomUUID().toString();
if (connectorName == null) {
getMonitor().warning("%s is not configured so a random UUID is used. It is recommended to provide a static one.".formatted(RUNTIME_ID));
runtimeId = UUID.randomUUID().toString();
} else {
getMonitor().warning("%s is not configured and it will fallback to the deprecated %s value".formatted(RUNTIME_ID, EDC_CONNECTOR_NAME));
runtimeId = connectorName;
}
}

if (getSetting(EDC_CONNECTOR_NAME, null) != null) {
getMonitor().warning("Setting %s has been deprecated, please use %s instead".formatted(EDC_CONNECTOR_NAME, RUNTIME_ID));
}
}

// this method exists so that getting env vars can be mocked during testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void shouldReturnRandomUuid_whenNotConfigured() {
var runtimeId = context.getRuntimeId();

assertThat(UUID.fromString(runtimeId)).isNotNull();
verify(monitor).warning(and(isA(String.class), argThat(message -> message.startsWith("Runtime id"))));
verify(monitor).warning(and(isA(String.class), argThat(message -> message.startsWith(RUNTIME_ID))));
}

@Test
Expand Down

0 comments on commit 3a3784e

Please sign in to comment.