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;
27 import com.github.tomakehurst.wiremock.WireMockServer;
30 * Reusable Mock StubResponses for Policy
33 public class StubResponsePolicy {
35 public static void setupAllMocks() {
39 // start of Policy mocks
40 public static void MockPolicyAbort(WireMockServer wireMockServer) {
41 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("BB1"))
42 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
43 .withBodyFile("policyAbortResponse.json")));
45 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("UPDVnfI"))
46 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
47 .withBodyFile("policyAbortResponse.json")));
49 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("RPLVnfI"))
50 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
51 .withBodyFile("policyAbortResponse.json")));
53 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("VnfIPU"))
54 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
55 .withBodyFile("policyAbortResponse.json")));
57 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("VnfCU"))
58 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
59 .withBodyFile("policyAbortResponse.json")));
65 public static void MockPolicySkip(WireMockServer wireMockServer) {
66 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("BB1"))
67 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
68 .withBodyFile("Policy/policySkipResponse.json")));
70 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("UPDVnfI"))
71 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
72 .withBodyFile("Policy/policySkipResponse.json")));
74 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("RPLVnfI"))
75 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
76 .withBodyFile("Policy/policySkipResponse.json")));
78 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("VnfIPU"))
79 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
80 .withBodyFile("Policy/policySkipResponse.json")));
82 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("VnfCU"))
83 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
84 .withBodyFile("Policy/policySkipResponse.json")));