Skip to content

Commit

Permalink
compile fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Azores <[email protected]>
  • Loading branch information
andrewazores committed Apr 22, 2023
1 parent f6098f4 commit 3942f02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,28 +180,23 @@ public IntermediateResponse<ServiceRef> handle(RequestParameters params) throws
? Optional.empty()
: Optional.of(new Credentials(username, password));

if (credentials.isPresent()) {
if (storeCredentials) {
String matchExpression =
CredentialsManager.targetIdToMatchExpression(connectUrl);
int id = credentialsManager.addCredentials(matchExpression, credentials.get());
notificationFactory
.createBuilder()
.metaCategory("CredentialsStored")
.metaType(HttpMimeType.JSON)
.message(
Map.of(
"id",
id,
"matchExpression",
matchExpression,
"numMatchingTargets",
1))
.build()
.send();
} else {
credentialsManager.setSessionCredentials(uri.toString(), credentials.get());
}
if (storeCredentials && credentials.isPresent()) {
String matchExpression = CredentialsManager.targetIdToMatchExpression(connectUrl);
int id = credentialsManager.addCredentials(matchExpression, credentials.get());
notificationFactory
.createBuilder()
.metaCategory("CredentialsStored")
.metaType(HttpMimeType.JSON)
.message(
Map.of(
"id",
id,
"matchExpression",
matchExpression,
"numMatchingTargets",
1))
.build()
.send();
}

String jvmId = jvmIdHelper.getJvmId(uri.toString(), false, credentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,6 @@ void testRequestWithDryRunQueryIncludingCredentials() throws Exception {
IntermediateResponse<ServiceRef> response = handler.handle(params);
MatcherAssert.assertThat(response.getStatusCode(), Matchers.equalTo(202));

Mockito.verify(credentialsManager).setSessionCredentials(Mockito.any(), Mockito.any());

ServiceRef respRef = response.getBody();
MatcherAssert.assertThat(respRef.getServiceUri(), Matchers.equalTo(new URI(connectUrl)));
MatcherAssert.assertThat(respRef.getAlias(), Matchers.equalTo(Optional.of(alias)));
Expand Down

0 comments on commit 3942f02

Please sign in to comment.