2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.testsuites.integration.uservice.taskparameters;
23 import javax.ws.rs.GET;
24 import javax.ws.rs.POST;
25 import javax.ws.rs.Path;
26 import javax.ws.rs.PathParam;
27 import javax.ws.rs.core.Response;
30 * The Class RestClientEndpointForTaskParameters.
33 public class RestClientEndpointForTaskParameters {
35 private static String closedLoopId;
36 private static String serviceId;
39 * Get event that triggers policy for testing TaskParameters.
41 * @return the response
43 @Path("/event/GetEvent")
45 public Response getEvent() {
46 return Response.status(200).entity("{\"event\": \"CLTriggerEvent\"}").build();
50 * Fetch information of service using serviceId.
52 * @param servicId the service id
54 * @return the response
56 @Path("/service/getInfoForServiceId/{servicId}")
58 public Response getInfoForServiceId(@PathParam("servicId") String servicId) {
60 return Response.status(200)
61 .entity("{\"name\": \"ServiceInfoEvent\", \"serviceDetails\": \"serviceDetailsFullBody\"}").build();
65 * Closed loop action using closedLoopId.
67 * @param closedLpId the closedLoopId
69 * @return the response
71 @Path("/action/doActionForCL/{closedLpId}")
73 public Response doActionForCL(@PathParam("closedLpId") String closedLpId) {
74 closedLoopId = closedLpId;
75 return Response.status(200).entity("{\"name\": \"CLOutputEvent\", \"status\": \"ClosedLoop Success\"}").build();
79 * Get details that are set as part of the policy execution.
81 * @return the response
83 @Path("/event/getDetails")
85 public Response getDetails() {
86 if (null == serviceId || null == closedLoopId) {
87 return Response.status(500).entity("Error: Flow incomplete").build();
89 return Response.status(200).entity("{\"closedLoopId\": " + closedLoopId + ",\"serviceId\": " + serviceId + "}")
94 * Clear details that are set as part of the policy execution.
96 * @return the response
98 @Path("/event/clearDetails")
100 public Response clearDetails() {
103 return Response.status(200).entity("Details cleared.").build();