2 * ============LICENSE_START=======================================================
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.
16 * ============LICENSE_END=========================================================
19 package org.openecomp.mso.bpmn.mock;
21 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
22 import static com.github.tomakehurst.wiremock.client.WireMock.containing;
23 import static com.github.tomakehurst.wiremock.client.WireMock.delete;
24 import static com.github.tomakehurst.wiremock.client.WireMock.get;
25 import static com.github.tomakehurst.wiremock.client.WireMock.post;
26 import static com.github.tomakehurst.wiremock.client.WireMock.patch;
27 import static com.github.tomakehurst.wiremock.client.WireMock.put;
28 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
29 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
30 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
33 * Reusable Mock StubResponses for Policy
36 public class StubResponsePolicy {
38 public static void setupAllMocks() {
42 // start of Policy mocks
43 public static void MockPolicyAbort() {
44 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
45 .withRequestBody(containing("BB1"))
46 .willReturn(aResponse()
48 .withHeader("Content-Type", "application/json")
49 .withBodyFile("policyAbortResponse.json")));
51 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
52 .withRequestBody(containing("UPDVnfI"))
53 .willReturn(aResponse()
55 .withHeader("Content-Type", "application/json")
56 .withBodyFile("policyAbortResponse.json")));
58 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
59 .withRequestBody(containing("RPLVnfI"))
60 .willReturn(aResponse()
62 .withHeader("Content-Type", "application/json")
63 .withBodyFile("policyAbortResponse.json")));
65 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
66 .withRequestBody(containing("VnfIPU"))
67 .willReturn(aResponse()
69 .withHeader("Content-Type", "application/json")
70 .withBodyFile("policyAbortResponse.json")));
72 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
73 .withRequestBody(containing("VnfCU"))
74 .willReturn(aResponse()
76 .withHeader("Content-Type", "application/json")
77 .withBodyFile("policyAbortResponse.json")));
83 public static void MockPolicySkip() {
84 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
85 .withRequestBody(containing("BB1"))
86 .willReturn(aResponse()
88 .withHeader("Content-Type", "application/json")
89 .withBodyFile("Policy/policySkipResponse.json")));
91 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
92 .withRequestBody(containing("UPDVnfI"))
93 .willReturn(aResponse()
95 .withHeader("Content-Type", "application/json")
96 .withBodyFile("Policy/policySkipResponse.json")));
98 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
99 .withRequestBody(containing("RPLVnfI"))
100 .willReturn(aResponse()
102 .withHeader("Content-Type", "application/json")
103 .withBodyFile("Policy/policySkipResponse.json")));
105 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
106 .withRequestBody(containing("VnfIPU"))
107 .willReturn(aResponse()
109 .withHeader("Content-Type", "application/json")
110 .withBodyFile("Policy/policySkipResponse.json")));
112 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
113 .withRequestBody(containing("VnfCU"))
114 .willReturn(aResponse()
116 .withHeader("Content-Type", "application/json")
117 .withBodyFile("Policy/policySkipResponse.json")));