replace all fixed wiremock ports
[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
28 import com.github.tomakehurst.wiremock.WireMockServer;
29
30 /**
31  * Reusable Mock StubResponses for Policy
32  *
33  */
34 public class StubResponsePolicy {
35
36         public static void setupAllMocks() {
37
38         }
39
40         // start of Policy mocks
41         public static void MockPolicyAbort(WireMockServer wireMockServer) {             
42                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
43                         .withRequestBody(containing("BB1"))
44                         .willReturn(aResponse()
45                                 .withStatus(200)
46                                 .withHeader("Content-Type", "application/json")
47                                 .withBodyFile("policyAbortResponse.json")));
48                 
49                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
50                                 .withRequestBody(containing("UPDVnfI"))
51                                 .willReturn(aResponse()
52                                         .withStatus(200)
53                                         .withHeader("Content-Type", "application/json")
54                                         .withBodyFile("policyAbortResponse.json")));
55                 
56                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
57                                 .withRequestBody(containing("RPLVnfI"))
58                                 .willReturn(aResponse()
59                                         .withStatus(200)
60                                         .withHeader("Content-Type", "application/json")
61                                         .withBodyFile("policyAbortResponse.json")));
62                 
63                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
64                                 .withRequestBody(containing("VnfIPU"))
65                                 .willReturn(aResponse()
66                                         .withStatus(200)
67                                         .withHeader("Content-Type", "application/json")
68                                         .withBodyFile("policyAbortResponse.json")));
69                 
70                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
71                                 .withRequestBody(containing("VnfCU"))
72                                 .willReturn(aResponse()
73                                         .withStatus(200)
74                                         .withHeader("Content-Type", "application/json")
75                                         .withBodyFile("policyAbortResponse.json")));
76
77
78
79         }
80         
81         public static void MockPolicySkip(WireMockServer wireMockServer) {              
82                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
83                         .withRequestBody(containing("BB1"))
84                         .willReturn(aResponse()
85                                 .withStatus(200)
86                                 .withHeader("Content-Type", "application/json")
87                                 .withBodyFile("Policy/policySkipResponse.json")));
88                 
89                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
90                                 .withRequestBody(containing("UPDVnfI"))
91                                 .willReturn(aResponse()
92                                         .withStatus(200)
93                                         .withHeader("Content-Type", "application/json")
94                                         .withBodyFile("Policy/policySkipResponse.json")));
95                 
96                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
97                                 .withRequestBody(containing("RPLVnfI"))
98                                 .willReturn(aResponse()
99                                         .withStatus(200)
100                                         .withHeader("Content-Type", "application/json")
101                                         .withBodyFile("Policy/policySkipResponse.json")));
102                 
103                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
104                                 .withRequestBody(containing("VnfIPU"))
105                                 .willReturn(aResponse()
106                                         .withStatus(200)
107                                         .withHeader("Content-Type", "application/json")
108                                         .withBodyFile("Policy/policySkipResponse.json")));
109                 
110                 wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
111                                 .withRequestBody(containing("VnfCU"))
112                                 .willReturn(aResponse()
113                                         .withStatus(200)
114                                         .withHeader("Content-Type", "application/json")
115                                         .withBodyFile("Policy/policySkipResponse.json")));
116
117
118         }
119         
120         
121 }