summaryrefslogtreecommitdiffstats
path: root/controlloop/common/simulators
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/simulators')
-rw-r--r--controlloop/common/simulators/pom.xml1
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java38
2 files changed, 28 insertions, 11 deletions
diff --git a/controlloop/common/simulators/pom.xml b/controlloop/common/simulators/pom.xml
index c256d13ac..1c613eaba 100644
--- a/controlloop/common/simulators/pom.xml
+++ b/controlloop/common/simulators/pom.xml
@@ -51,7 +51,6 @@
<groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
<artifactId>so</artifactId>
<version>${project.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
index 1547fd41f..9b623a646 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
@@ -20,6 +20,8 @@
package org.onap.policy.simulators;
+import java.util.UUID;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -27,10 +29,17 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import org.onap.policy.so.SORequest;
+import org.onap.policy.so.SORequestReferences;
+import org.onap.policy.so.SORequestStatus;
+import org.onap.policy.so.SOResponse;
+
+import com.att.aft.dme2.internal.gson.Gson;
+
@Path("/serviceInstances")
public class SoSimulatorJaxRs {
-
- /**
+
+ /**
* SO post query.
*
* @param serviceInstanceId the service instance Id
@@ -41,14 +50,23 @@ public class SoSimulatorJaxRs {
@Path("/v5/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
@Consumes(MediaType.APPLICATION_JSON)
@Produces("application/json")
- public String soPostQuery(@PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("vnfInstanceId") String vnfInstanceId) {
-
- // the requestID contained in the SO Response is a newly generated requestID
- // with no relation to the requestID in Policy controlLoopEvent
- return "{\"requestReferences\": {\"instanceId\": \"ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff\", \"requestId\": \""
- + "rq1234d1-5a33-ffdf-23ab-12abad84e331\" }}";
+ public String soPostQuery(@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId)
+ {
+ SORequest request = new SORequest();
+ SORequestStatus requestStatus = new SORequestStatus();
+ requestStatus.setRequestState("COMPLETE");
+ request.setRequestStatus(requestStatus);
+ request.setRequestId(UUID.randomUUID());
+
+ SOResponse response = new SOResponse();
+
+ SORequestReferences requestReferences = new SORequestReferences();
+ String requestId = UUID.randomUUID().toString();
+ requestReferences.setRequestId(requestId);
+ response.setRequestReferences(requestReferences);
+
+ response.setRequest(request);
+ return new Gson().toJson(response);
}
-
}