diff options
author | Ritu Sood <ritu.sood@intel.com> | 2017-09-18 03:01:54 -0700 |
---|---|---|
committer | Ritu Sood <ritu.sood@intel.com> | 2017-09-18 03:25:16 -0700 |
commit | c71f6e474049623ea7daaf42e585e143210b4c07 (patch) | |
tree | c4ee59adee467b1a45e06467a0517fcebcda538d /controlloop/common/simulators/src/main | |
parent | 5a2b4712b2e1d598950260087101be6fcf59f234 (diff) |
Fixing VFC simulator for junit tests
Added response type to post and removed
response id as it is unused.
Breaking up from the junit patch for ease of
review.
Issue-id: POLICY-212
Change-Id: I0c6b0c02b240cfe81246587184fe6a589dcc2367
Signed-off-by: Ritu Sood <ritu.sood@intel.com>
Diffstat (limited to 'controlloop/common/simulators/src/main')
-rw-r--r-- | controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java index 51a85ce60..cd894825c 100644 --- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java +++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java @@ -24,21 +24,30 @@ import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.Context; @Path("/api/nslcm/v1") public class VfcSimulatorJaxRs { @POST @Path("/ns/{nsInstanceId}/heal") - public String vfcPostQuery(@PathParam("nsInstanceId") String nsInstanceId) + public String vfcPostQuery(@PathParam("nsInstanceId") String nsInstanceId, + @Context final HttpServletResponse response) { + response.setStatus(HttpServletResponse.SC_ACCEPTED); + try { + response.flushBuffer(); + }catch(Exception e){} + return "{\"jobId\":\"1\"}"; } @GET - @Path("/jobs/{jobId}&responseId={responseId}") - public String vfcGetQuery(@PathParam("jobId") String jobId, @PathParam("responseId") String responseId){ - return "{\"jobId\" : "+jobId+",\"responseDescriptor\" : {\"progress\" : \"40\",\"status\" : \"proccessing\",\"statusDescription\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\": "+responseId+",\"responseHistoryList\": [{\"progress\" : \"40\",\"status\" : \"proccessing\",\"statusDescription\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"1\"}, {\"progress\" : \"41\",\"status\" : \"proccessing\",\"statusDescription\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"2\"}]}}"; + @Path("/jobs/{jobId}") + public String vfcGetQuery(@PathParam("jobId") String jobId) { + return "{\"jobId\" : "+jobId+",\"responseDescriptor\" : {\"progress\" : \"40\",\"status\" : \"finished\",\"statusDescription\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\": 101 ,\"responseHistoryList\": [{\"progress\" : \"40\",\"status\" : \"proccessing\",\"statusDescription\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"1\"}, {\"progress\" : \"41\",\"status\" : \"proccessing\",\"statusDescription\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"2\"}]}}"; } } + |