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")));
68 public static void MockPolicySkip() {
69 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
70 .withRequestBody(containing("BB1"))
71 .willReturn(aResponse()
73 .withHeader("Content-Type", "application/json")
74 .withBodyFile("Policy/policySkipResponse.json")));
76 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
77 .withRequestBody(containing("UPDVnfI"))
78 .willReturn(aResponse()
80 .withHeader("Content-Type", "application/json")
81 .withBodyFile("Policy/policySkipResponse.json")));
83 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
84 .withRequestBody(containing("RPLVnfI"))
85 .willReturn(aResponse()
87 .withHeader("Content-Type", "application/json")
88 .withBodyFile("Policy/policySkipResponse.json")));