From c2dbe84efeaf0f0db266a4c23380b209d93651d5 Mon Sep 17 00:00:00 2001 From: uj426b Date: Thu, 16 Jul 2020 14:52:57 -0400 Subject: [PATCH] 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 --- .../java/org/onap/policy/simulators/SoSimulatorJaxRs.java | 15 ++++++++++++--- 1 file 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> 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()); } -- 2.16.6