diff options
-rw-r--r-- | models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java index 019d6f116..2e6f46b26 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java @@ -21,6 +21,9 @@ package org.onap.policy.simulators; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -34,13 +37,12 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import lombok.Setter; import org.onap.policy.common.utils.resources.ResourceUtils; - +import org.onap.policy.so.SoRequest; @Path("/") public class SoSimulatorJaxRs { private static final String REPLACE_ME = "${replaceMe}"; - /** * Set of incomplete request IDs. When a POST or DELETE is performed, the new request * ID is added to the set. When the request is polled, the ID is removed and a "still @@ -71,8 +73,15 @@ public class SoSimulatorJaxRs { @Consumes(MediaType.APPLICATION_JSON) @Produces("application/json") public String soPostQuery(@PathParam("serviceInstanceId") final String serviceInstanceId, - @PathParam("vnfInstanceId") final String vnfInstanceId) { + @PathParam("vnfInstanceId") final String vnfInstanceId, + @ApiParam(required = true) SoRequest request) { + List<Map<String, String>> userParam = null; + userParam = request.getRequestDetails().getRequestParameters().getUserParams(); + if (!userParam.isEmpty() && userParam.toString().contains("FAIL")) { + // this will be treated as a failure by the SO actor as it's missing the request ID + return "{}"; + } return (requirePolling ? makeStarted() : makeImmediateComplete()); } |