fdaede1b39d793bcad1a55fb4db6f0e9543188a5
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / openecomp / mso / bpmn / mock / StubResponsePolicy.java
1 /*
2  * ============LICENSE_START======================================================= 
3  * ONAP - SO 
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 
8  * 
9  *      http://www.apache.org/licenses/LICENSE-2.0 
10  * 
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========================================================= 
17  */ 
18
19 package org.openecomp.mso.bpmn.mock;
20
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;
31
32 /**
33  * Reusable Mock StubResponses for Policy
34  *
35  */
36 public class StubResponsePolicy {
37
38         public static void setupAllMocks() {
39
40         }
41
42         // start of Policy mocks
43         public static void MockPolicyAbort() {          
44                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
45                         .withRequestBody(containing("BB1"))
46                         .willReturn(aResponse()
47                                 .withStatus(200)
48                                 .withHeader("Content-Type", "application/json")
49                                 .withBodyFile("policyAbortResponse.json")));
50                 
51                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
52                                 .withRequestBody(containing("UPDVnfI"))
53                                 .willReturn(aResponse()
54                                         .withStatus(200)
55                                         .withHeader("Content-Type", "application/json")
56                                         .withBodyFile("policyAbortResponse.json")));
57                 
58                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
59                                 .withRequestBody(containing("RPLVnfI"))
60                                 .willReturn(aResponse()
61                                         .withStatus(200)
62                                         .withHeader("Content-Type", "application/json")
63                                         .withBodyFile("policyAbortResponse.json")));
64
65
66         }
67         
68         public static void MockPolicySkip() {           
69                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
70                         .withRequestBody(containing("BB1"))
71                         .willReturn(aResponse()
72                                 .withStatus(200)
73                                 .withHeader("Content-Type", "application/json")
74                                 .withBodyFile("Policy/policySkipResponse.json")));
75                 
76                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
77                                 .withRequestBody(containing("UPDVnfI"))
78                                 .willReturn(aResponse()
79                                         .withStatus(200)
80                                         .withHeader("Content-Type", "application/json")
81                                         .withBodyFile("Policy/policySkipResponse.json")));
82                 
83                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))
84                                 .withRequestBody(containing("RPLVnfI"))
85                                 .willReturn(aResponse()
86                                         .withStatus(200)
87                                         .withHeader("Content-Type", "application/json")
88                                         .withBodyFile("Policy/policySkipResponse.json")));
89
90
91         }
92         
93         
94 }