2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.mock;
23 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
24 import static com.github.tomakehurst.wiremock.client.WireMock.containing;
25 import static com.github.tomakehurst.wiremock.client.WireMock.post;
26 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
28 import com.github.tomakehurst.wiremock.WireMockServer;
31 * Reusable Mock StubResponses for Policy
34 public class StubResponsePolicy {
36 public static void setupAllMocks() {
40 // start of Policy mocks
41 public static void MockPolicyAbort(WireMockServer wireMockServer) {
42 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
43 .withRequestBody(containing("BB1"))
44 .willReturn(aResponse()
46 .withHeader("Content-Type", "application/json")
47 .withBodyFile("policyAbortResponse.json")));
49 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
50 .withRequestBody(containing("UPDVnfI"))
51 .willReturn(aResponse()
53 .withHeader("Content-Type", "application/json")
54 .withBodyFile("policyAbortResponse.json")));
56 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
57 .withRequestBody(containing("RPLVnfI"))
58 .willReturn(aResponse()
60 .withHeader("Content-Type", "application/json")
61 .withBodyFile("policyAbortResponse.json")));
63 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
64 .withRequestBody(containing("VnfIPU"))
65 .willReturn(aResponse()
67 .withHeader("Content-Type", "application/json")
68 .withBodyFile("policyAbortResponse.json")));
70 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
71 .withRequestBody(containing("VnfCU"))
72 .willReturn(aResponse()
74 .withHeader("Content-Type", "application/json")
75 .withBodyFile("policyAbortResponse.json")));
81 public static void MockPolicySkip(WireMockServer wireMockServer) {
82 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
83 .withRequestBody(containing("BB1"))
84 .willReturn(aResponse()
86 .withHeader("Content-Type", "application/json")
87 .withBodyFile("Policy/policySkipResponse.json")));
89 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
90 .withRequestBody(containing("UPDVnfI"))
91 .willReturn(aResponse()
93 .withHeader("Content-Type", "application/json")
94 .withBodyFile("Policy/policySkipResponse.json")));
96 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
97 .withRequestBody(containing("RPLVnfI"))
98 .willReturn(aResponse()
100 .withHeader("Content-Type", "application/json")
101 .withBodyFile("Policy/policySkipResponse.json")));
103 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
104 .withRequestBody(containing("VnfIPU"))
105 .willReturn(aResponse()
107 .withHeader("Content-Type", "application/json")
108 .withBodyFile("Policy/policySkipResponse.json")));
110 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
111 .withRequestBody(containing("VnfCU"))
112 .willReturn(aResponse()
114 .withHeader("Content-Type", "application/json")
115 .withBodyFile("Policy/policySkipResponse.json")));