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