7093b649d486ce3764c408417f1f823ee48750c1
[so.git] / bpmn / MSOMockServer / src / main / java / org / openecomp / mso / bpmn / mock / StubResponsePolicy.java
1 /*\r
2  * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.\r
3  */\r
4 /*- \r
5  * ============LICENSE_START======================================================= \r
6  * OPENECOMP - MSO \r
7  * ================================================================================ \r
8  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. \r
9  * ================================================================================ \r
10  * Licensed under the Apache License, Version 2.0 (the "License"); \r
11  * you may not use this file except in compliance with the License. \r
12  * You may obtain a copy of the License at \r
13  * \r
14  *      http://www.apache.org/licenses/LICENSE-2.0 \r
15  * \r
16  * Unless required by applicable law or agreed to in writing, software \r
17  * distributed under the License is distributed on an "AS IS" BASIS, \r
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \r
19  * See the License for the specific language governing permissions and \r
20  * limitations under the License. \r
21  * ============LICENSE_END========================================================= \r
22  */ \r
23 \r
24 package org.openecomp.mso.bpmn.mock;\r
25 \r
26 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;\r
27 import static com.github.tomakehurst.wiremock.client.WireMock.containing;\r
28 import static com.github.tomakehurst.wiremock.client.WireMock.delete;\r
29 import static com.github.tomakehurst.wiremock.client.WireMock.get;\r
30 import static com.github.tomakehurst.wiremock.client.WireMock.post;\r
31 import static com.github.tomakehurst.wiremock.client.WireMock.patch;\r
32 import static com.github.tomakehurst.wiremock.client.WireMock.put;\r
33 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;\r
34 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;\r
35 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;\r
36 \r
37 /**\r
38  * Reusable Mock StubResponses for Policy\r
39  *\r
40  */\r
41 public class StubResponsePolicy {\r
42 \r
43         public static void setupAllMocks() {\r
44 \r
45         }\r
46 \r
47         // start of Policy mocks\r
48         public static void MockPolicyAbort() {          \r
49                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
50                         .withRequestBody(containing("BB1"))\r
51                         .willReturn(aResponse()\r
52                                 .withStatus(200)\r
53                                 .withHeader("Content-Type", "application/json")\r
54                                 .withBodyFile("policyAbortResponse.json")));\r
55                 \r
56                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
57                                 .withRequestBody(containing("UPDVnfI"))\r
58                                 .willReturn(aResponse()\r
59                                         .withStatus(200)\r
60                                         .withHeader("Content-Type", "application/json")\r
61                                         .withBodyFile("policyAbortResponse.json")));\r
62                 \r
63                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
64                                 .withRequestBody(containing("RPLVnfI"))\r
65                                 .willReturn(aResponse()\r
66                                         .withStatus(200)\r
67                                         .withHeader("Content-Type", "application/json")\r
68                                         .withBodyFile("policyAbortResponse.json")));\r
69 \r
70 \r
71         }\r
72         \r
73         public static void MockPolicySkip() {           \r
74                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
75                         .withRequestBody(containing("BB1"))\r
76                         .willReturn(aResponse()\r
77                                 .withStatus(200)\r
78                                 .withHeader("Content-Type", "application/json")\r
79                                 .withBodyFile("Policy/policySkipResponse.json")));\r
80                 \r
81                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
82                                 .withRequestBody(containing("UPDVnfI"))\r
83                                 .willReturn(aResponse()\r
84                                         .withStatus(200)\r
85                                         .withHeader("Content-Type", "application/json")\r
86                                         .withBodyFile("Policy/policySkipResponse.json")));\r
87                 \r
88                 stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
89                                 .withRequestBody(containing("RPLVnfI"))\r
90                                 .willReturn(aResponse()\r
91                                         .withStatus(200)\r
92                                         .withHeader("Content-Type", "application/json")\r
93                                         .withBodyFile("Policy/policySkipResponse.json")));\r
94 \r
95 \r
96         }\r
97         \r
98         \r
99 }\r