diff --git a/adoption/src/main/java/org/dcsa/conformance/standards/adoption/AdoptionStandard.java b/adoption/src/main/java/org/dcsa/conformance/standards/adoption/AdoptionStandard.java index e018e3f8..19a50342 100644 --- a/adoption/src/main/java/org/dcsa/conformance/standards/adoption/AdoptionStandard.java +++ b/adoption/src/main/java/org/dcsa/conformance/standards/adoption/AdoptionStandard.java @@ -3,10 +3,13 @@ import java.util.*; import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.adoption.party.AdoptionRole; public class AdoptionStandard extends AbstractStandard { public static final AdoptionStandard INSTANCE = new AdoptionStandard(); - public static final String ADOPTION_STATS_EXAMPLE = "/standards/adoption/messages/adoption-%s-example.json"; + public static final String SCENARIO_SUITE_CONFORMANCE = "Conformance"; + public static final String ADOPTION_STATS_EXAMPLE = + "/standards/adoption/messages/adoption-%s-example.json"; private AdoptionStandard() { super("Adoption"); @@ -15,8 +18,26 @@ private AdoptionStandard() { @Override public SortedMap> getScenarioSuitesByStandardVersion() { return new TreeMap<>( - Map.ofEntries( - Map.entry("1.0.0", new TreeSet<>(Set.of("Conformance"))))); + Map.ofEntries(Map.entry("1.0.0", new TreeSet<>(Set.of(SCENARIO_SUITE_CONFORMANCE))))); + } + + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + return Map.ofEntries( + Map.entry( + SCENARIO_SUITE_CONFORMANCE, + Map.ofEntries( + Map.entry( + AdoptionRole.ADOPTER.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry("/v1/adoption-stats", new TreeSet<>(Set.of("GET")))))), + Map.entry( + AdoptionRole.DCSA.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry("/v1/adoption-stats", new TreeSet<>(Set.of("GET"))))))))); } @Override diff --git a/booking/src/main/java/org/dcsa/conformance/standards/booking/BookingStandard.java b/booking/src/main/java/org/dcsa/conformance/standards/booking/BookingStandard.java index 2bb2a51f..d8696ac7 100644 --- a/booking/src/main/java/org/dcsa/conformance/standards/booking/BookingStandard.java +++ b/booking/src/main/java/org/dcsa/conformance/standards/booking/BookingStandard.java @@ -2,6 +2,7 @@ import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.booking.party.BookingRole; import java.util.*; @@ -24,6 +25,31 @@ public SortedMap> getScenarioSuitesByStandardVersion() BookingScenarioListBuilder.SCENARIO_SUITE_RI))))); } + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + Map>> endpointUrisAndMethodsByRoleName = + Map.ofEntries( + Map.entry( + BookingRole.CARRIER.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry("/v2/bookings", new TreeSet<>(Set.of("POST"))), + Map.entry( + "/v2/bookings/{bookingReference}", + new TreeSet<>(Set.of("PUT", "GET", "PATCH")))))), + Map.entry( + BookingRole.SHIPPER.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry("/v2/booking-notifications", new TreeSet<>(Set.of("POST"))))))); + return Map.ofEntries( + Map.entry( + BookingScenarioListBuilder.SCENARIO_SUITE_CONFORMANCE, + endpointUrisAndMethodsByRoleName), + Map.entry(BookingScenarioListBuilder.SCENARIO_SUITE_RI, endpointUrisAndMethodsByRoleName)); + } + @Override protected AbstractComponentFactory doCreateComponentFactory( String standardVersion, String scenarioSuite) { diff --git a/commercial-schedules/src/main/java/org/dcsa/conformance/standards/cs/CsStandard.java b/commercial-schedules/src/main/java/org/dcsa/conformance/standards/cs/CsStandard.java index ba4d1f1f..86b20669 100644 --- a/commercial-schedules/src/main/java/org/dcsa/conformance/standards/cs/CsStandard.java +++ b/commercial-schedules/src/main/java/org/dcsa/conformance/standards/cs/CsStandard.java @@ -3,9 +3,11 @@ import java.util.*; import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.cs.party.CsRole; public class CsStandard extends AbstractStandard { public static final CsStandard INSTANCE = new CsStandard(); + public static final String SCENARIO_SUITE_CONFORMANCE = "Conformance"; private CsStandard() { super("CS"); @@ -13,7 +15,25 @@ private CsStandard() { @Override public SortedMap> getScenarioSuitesByStandardVersion() { - return new TreeMap<>(Map.ofEntries(Map.entry("1.0.0", new TreeSet<>(Set.of("Conformance"))))); + return new TreeMap<>( + Map.ofEntries(Map.entry("1.0.0", new TreeSet<>(Set.of(SCENARIO_SUITE_CONFORMANCE))))); + } + + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + return Map.ofEntries( + Map.entry( + SCENARIO_SUITE_CONFORMANCE, + Map.ofEntries( + Map.entry( + CsRole.PUBLISHER.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry("/v1/point-to-point-routes", new TreeSet<>(Set.of("GET"))), + Map.entry("/v1/port-schedules", new TreeSet<>(Set.of("GET"))), + Map.entry("/v1/vessel-schedules", new TreeSet<>(Set.of("GET")))))), + Map.entry(CsRole.SUBSCRIBER.getConfigName(), new TreeMap<>())))); } @Override diff --git a/core/src/main/java/org/dcsa/conformance/core/AbstractStandard.java b/core/src/main/java/org/dcsa/conformance/core/AbstractStandard.java index 2c13a65d..caa95daa 100644 --- a/core/src/main/java/org/dcsa/conformance/core/AbstractStandard.java +++ b/core/src/main/java/org/dcsa/conformance/core/AbstractStandard.java @@ -1,5 +1,6 @@ package org.dcsa.conformance.core; +import java.util.Map; import java.util.SortedMap; import java.util.SortedSet; import lombok.Getter; @@ -14,6 +15,9 @@ protected AbstractStandard(String name) { public abstract SortedMap> getScenarioSuitesByStandardVersion(); + public abstract Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName(); + protected abstract AbstractComponentFactory doCreateComponentFactory( String standardVersion, String scenarioSuite); diff --git a/core/src/main/java/org/dcsa/conformance/core/party/ConformanceParty.java b/core/src/main/java/org/dcsa/conformance/core/party/ConformanceParty.java index f9eeff2b..ec1107df 100644 --- a/core/src/main/java/org/dcsa/conformance/core/party/ConformanceParty.java +++ b/core/src/main/java/org/dcsa/conformance/core/party/ConformanceParty.java @@ -234,7 +234,7 @@ private ConformanceRequest _createConformanceRequest( withFullApiVersionHeader ? apiVersion : apiVersion.split("\\.")[0]; return new ConformanceRequest( method, - counterpartConfiguration.getUrl() + path, + _getCounterpartUrl(counterpartConfiguration, method, path), queryParams, new ConformanceMessage( partyConfiguration.getName(), @@ -267,6 +267,27 @@ private ConformanceRequest _createConformanceRequest( System.currentTimeMillis())); } + private String _getCounterpartUrl( + CounterpartConfiguration counterpartConfiguration, String method, String path) { + var url = counterpartConfiguration.getUrl() + path; + EndpointUriOverrideConfiguration[] endpointUriOverrideConfigurations = + counterpartConfiguration.getEndpointUriOverrideConfigurations(); + if (endpointUriOverrideConfigurations != null) { + for (EndpointUriOverrideConfiguration endpointUriOverrideConfiguration : + endpointUriOverrideConfigurations) { + if (method.equals(endpointUriOverrideConfiguration.getMethod())) { + int baseUriIndex = url.indexOf(endpointUriOverrideConfiguration.getEndpointBaseUri()); + if (baseUriIndex > -1) { + return url.replace( + endpointUriOverrideConfiguration.getEndpointBaseUri(), + endpointUriOverrideConfiguration.getBaseUriOverride()); + } + } + } + } + return url; + } + public abstract ConformanceResponse handleRequest(ConformanceRequest request); public void handleNotification() { diff --git a/core/src/main/java/org/dcsa/conformance/core/party/CounterpartConfiguration.java b/core/src/main/java/org/dcsa/conformance/core/party/CounterpartConfiguration.java index 20fd1345..6aec8ea2 100644 --- a/core/src/main/java/org/dcsa/conformance/core/party/CounterpartConfiguration.java +++ b/core/src/main/java/org/dcsa/conformance/core/party/CounterpartConfiguration.java @@ -20,6 +20,7 @@ public class CounterpartConfiguration { private String authHeaderName = ""; private String authHeaderValue = ""; private HttpHeaderConfiguration[] externalPartyAdditionalHeaders; + private EndpointUriOverrideConfiguration[] endpointUriOverrideConfigurations; public static void validateUrl(String url, boolean allowHttpLocalhost) throws UserFacingException { try { diff --git a/core/src/main/java/org/dcsa/conformance/core/party/EndpointUriOverrideConfiguration.java b/core/src/main/java/org/dcsa/conformance/core/party/EndpointUriOverrideConfiguration.java new file mode 100644 index 00000000..5bf99d48 --- /dev/null +++ b/core/src/main/java/org/dcsa/conformance/core/party/EndpointUriOverrideConfiguration.java @@ -0,0 +1,19 @@ +package org.dcsa.conformance.core.party; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@AllArgsConstructor +@NoArgsConstructor +public class EndpointUriOverrideConfiguration { + private String method; + private String endpointBaseUri; + private String endpointSuffix; + private String baseUriOverride; +} diff --git a/ebl-issuance/src/main/java/org/dcsa/conformance/standards/eblissuance/EblIssuanceStandard.java b/ebl-issuance/src/main/java/org/dcsa/conformance/standards/eblissuance/EblIssuanceStandard.java index 91667b83..0bbbf33d 100644 --- a/ebl-issuance/src/main/java/org/dcsa/conformance/standards/eblissuance/EblIssuanceStandard.java +++ b/ebl-issuance/src/main/java/org/dcsa/conformance/standards/eblissuance/EblIssuanceStandard.java @@ -3,9 +3,11 @@ import java.util.*; import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.eblissuance.party.EblIssuanceRole; public class EblIssuanceStandard extends AbstractStandard { public static final EblIssuanceStandard INSTANCE = new EblIssuanceStandard(); + public static final String SCENARIO_SUITE_CONFORMANCE = "Conformance"; private EblIssuanceStandard() { super("eBL Issuance"); @@ -14,8 +16,28 @@ private EblIssuanceStandard() { @Override public SortedMap> getScenarioSuitesByStandardVersion() { return new TreeMap<>( - Map.ofEntries( - Map.entry("3.0.0", new TreeSet<>(Set.of("Conformance"))))); + Map.ofEntries(Map.entry("3.0.0", new TreeSet<>(Set.of(SCENARIO_SUITE_CONFORMANCE))))); + } + + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + return Map.ofEntries( + Map.entry( + SCENARIO_SUITE_CONFORMANCE, + Map.ofEntries( + Map.entry( + EblIssuanceRole.CARRIER.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry( + "/v3/ebl-issuance-responses", new TreeSet<>(Set.of("POST")))))), + Map.entry( + EblIssuanceRole.PLATFORM.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry( + "/v3/ebl-issuance-requests", new TreeSet<>(Set.of("PUT"))))))))); } @Override diff --git a/ebl-surrender/src/main/java/org/dcsa/conformance/standards/eblsurrender/EblSurrenderStandard.java b/ebl-surrender/src/main/java/org/dcsa/conformance/standards/eblsurrender/EblSurrenderStandard.java index 0b4cdd7a..caacc5be 100644 --- a/ebl-surrender/src/main/java/org/dcsa/conformance/standards/eblsurrender/EblSurrenderStandard.java +++ b/ebl-surrender/src/main/java/org/dcsa/conformance/standards/eblsurrender/EblSurrenderStandard.java @@ -3,9 +3,11 @@ import java.util.*; import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.eblsurrender.party.EblSurrenderRole; public class EblSurrenderStandard extends AbstractStandard { public static final EblSurrenderStandard INSTANCE = new EblSurrenderStandard(); + public static final String SCENARIO_SUITE_CONFORMANCE = "Conformance"; private EblSurrenderStandard() { super("eBL Surrender"); @@ -13,7 +15,29 @@ private EblSurrenderStandard() { @Override public SortedMap> getScenarioSuitesByStandardVersion() { - return new TreeMap<>(Map.ofEntries(Map.entry("3.0.0", new TreeSet<>(Set.of("Conformance"))))); + return new TreeMap<>( + Map.ofEntries(Map.entry("3.0.0", new TreeSet<>(Set.of(SCENARIO_SUITE_CONFORMANCE))))); + } + + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + return Map.ofEntries( + Map.entry( + SCENARIO_SUITE_CONFORMANCE, + Map.ofEntries( + Map.entry( + EblSurrenderRole.CARRIER.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry( + "/v3/ebl-surrender-requests", new TreeSet<>(Set.of("POST")))))), + Map.entry( + EblSurrenderRole.PLATFORM.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry( + "/v3/ebl-surrender-responses", new TreeSet<>(Set.of("POST"))))))))); } @Override diff --git a/ebl/src/main/java/org/dcsa/conformance/standards/ebl/EblStandard.java b/ebl/src/main/java/org/dcsa/conformance/standards/ebl/EblStandard.java index a358b763..d286a461 100644 --- a/ebl/src/main/java/org/dcsa/conformance/standards/ebl/EblStandard.java +++ b/ebl/src/main/java/org/dcsa/conformance/standards/ebl/EblStandard.java @@ -3,6 +3,7 @@ import java.util.*; import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.ebl.party.EblRole; public class EblStandard extends AbstractStandard { public static final EblStandard INSTANCE = new EblStandard(); @@ -14,10 +15,49 @@ private EblStandard() { @Override public SortedMap> getScenarioSuitesByStandardVersion() { return new TreeMap<>( - Map.ofEntries( - Map.entry( - "3.0.0", - new TreeSet<>(EblScenarioListBuilder.SCENARIOS)))); + Map.ofEntries(Map.entry("3.0.0", new TreeSet<>(EblScenarioListBuilder.SCENARIOS)))); + } + + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + return Map.ofEntries( + Map.entry( + EblScenarioListBuilder.SCENARIO_SUITE_CONFORMANCE_SI_ONLY, + Map.ofEntries( + Map.entry(EblRole.CARRIER.getConfigName(), new TreeMap<>(Map.ofEntries(Map.entry("/v3/shipping-instructions", new TreeSet<>(Set.of("POST"))), + Map.entry( + "/v3/shipping-instructions/{documentReference}", + new TreeSet<>(Set.of("PUT", "GET", "PATCH")))))), + Map.entry(EblRole.SHIPPER.getConfigName(), new TreeMap<>(Map.ofEntries(Map.entry( + "/v3/shipping-instructions-notifications", + new TreeSet<>(Set.of("POST")))))))), + Map.entry( + EblScenarioListBuilder.SCENARIO_SUITE_CONFORMANCE_TD_ONLY, + Map.ofEntries( + Map.entry(EblRole.CARRIER.getConfigName(), new TreeMap<>(Map.ofEntries(Map.entry( + "/v3/transport-documents/{transportDocumentReference}", + new TreeSet<>(Set.of("GET", "PATCH")))))), + Map.entry(EblRole.SHIPPER.getConfigName(), new TreeMap<>(Map.ofEntries(Map.entry( + "/v3/transport-document-notifications", + new TreeSet<>(Set.of("POST")))))))), + Map.entry( + EblScenarioListBuilder.SCENARIO_SUITE_RI, + Map.ofEntries( + Map.entry(EblRole.CARRIER.getConfigName(), new TreeMap<>(Map.ofEntries(Map.entry("/v3/shipping-instructions", new TreeSet<>(Set.of("POST"))), + Map.entry( + "/v3/shipping-instructions/{documentReference}", + new TreeSet<>(Set.of("PUT", "GET", "PATCH"))), + Map.entry( + "/v3/transport-documents/{transportDocumentReference}", + new TreeSet<>(Set.of("GET", "PATCH")))))), + Map.entry(EblRole.SHIPPER.getConfigName(), new TreeMap<>(Map.ofEntries( + Map.entry( + "/v3/shipping-instructions-notifications", + new TreeSet<>(Set.of("POST"))), + Map.entry( + "/v3/transport-document-notifications", + new TreeSet<>(Set.of("POST"))))))))); } @Override diff --git a/jit/src/main/java/org/dcsa/conformance/standards/jit/JitStandard.java b/jit/src/main/java/org/dcsa/conformance/standards/jit/JitStandard.java index 08a43aa5..5a7f7101 100644 --- a/jit/src/main/java/org/dcsa/conformance/standards/jit/JitStandard.java +++ b/jit/src/main/java/org/dcsa/conformance/standards/jit/JitStandard.java @@ -3,9 +3,11 @@ import java.util.*; import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.jit.party.JitRole; public class JitStandard extends AbstractStandard { public static final JitStandard INSTANCE = new JitStandard(); + public static final String SCENARIO_SUITE_CONFORMANCE = "Conformance"; private JitStandard() { super("JIT"); @@ -14,8 +16,24 @@ private JitStandard() { @Override public SortedMap> getScenarioSuitesByStandardVersion() { return new TreeMap<>( - Map.ofEntries( - Map.entry("1.2.0", new TreeSet<>(Set.of("Conformance"))))); + Map.ofEntries(Map.entry("1.2.0", new TreeSet<>(Set.of(SCENARIO_SUITE_CONFORMANCE))))); + } + + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + return Map.ofEntries( + Map.entry( + SCENARIO_SUITE_CONFORMANCE, + Map.ofEntries( + Map.entry( + JitRole.PUBLISHER.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry( + "/v2/port-call-services/{portCallServiceID}", + new TreeSet<>(Set.of("GET")))))), + Map.entry(JitRole.SUBSCRIBER.getConfigName(), new TreeMap<>())))); } @Override diff --git a/ovs/src/main/java/org/dcsa/conformance/standards/ovs/OvsStandard.java b/ovs/src/main/java/org/dcsa/conformance/standards/ovs/OvsStandard.java index c86316f5..345b4b51 100644 --- a/ovs/src/main/java/org/dcsa/conformance/standards/ovs/OvsStandard.java +++ b/ovs/src/main/java/org/dcsa/conformance/standards/ovs/OvsStandard.java @@ -3,9 +3,11 @@ import java.util.*; import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.ovs.party.OvsRole; public class OvsStandard extends AbstractStandard { public static final OvsStandard INSTANCE = new OvsStandard(); + public static final String SCENARIO_SUITE_CONFORMANCE = "Conformance"; private OvsStandard() { super("OVS"); @@ -13,7 +15,23 @@ private OvsStandard() { @Override public SortedMap> getScenarioSuitesByStandardVersion() { - return new TreeMap<>(Map.ofEntries(Map.entry("3.0.0", new TreeSet<>(Set.of("Conformance"))))); + return new TreeMap<>( + Map.ofEntries(Map.entry("3.0.0", new TreeSet<>(Set.of(SCENARIO_SUITE_CONFORMANCE))))); + } + + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + return Map.ofEntries( + Map.entry( + SCENARIO_SUITE_CONFORMANCE, + Map.ofEntries( + Map.entry( + OvsRole.PUBLISHER.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry("/v3/service-schedules", new TreeSet<>(Set.of("GET")))))), + Map.entry(OvsRole.SUBSCRIBER.getConfigName(), new TreeMap<>())))); } @Override diff --git a/pint/src/main/java/org/dcsa/conformance/standards/eblinterop/PintStandard.java b/pint/src/main/java/org/dcsa/conformance/standards/eblinterop/PintStandard.java index cc879c68..86d3c304 100644 --- a/pint/src/main/java/org/dcsa/conformance/standards/eblinterop/PintStandard.java +++ b/pint/src/main/java/org/dcsa/conformance/standards/eblinterop/PintStandard.java @@ -3,9 +3,11 @@ import java.util.*; import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.eblinterop.party.PintRole; public class PintStandard extends AbstractStandard { public static final PintStandard INSTANCE = new PintStandard(); + public static final String SCENARIO_SUITE_CONFORMANCE = "Conformance"; private PintStandard() { super("PINT"); @@ -14,8 +16,29 @@ private PintStandard() { @Override public SortedMap> getScenarioSuitesByStandardVersion() { return new TreeMap<>( - Map.ofEntries( - Map.entry("3.0.0", new TreeSet<>(Set.of("Conformance"))))); + Map.ofEntries(Map.entry("3.0.0", new TreeSet<>(Set.of(SCENARIO_SUITE_CONFORMANCE))))); + } + + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + return Map.ofEntries( + Map.entry( + SCENARIO_SUITE_CONFORMANCE, + Map.ofEntries( + Map.entry( + PintRole.RECEIVING_PLATFORM.getConfigName(), + new TreeMap<>( + Map.ofEntries( + Map.entry("/v3/receiver-validation", new TreeSet<>(Set.of("POST"))), + Map.entry("/v3/envelopes", new TreeSet<>(Set.of("POST"))), + Map.entry( + "/v3/envelopes/{envelopeReference}/additional-documents/{documentChecksum}", + new TreeSet<>(Set.of("PUT"))), + Map.entry( + "/v3/envelopes/{envelopeReference}/finish-transfer", + new TreeSet<>(Set.of("PUT")))))), + Map.entry(PintRole.SENDING_PLATFORM.getConfigName(), new TreeMap<>())))); } @Override diff --git a/sandbox/src/main/java/org/dcsa/conformance/sandbox/ConformanceWebuiHandler.java b/sandbox/src/main/java/org/dcsa/conformance/sandbox/ConformanceWebuiHandler.java index 65700819..43bfc9f4 100644 --- a/sandbox/src/main/java/org/dcsa/conformance/sandbox/ConformanceWebuiHandler.java +++ b/sandbox/src/main/java/org/dcsa/conformance/sandbox/ConformanceWebuiHandler.java @@ -16,8 +16,10 @@ import org.dcsa.conformance.core.AbstractStandard; import org.dcsa.conformance.core.UserFacingException; import org.dcsa.conformance.core.party.CounterpartConfiguration; +import org.dcsa.conformance.core.party.EndpointUriOverrideConfiguration; import org.dcsa.conformance.core.party.HttpHeaderConfiguration; import org.dcsa.conformance.core.party.PartyConfiguration; +import org.dcsa.conformance.core.toolkit.JsonToolkit; import org.dcsa.conformance.sandbox.configuration.SandboxConfiguration; import org.dcsa.conformance.sandbox.state.ConformancePersistenceProvider; @@ -57,12 +59,12 @@ public JsonNode handleRequest(String userId, JsonNode requestNode) { } else { ObjectNode node = OBJECT_MAPPER .createObjectNode().put("error", "Internal Server Error"); - if (developerMode) { + if (developerMode) { node.put("exception", e.getClass().getName()) .put("message", e.getMessage()); - } - log.warn("Internal Server Error: {}; Message: {}", e.getClass().getName(), e.getMessage()); - return node; + } + log.warn("Internal Server Error: {}; Message: {}", e.getClass().getName(), e.getMessage()); + return node; } } } @@ -71,23 +73,23 @@ public JsonNode _doHandleRequest(String userId, JsonNode requestNode) { log.info("ConformanceWebuiHandler.handleRequest({})", requestNode.toPrettyString()); String operation = requestNode.get("operation").asText(); JsonNode resultNode = switch (operation) { - case "createSandbox" -> _createSandbox(userId, requestNode); - case "getSandboxConfig" -> _getSandboxConfig(userId, requestNode); - case "getSandboxStatus" -> _getSandboxStatus(userId, requestNode); - case "updateSandboxConfig" -> _updateSandboxConfig(userId, requestNode); - case "getAvailableStandards" -> _getAvailableStandards(); - case "getAllSandboxes" -> _getAllSandboxes(userId); - case "getSandbox" -> _getSandbox(userId, requestNode); - case "notifyParty" -> _notifyParty(userId, requestNode); - case "resetParty" -> _resetParty(userId, requestNode); - case "getScenarioDigests" -> _getScenarioDigests(userId, requestNode); - case "getScenario" -> _getScenario(userId, requestNode); - case "getScenarioStatus" -> _getScenarioStatus(userId, requestNode); - case "handleActionInput" -> _handleActionInput(userId, requestNode); - case "startOrStopScenario" -> _startOrStopScenario(userId, requestNode); - case "completeCurrentAction" -> _completeCurrentAction(userId, requestNode); - default -> throw new UnsupportedOperationException(operation); - }; + case "createSandbox" -> _createSandbox(userId, requestNode); + case "getSandboxConfig" -> _getSandboxConfig(userId, requestNode); + case "getSandboxStatus" -> _getSandboxStatus(userId, requestNode); + case "updateSandboxConfig" -> _updateSandboxConfig(userId, requestNode); + case "getAvailableStandards" -> _getAvailableStandards(); + case "getAllSandboxes" -> _getAllSandboxes(userId); + case "getSandbox" -> _getSandbox(userId, requestNode); + case "notifyParty" -> _notifyParty(userId, requestNode); + case "resetParty" -> _resetParty(userId, requestNode); + case "getScenarioDigests" -> _getScenarioDigests(userId, requestNode); + case "getScenario" -> _getScenario(userId, requestNode); + case "getScenarioStatus" -> _getScenarioStatus(userId, requestNode); + case "handleActionInput" -> _handleActionInput(userId, requestNode); + case "startOrStopScenario" -> _startOrStopScenario(userId, requestNode); + case "completeCurrentAction" -> _completeCurrentAction(userId, requestNode); + default -> throw new UnsupportedOperationException(operation); + }; log.debug("ConformanceWebuiHandler.handleRequest() returning: {}", resultNode.toPrettyString()); return resultNode; } @@ -205,14 +207,14 @@ private JsonNode _getSandboxConfig(String userId, JsonNode requestNode) { .orElseThrow(); ObjectNode jsonSandboxConfig = OBJECT_MAPPER - .createObjectNode() - .put(SANDBOX_ID, sandboxConfiguration.getId()) - .put("sandboxName", sandboxConfiguration.getName()) - .put("sandboxUrl", sandboxPartyCounterpartConfig.getUrl()) - .put("sandboxAuthHeaderName", sandboxConfiguration.getAuthHeaderName()) - .put("sandboxAuthHeaderValue", sandboxConfiguration.getAuthHeaderValue()) - .put("externalPartyUrl", externalPartyCounterpartConfig.getUrl()) - .put("externalPartyAuthHeaderName", externalPartyCounterpartConfig.getAuthHeaderName()) + .createObjectNode() + .put(SANDBOX_ID, sandboxConfiguration.getId()) + .put("sandboxName", sandboxConfiguration.getName()) + .put("sandboxUrl", sandboxPartyCounterpartConfig.getUrl()) + .put("sandboxAuthHeaderName", sandboxConfiguration.getAuthHeaderName()) + .put("sandboxAuthHeaderValue", sandboxConfiguration.getAuthHeaderValue()) + .put("externalPartyUrl", externalPartyCounterpartConfig.getUrl()) + .put("externalPartyAuthHeaderName", externalPartyCounterpartConfig.getAuthHeaderName()) .put("externalPartyAuthHeaderValue", externalPartyCounterpartConfig.getAuthHeaderValue()); ArrayNode jsonAdditionalHeaders = OBJECT_MAPPER.createArrayNode(); @@ -225,9 +227,59 @@ private JsonNode _getSandboxConfig(String userId, JsonNode requestNode) { } jsonSandboxConfig.set("externalPartyAdditionalHeaders", jsonAdditionalHeaders); + ArrayNode jsonExternalPartyEndpointUriOverrides = OBJECT_MAPPER.createArrayNode(); + EndpointUriOverrideConfiguration[] endpointUriOverrideConfigurations = + externalPartyCounterpartConfig.getEndpointUriOverrideConfigurations(); + if (endpointUriOverrideConfigurations != null) { + Arrays.stream(endpointUriOverrideConfigurations) + .forEach( + endpointUriOverrideConfiguration -> + jsonExternalPartyEndpointUriOverrides.add( + OBJECT_MAPPER + .createObjectNode() + .put("method", endpointUriOverrideConfiguration.getMethod()) + .put( + "endpointBaseUri", + endpointUriOverrideConfiguration.getEndpointBaseUri()) + .put( + "endpointSuffix", + endpointUriOverrideConfiguration.getEndpointSuffix()) + .put( + "baseUriOverride", + endpointUriOverrideConfiguration.getBaseUriOverride()))); + } + jsonSandboxConfig.set( + "externalPartyEndpointUriOverrides", jsonExternalPartyEndpointUriOverrides); + + Map>> endpointUrisAndMethodsByRoleName = + SupportedStandard.forName(sandboxConfiguration.getStandard().getName()) + .standard + .getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() + .get(sandboxConfiguration.getScenarioSuite()); + jsonSandboxConfig.set( + "sandboxEndpointUriMethods", + _jsonSandboxEndpointUriMethods( + endpointUrisAndMethodsByRoleName.get(sandboxPartyCounterpartConfig.getRole()))); + jsonSandboxConfig.set( + "externalPartyEndpointUriMethods", + _jsonSandboxEndpointUriMethods( + endpointUrisAndMethodsByRoleName.get(externalPartyCounterpartConfig.getRole()))); + return jsonSandboxConfig; } + private static ArrayNode _jsonSandboxEndpointUriMethods(SortedMap> sandboxEndpointUriMethods) { + ArrayNode jsonSandboxEndpointUriMethods = OBJECT_MAPPER.createArrayNode(); + sandboxEndpointUriMethods.forEach( + (endpointUri, methods) -> { + ObjectNode jsonEndpointUriMethods = + OBJECT_MAPPER.createObjectNode().put("endpointUri", endpointUri); + jsonEndpointUriMethods.set("methods", JsonToolkit.stringCollectionToArrayNode(methods)); + jsonSandboxEndpointUriMethods.add(jsonEndpointUriMethods); + }); + return jsonSandboxEndpointUriMethods; + } + private JsonNode _getSandboxStatus(String userId, JsonNode requestNode) { String sandboxId = requestNode.get(SANDBOX_ID).asText(); accessChecker.checkUserSandboxAccess(userId, sandboxId); @@ -254,12 +306,12 @@ private JsonNode _updateSandboxConfig(String userId, JsonNode requestNode) { String externalPartyUrl = requestNode.get("externalPartyUrl").asText(); String sandboxPartyBaseUrl = Stream.of(sandboxConfiguration.getCounterparts()) - .filter( - counterpart -> + .filter( + counterpart -> counterpart.getName().equals(sandboxConfiguration.getParties()[0].getName())) - .findFirst() - .orElseThrow() - .getUrl() + .findFirst() + .orElseThrow() + .getUrl() .split("/party/")[0] + "/"; CounterpartConfiguration.validateUrl( externalPartyUrl, sandboxPartyBaseUrl.startsWith("http://localhost")); @@ -280,6 +332,24 @@ private JsonNode _updateSandboxConfig(String userId, JsonNode requestNode) { .toArray(HttpHeaderConfiguration[]::new)); } + JsonNode jsonExternalPartyEndpointUriOverrides = + requestNode.path("externalPartyEndpointUriOverrides"); + if (jsonExternalPartyEndpointUriOverrides.isArray()) { + externalPartyCounterpartConfig.setEndpointUriOverrideConfigurations( + StreamSupport.stream(jsonExternalPartyEndpointUriOverrides.spliterator(), false) + .map( + jsonEndpointUriOverride -> + new EndpointUriOverrideConfiguration( + jsonEndpointUriOverride.get("method").asText(), + jsonEndpointUriOverride.get("endpointBaseUri").asText(), + jsonEndpointUriOverride.get("endpointSuffix").asText(), + jsonEndpointUriOverride.get("baseUriOverride").asText())) + .toArray(EndpointUriOverrideConfiguration[]::new)); + } else { + externalPartyCounterpartConfig.setEndpointUriOverrideConfigurations( + new EndpointUriOverrideConfiguration[] {}); + } + if (!sandboxConfiguration.getOrchestrator().isActive()) { Arrays.stream(sandboxConfiguration.getParties()) .findFirst() diff --git a/sandbox/src/main/java/org/dcsa/conformance/sandbox/SupportedStandard.java b/sandbox/src/main/java/org/dcsa/conformance/sandbox/SupportedStandard.java new file mode 100644 index 00000000..3545175e --- /dev/null +++ b/sandbox/src/main/java/org/dcsa/conformance/sandbox/SupportedStandard.java @@ -0,0 +1,44 @@ +package org.dcsa.conformance.sandbox; + +import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.adoption.AdoptionStandard; +import org.dcsa.conformance.standards.booking.BookingStandard; +import org.dcsa.conformance.standards.cs.CsStandard; +import org.dcsa.conformance.standards.ebl.EblStandard; +import org.dcsa.conformance.standards.eblinterop.PintStandard; +import org.dcsa.conformance.standards.eblissuance.EblIssuanceStandard; +import org.dcsa.conformance.standards.eblsurrender.EblSurrenderStandard; +import org.dcsa.conformance.standards.jit.JitStandard; +import org.dcsa.conformance.standards.ovs.OvsStandard; +import org.dcsa.conformance.standards.tnt.TntStandard; + +import java.util.Arrays; + +public enum SupportedStandard { + ADOPTION(AdoptionStandard.INSTANCE), + BOOKING(BookingStandard.INSTANCE), + CS(CsStandard.INSTANCE), + EBL(EblStandard.INSTANCE), + EBL_ISSUANCE(EblIssuanceStandard.INSTANCE), + EBL_SURRENDER(EblSurrenderStandard.INSTANCE), + JIT(JitStandard.INSTANCE), + OVS(OvsStandard.INSTANCE), + PINT(PintStandard.INSTANCE), + TNT(TntStandard.INSTANCE); + + public final AbstractStandard standard; + + SupportedStandard(AbstractStandard standard) { + this.standard = standard; + } + + public static SupportedStandard forName(String standardName) { + return Arrays.stream(values()) + .filter(supportedStandard -> supportedStandard.standard.getName().equals(standardName)) + .findFirst() + .orElseThrow( + () -> + new IllegalArgumentException( + "Unsupported standard name %s".formatted(standardName))); + } +} diff --git a/spring-boot/src/test/java/org/dcsa/conformance/frontend/SeleniumTestBase.java b/spring-boot/src/test/java/org/dcsa/conformance/frontend/SeleniumTestBase.java index 11e04a6f..fbe17a62 100644 --- a/spring-boot/src/test/java/org/dcsa/conformance/frontend/SeleniumTestBase.java +++ b/spring-boot/src/test/java/org/dcsa/conformance/frontend/SeleniumTestBase.java @@ -333,6 +333,9 @@ SandboxConfig createSandBox(Standard standard, String version, String suiteName, null, null, null, + null, + null, + null, null); } diff --git a/spring-boot/src/test/java/org/dcsa/conformance/manual/ManualTestBase.java b/spring-boot/src/test/java/org/dcsa/conformance/manual/ManualTestBase.java index 3c2604e2..43cc6f59 100644 --- a/spring-boot/src/test/java/org/dcsa/conformance/manual/ManualTestBase.java +++ b/spring-boot/src/test/java/org/dcsa/conformance/manual/ManualTestBase.java @@ -14,6 +14,7 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import org.dcsa.conformance.core.party.EndpointUriOverrideConfiguration; import org.dcsa.conformance.core.party.HttpHeaderConfiguration; import org.dcsa.conformance.sandbox.ConformanceWebuiHandler; import org.dcsa.conformance.springboot.ConformanceApplication; @@ -460,16 +461,24 @@ record Sandbox( // Possible result of getAllSandboxes protected record SandboxItem(String id, String name, List operatorLog, boolean canNotifyParty) {} + public record EndpointUriMethod( + String endpointUri, + String[] methods + ) {} + public record SandboxConfig( - String sandboxId, - String sandboxName, - String sandboxUrl, - String sandboxAuthHeaderName, - String sandboxAuthHeaderValue, - String externalPartyUrl, - String externalPartyAuthHeaderName, - String externalPartyAuthHeaderValue, - HttpHeaderConfiguration[] externalPartyAdditionalHeaders) {} + String sandboxId, + String sandboxName, + String sandboxUrl, + String sandboxAuthHeaderName, + String sandboxAuthHeaderValue, + String externalPartyUrl, + String externalPartyAuthHeaderName, + String externalPartyAuthHeaderValue, + HttpHeaderConfiguration[] externalPartyAdditionalHeaders, + EndpointUriMethod[] sandboxEndpointUriMethods, + EndpointUriMethod[] externalPartyEndpointUriMethods, + EndpointUriOverrideConfiguration[] externalPartyEndpointUriOverrides) {} record ScenarioDigest(String moduleName, List scenarios) {} diff --git a/tnt/src/main/java/org/dcsa/conformance/standards/tnt/TntStandard.java b/tnt/src/main/java/org/dcsa/conformance/standards/tnt/TntStandard.java index 66b105d5..b18878b5 100644 --- a/tnt/src/main/java/org/dcsa/conformance/standards/tnt/TntStandard.java +++ b/tnt/src/main/java/org/dcsa/conformance/standards/tnt/TntStandard.java @@ -3,9 +3,11 @@ import java.util.*; import org.dcsa.conformance.core.AbstractComponentFactory; import org.dcsa.conformance.core.AbstractStandard; +import org.dcsa.conformance.standards.tnt.party.TntRole; public class TntStandard extends AbstractStandard { public static final TntStandard INSTANCE = new TntStandard(); + public static final String SCENARIO_SUITE_CONFORMANCE = "Conformance"; private TntStandard() { super("TnT"); @@ -14,8 +16,21 @@ private TntStandard() { @Override public SortedMap> getScenarioSuitesByStandardVersion() { return new TreeMap<>( - Map.ofEntries( - Map.entry("2.2.0", new TreeSet<>(Set.of("Conformance"))))); + Map.ofEntries(Map.entry("2.2.0", new TreeSet<>(Set.of(SCENARIO_SUITE_CONFORMANCE))))); + } + + @Override + public Map>>> + getEndpointUrisAndMethodsByScenarioSuiteAndRoleName() { + return Map.ofEntries( + Map.entry( + SCENARIO_SUITE_CONFORMANCE, + Map.ofEntries( + Map.entry( + TntRole.PUBLISHER.getConfigName(), + new TreeMap<>( + Map.ofEntries(Map.entry("/v2/events", new TreeSet<>(Set.of("GET")))))), + Map.entry(TntRole.SUBSCRIBER.getConfigName(), new TreeMap<>())))); } @Override diff --git a/webui/src/app/app.module.ts b/webui/src/app/app.module.ts index c775e0a1..a52acabe 100644 --- a/webui/src/app/app.module.ts +++ b/webui/src/app/app.module.ts @@ -4,6 +4,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; +import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatDialogModule } from '@angular/material/dialog'; import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; @@ -57,6 +58,7 @@ import {EditHeaderComponent} from "./pages/edit-header/edit-header.component"; HttpClientModule, MatButtonModule, MatCardModule, + MatCheckboxModule, MatDialogModule, MatIconModule, MatInputModule, diff --git a/webui/src/app/model/sandbox-config.ts b/webui/src/app/model/sandbox-config.ts index 025c18fb..7ad688e8 100644 --- a/webui/src/app/model/sandbox-config.ts +++ b/webui/src/app/model/sandbox-config.ts @@ -1,13 +1,28 @@ export interface SandboxConfig { - sandboxId: string, - sandboxName: string, - sandboxUrl: string, - sandboxAuthHeaderName: string, - sandboxAuthHeaderValue: string, - externalPartyUrl: string, - externalPartyAuthHeaderName: string, - externalPartyAuthHeaderValue: string, - externalPartyAdditionalHeaders: HeaderNameAndValue[] + sandboxId: string, + sandboxName: string, + sandboxUrl: string, + sandboxEndpointUriMethods: EndpointUriMethods[], + sandboxAuthHeaderName: string, + sandboxAuthHeaderValue: string, + externalPartyUrl: string, + externalPartyEndpointUriMethods: EndpointUriMethods[], + externalPartyEndpointUriOverrides: EndpointUriOverride[], + externalPartyAuthHeaderName: string, + externalPartyAuthHeaderValue: string, + externalPartyAdditionalHeaders: HeaderNameAndValue[] +} + +export interface EndpointUriMethods { + endpointUri: string, + methods: string[] +} + +export interface EndpointUriOverride { + method: string, + endpointBaseUri: string, + endpointSuffix: string, + baseUriOverride: string, } export interface HeaderNameAndValue { diff --git a/webui/src/app/pages/edit-sandbox/edit-sandbox.component.html b/webui/src/app/pages/edit-sandbox/edit-sandbox.component.html index dc3a830d..adc1d1a0 100644 --- a/webui/src/app/pages/edit-sandbox/edit-sandbox.component.html +++ b/webui/src/app/pages/edit-sandbox/edit-sandbox.component.html @@ -1,4 +1,4 @@ -
Sandbox settings
+
Sandbox settings
-
Connecting to the sandbox
-
Sandbox URL:
- - -
Request authentication header name:
- - -
Request authentication header value:
- - -
-
- -
Update sandbox settings
- -
-
-
- - Sandbox name - - + > + +
Sandbox name
+
+
+ + + +
+
+ + +
Connecting to the sandbox (read-only)
+
+ This type of sandbox has no endpoints to which your application can make API calls. +
+
+ Configure your application to make all API requests to these sandbox endpoint URLs: +
+
+
+
{{ method }} {{ endpointUriAndMethods.endpointUri }}
+ +
+
+
+ +
+ +
Authenticating to the sandbox (read-only)
+
+ This type of sandbox has no endpoints to which your application can make API calls. +
+
+ Configure your application to include this header when making API requests to the sandbox: +
+
Sandbox authentication header name:
+ +
Sandbox authentication header value:
+ +
+
+ + +
Connecting to your application
+
+ This type of sandbox does not make API calls to your application. +
+
+
+ Enter the base URL of all your application's endpoints to which the sandbox makes API calls:
-
-
- - Sandbox counterpart URL - - +
+ + Base URL for all your endpoints + +
-
-
- - Sandbox counterpart authentication header name + Use custom endpoint URIs +
+
+
The sandbox will make all API requests for each endpoint to these URLs:
+
+
+
+ {{ method }} {{ endpointUriAndMethods.endpointUri }} +
+ +
+
+
+
+
+ +
+ {{ endpointUriOverride.method }} + {{ endpointUriOverride.endpointBaseUri + endpointUriOverride.endpointSuffix }} +
+ + Custom URI to use instead of {{ endpointUriOverride.endpointBaseUri }} - + +
The sandbox will make all API requests for this endpoint to:
+ +
+
- +
+
+ +
+ +
Authenticating to your application
+
+ This type of sandbox does not make API calls to your application. +
+
Enter the header name and value to be included by the sandbox in all API requests that it makes to your application:
-
- - Sandbox counterpart authentication header value - - +
+ + Authentication header name + +
- -
Additional headers
-
-
+
Additional headers (if required by your application)
+
If your application requires more than one header in inbound API requests, enter any additional ones here:
+
+ + > + add + -   +   - - -
- -
-
+ > + remove +
-
-
-
- -   - +
+
+
-
- + +
+ +
+
+
+ +   + +
+
+
diff --git a/webui/src/app/pages/edit-sandbox/edit-sandbox.component.ts b/webui/src/app/pages/edit-sandbox/edit-sandbox.component.ts index 5da4311d..0d3dc4d4 100644 --- a/webui/src/app/pages/edit-sandbox/edit-sandbox.component.ts +++ b/webui/src/app/pages/edit-sandbox/edit-sandbox.component.ts @@ -4,8 +4,8 @@ import { ActivatedRoute, Router } from "@angular/router"; import { AuthService } from "../../auth/auth.service"; import { SandboxConfig } from "src/app/model/sandbox-config"; import { Subscription } from "rxjs"; -import {MessageDialog} from "../../dialogs/message/message-dialog.component"; -import {MatDialog} from "@angular/material/dialog"; +import { MessageDialog } from "../../dialogs/message/message-dialog.component"; +import { MatDialog } from "@angular/material/dialog"; @Component({ selector: 'app-edit-sandbox', @@ -49,6 +49,30 @@ export class EditSandboxComponent { } } + onUsingCustomEndpointUrisChange(enabled: boolean): void { + this.updatedSandboxConfig!.externalPartyEndpointUriOverrides = []; + if (enabled) { + for (let endpointUriMethod of this.updatedSandboxConfig!.externalPartyEndpointUriMethods) { + for (let method of endpointUriMethod.methods) { + const suffixStart = endpointUriMethod.endpointUri.indexOf("/{") + this.updatedSandboxConfig!.externalPartyEndpointUriOverrides.push( + suffixStart > 0 ? { + method, + endpointBaseUri: endpointUriMethod.endpointUri.substring(0, suffixStart), + endpointSuffix: endpointUriMethod.endpointUri.substring(suffixStart), + baseUriOverride: endpointUriMethod.endpointUri.substring(0, suffixStart), + } : { + method, + endpointBaseUri: endpointUriMethod.endpointUri, + endpointSuffix: "", + baseUriOverride: endpointUriMethod.endpointUri, + } + ); + } + } + } + } + onAddHeader() { this.updatedSandboxConfig?.externalPartyAdditionalHeaders.push({headerName: '', headerValue: ''}); } @@ -84,6 +108,7 @@ export class EditSandboxComponent { this.updatedSandboxConfig!.externalPartyAuthHeaderName, this.updatedSandboxConfig!.externalPartyAuthHeaderValue, this.updatedSandboxConfig!.externalPartyAdditionalHeaders, + this.updatedSandboxConfig!.externalPartyEndpointUriOverrides, ); if (response?.error) { await MessageDialog.open( diff --git a/webui/src/app/service/conformance.service.ts b/webui/src/app/service/conformance.service.ts index 2bf773fa..9deb0227 100644 --- a/webui/src/app/service/conformance.service.ts +++ b/webui/src/app/service/conformance.service.ts @@ -4,7 +4,7 @@ import {Sandbox} from "../model/sandbox"; import {ScenarioDigest} from "../model/scenario"; import {ScenarioStatus} from "../model/scenario-status"; import {Standard} from "../model/standard"; -import {HeaderNameAndValue, SandboxConfig} from "../model/sandbox-config"; +import {EndpointUriOverride, HeaderNameAndValue, SandboxConfig} from "../model/sandbox-config"; import {StandardModule} from "../model/standard-module"; import {SandboxStatus} from "../model/sandbox-status"; @@ -18,50 +18,44 @@ export class ConformanceService { } async getAvailableStandards(): Promise { - const standards: Standard[] = await this.apiService.call({ + return await this.apiService.call({ operation: "getAvailableStandards", }); - return standards; } async getAllSandboxes(): Promise { - const sandboxes: Sandbox[] = await this.apiService.call({ + return await this.apiService.call({ operation: "getAllSandboxes", }); - return sandboxes; } async getSandbox(sandboxId: string, includeOperatorLog: boolean): Promise { - const sandbox: Sandbox = await this.apiService.call({ + return await this.apiService.call({ operation: "getSandbox", sandboxId, includeOperatorLog, }); - return sandbox; } async getSandboxStatus(sandboxId: string): Promise { - const sandboxStatus: SandboxStatus = await this.apiService.call({ + return await this.apiService.call({ operation: "getSandboxStatus", sandboxId, }); - return sandboxStatus; } async notifyParty(sandboxId: string): Promise { - const sandbox: Sandbox = await this.apiService.call({ + return await this.apiService.call({ operation: "notifyParty", sandboxId, }); - return sandbox; } async resetParty(sandboxId: string): Promise { - const sandbox: Sandbox = await this.apiService.call({ + return await this.apiService.call({ operation: "resetParty", sandboxId, }); - return sandbox; } async getScenarioDigests(sandboxId: string): Promise { @@ -72,21 +66,19 @@ export class ConformanceService { } async getScenario(sandboxId: string, scenarioId: string): Promise { - const scenario: ScenarioDigest = await this.apiService.call({ + return await this.apiService.call({ operation: "getScenario", sandboxId, scenarioId, }); - return scenario; } async getScenarioStatus(sandboxId: string, scenarioId: string): Promise { - const scenarioStatus: ScenarioStatus = await this.apiService.call({ + return await this.apiService.call({ operation: "getScenarioStatus", sandboxId, scenarioId, }); - return scenarioStatus; } async handleActionInput(sandboxId: string, scenarioId: string, actionId: string, actionInput: any | string | undefined): Promise { @@ -135,11 +127,10 @@ export class ConformanceService { } async getSandboxConfig(sandboxId: string): Promise { - const sandboxConfig: SandboxConfig = await this.apiService.call({ + return await this.apiService.call({ operation: "getSandboxConfig", sandboxId }); - return sandboxConfig; } async updateSandboxConfig( @@ -149,6 +140,7 @@ export class ConformanceService { externalPartyAuthHeaderName: string, externalPartyAuthHeaderValue: string, externalPartyAdditionalHeaders: HeaderNameAndValue[], + externalPartyEndpointUriOverrides: EndpointUriOverride[], ): Promise { return await this.apiService.call({ operation: "updateSandboxConfig", @@ -158,6 +150,7 @@ export class ConformanceService { externalPartyAuthHeaderName, externalPartyAuthHeaderValue, externalPartyAdditionalHeaders, + externalPartyEndpointUriOverrides, }); } } diff --git a/webui/src/app/shared-styles.css b/webui/src/app/shared-styles.css index 9f790413..dc977f8b 100644 --- a/webui/src/app/shared-styles.css +++ b/webui/src/app/shared-styles.css @@ -5,6 +5,25 @@ white-space: nowrap; } +.configCard { + margin-top: 1em; + padding-left: 1em; + padding-right: 1em; + padding-bottom: 1em; +} + +.configPageSubtitle { + font-size: 1.1rem; + margin-top: 1em; + font-weight: bold; +} + +.configPageTitle { + font-size: 1.2rem; + margin-top: 1em; + font-weight: bold; +} + .conformanceStatus { width: 2em; }