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.delete;
26 import static com.github.tomakehurst.wiremock.client.WireMock.get;
27 import static com.github.tomakehurst.wiremock.client.WireMock.post;
28 import static com.github.tomakehurst.wiremock.client.WireMock.patch;
29 import static com.github.tomakehurst.wiremock.client.WireMock.put;
30 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
31 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
32 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
35 * Reusable Mock StubResponses for Policy
38 public class StubResponsePolicy {
40 public static void setupAllMocks() {
44 // start of Policy mocks
45 public static void MockPolicyAbort() {
46 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
47 .withRequestBody(containing("BB1"))
48 .willReturn(aResponse()
50 .withHeader("Content-Type", "application/json")
51 .withBodyFile("policyAbortResponse.json")));
53 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
54 .withRequestBody(containing("UPDVnfI"))
55 .willReturn(aResponse()
57 .withHeader("Content-Type", "application/json")
58 .withBodyFile("policyAbortResponse.json")));
60 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
61 .withRequestBody(containing("RPLVnfI"))
62 .willReturn(aResponse()
64 .withHeader("Content-Type", "application/json")
65 .withBodyFile("policyAbortResponse.json")));
67 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
68 .withRequestBody(containing("VnfIPU"))
69 .willReturn(aResponse()
71 .withHeader("Content-Type", "application/json")
72 .withBodyFile("policyAbortResponse.json")));
74 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
75 .withRequestBody(containing("VnfCU"))
76 .willReturn(aResponse()
78 .withHeader("Content-Type", "application/json")
79 .withBodyFile("policyAbortResponse.json")));
85 public static void MockPolicySkip() {
86 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
87 .withRequestBody(containing("BB1"))
88 .willReturn(aResponse()
90 .withHeader("Content-Type", "application/json")
91 .withBodyFile("Policy/policySkipResponse.json")));
93 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
94 .withRequestBody(containing("UPDVnfI"))
95 .willReturn(aResponse()
97 .withHeader("Content-Type", "application/json")
98 .withBodyFile("Policy/policySkipResponse.json")));
100 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
101 .withRequestBody(containing("RPLVnfI"))
102 .willReturn(aResponse()
104 .withHeader("Content-Type", "application/json")
105 .withBodyFile("Policy/policySkipResponse.json")));
107 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
108 .withRequestBody(containing("VnfIPU"))
109 .willReturn(aResponse()
111 .withHeader("Content-Type", "application/json")
112 .withBodyFile("Policy/policySkipResponse.json")));
114 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
115 .withRequestBody(containing("VnfCU"))
116 .willReturn(aResponse()
118 .withHeader("Content-Type", "application/json")
119 .withBodyFile("Policy/policySkipResponse.json")));