aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-simulators/src
diff options
context:
space:
mode:
authoruj426b <uj426b@att.com>2020-07-16 14:52:57 -0400
committeruj426b <uj426b@att.com>2020-07-17 15:05:09 -0400
commitc2dbe84efeaf0f0db266a4c23380b209d93651d5 (patch)
tree8a9e1e481a116873094a2d78cd731a903a8474d1 /models-interactions/model-simulators/src
parentc6012167b9692eb38bcb479f233543e93c51c998 (diff)
Support vDNS RainyDay test Case.
Modifying simulator to handle failure sent from Policy Json. Change-Id: I52a9f8da4ad06b535262f202418868f79fea4510 Issue-ID: POLICY-2432 Signed-off-by: uj426b <uj426b@att.com>
Diffstat (limited to 'models-interactions/model-simulators/src')
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java15
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());
}