Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / onap / so / bpmn / mock / StubResponsePolicy.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.bpmn.mock;
22
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;
28
29 /**
30  * Reusable Mock StubResponses for Policy
31  *
32  */
33 public class StubResponsePolicy {
34
35     public static void setupAllMocks() {
36
37     }
38
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")));
44
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")));
48
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")));
52
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")));
56
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")));
60
61
62
63     }
64
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")));
69
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")));
73
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")));
77
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")));
81
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")));
85
86
87     }
88
89
90 }