+ /**
+ * Poll SO result.
+ *
+ * @param requestId the ID of the request whose status is to be queried
+ * @return the response
+ */
+ @GET
+ @Path("/orchestrationRequests/v5/{requestId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String soGetQuery(@PathParam("requestId") final String requestId) {
+ if (incomplete.remove(requestId)) {
+ // first poll - return "still running"
+ return makeStillRunning(requestId);
+
+ } else {
+ return makeComplete(requestId);
+ }
+ }
+
+ @PUT
+ @Path("/3gppservices/v7/modify")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String soPost3gpp(SoRequest3gpp request) {
+ return ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.3gpp.success.json");
+ }
+
+ @PUT
+ @Path("/infra/serviceIntent/v1/modify")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String soPostModifyCll(SoRequest3gpp request) {
+ return ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.cll.success.json");
+ }
+
+ private String makeStarted() {
+ var requestId = UUID.randomUUID().toString();
+
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.started.json");
+
+ incomplete.add(requestId);
+
+ return response.replace(REPLACE_ME, requestId);
+ }
+
+ private String makeImmediateComplete() {
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.immediate.success.json");
+ return response.replace(REPLACE_ME, UUID.randomUUID().toString());
+ }
+
+ private String makeComplete(String requestId) {
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.complete.success.json");
+ return response.replace(REPLACE_ME, requestId);
+ }