Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
seran committed Oct 24, 2023
1 parent 7311d82 commit 85064cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ public static String[] collectExternalServiceInfo(ExternalServiceInfo remoteHost
connectPort = ExternalServiceSharedUtils.getDefaultWMPort(signature);
}

ExternalServiceMapping externalServiceMapping = ExecutionTracer.getExternalMappingBySignature(signature);

return new String[]{externalServiceMapping.getLocalIPAddress(), "" + connectPort};
return new String[]{ExecutionTracer.getExternalMappingBySignature(signature), "" + connectPort};
} else {

return new String[]{ExecutionTracer.getExternalMappingByHostname(remoteHostInfo.getHostname()).getLocalIPAddress(), "" + remotePort};
return new String[]{ExecutionTracer.getExternalMappingByHostname(remoteHostInfo.getHostname()), "" + remotePort};
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,21 +697,24 @@ public static void addEmployedDefaultWMHost(ExternalServiceInfo hostInfo) {
* Return the WireMock IP if there is a mapping for the hostname. If there is
* no mapping NULL will be returned
*/
public static ExternalServiceMapping getExternalMappingBySignature(String signature) {
public static String getExternalMappingBySignature(String signature) {
List<ExternalServiceMapping> m = externalServiceMapping
.stream()
.filter(e -> e.getSignature().equals(signature))
.collect(Collectors.toList());

return m.get(0);
if (m.isEmpty()) {
return null;
}
return m.get(0).getLocalIPAddress();
}

public static ExternalServiceMapping getExternalMappingByHostname(String hostname) {
public static String getExternalMappingByHostname(String hostname) {
return externalServiceMapping
.stream()
.filter(e -> e.getRemoteHostname().equals(hostname))
.collect(Collectors.toList())
.get(0);
.get(0).getLocalIPAddress();
}

public static boolean hasActiveExternalMapping(String signature) {
Expand All @@ -724,7 +727,7 @@ public static boolean hasActiveExternalMapping(String signature) {
public static boolean hasMockServerForHost(String hostname) {
return externalServiceMapping
.stream()
.filter(e -> e.getRemoteHostname() == hostname)
.filter(e -> e.getRemoteHostname().equals(hostname))
.count() > 0;
}

Expand Down

0 comments on commit 85064cb

Please sign in to comment.