Merge "Reorder modifiers"
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / openecomp / mso / bpmn / mock / StubResponseSDNCAdapter.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.post;
24 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
25 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
26
27 /**
28  * Please describe the StubResponseSDNC.java class
29  */
30 public class StubResponseSDNCAdapter {
31
32         public static void setupAllMocks() {
33
34         }
35
36         public static void mockSDNCAdapter_500() {
37                 stubFor(post(urlEqualTo("/SDNCAdapter"))
38                                 .willReturn(aResponse()
39                                                 .withStatus(500)));
40         }               
41         
42         public static void mockSDNCAdapter_500(String requestContaining) {
43                 stubFor(post(urlEqualTo("/SDNCAdapter"))
44                   .withRequestBody(containing(requestContaining))
45                   .willReturn(aResponse()
46                   .withStatus(500)));
47         }               
48         
49         public static void mockSDNCAdapter(int statusCode) {
50                 stubFor(post(urlEqualTo("/SDNCAdapter"))
51                                 .willReturn(aResponse()
52                                                 .withStatus(statusCode)));
53         }
54         
55         public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) {
56                 stubFor(post(urlEqualTo(endpoint))      
57                                   .willReturn(aResponse()
58                                   .withStatus(statusCode)
59                                   .withHeader("Content-Type", "text/xml")
60                                   .withBodyFile(responseFile)));
61         }
62
63         public static void mockSDNCAdapter(String responseFile) {
64                 stubFor(post(urlEqualTo("/SDNCAdapter"))
65                                   .willReturn(aResponse()
66                                   .withStatus(200)
67                                   .withHeader("Content-Type", "text/xml")
68                                   .withBodyFile(responseFile)));
69         }
70         
71         public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) {
72                 stubFor(post(urlEqualTo(endpoint))
73                                 .withRequestBody(containing(requestContaining))
74                                 .willReturn(aResponse()
75                                         .withStatus(statusCode)
76                                         .withHeader("Content-Type", "text/xml")
77                                         .withBodyFile(responseFile)));
78         }
79
80         public static void mockSDNCAdapterSimulator(String responseFile) {
81                 MockResource mockResource = new MockResource();
82                 mockResource.updateProperties("sdnc_delay", "300");
83                 stubFor(post(urlEqualTo("/SDNCAdapter"))
84                                 .willReturn(aResponse()
85                                                 .withStatus(200)
86                                                 .withHeader("Content-Type", "application/soap+xml")
87                                                 .withTransformers("sdnc-adapter-transformer")
88                                                 .withBodyFile(responseFile)));
89         }
90
91         public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) {
92                 MockResource mockResource = new MockResource();
93                 mockResource.updateProperties("sdnc_delay", "300");
94                 stubFor(post(urlEqualTo("/SDNCAdapter"))
95                                 .withRequestBody(containing(requestContaining))
96                                 .willReturn(aResponse()
97                                                 .withStatus(200)
98                                                 .withHeader("Content-Type", "application/soap+xml")
99                                                 .withTransformers("sdnc-adapter-transformer")
100                                                 .withBodyFile(responseFile)));
101         }
102
103         public static void mockSDNCAdapterRest() {
104                 stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
105                                 .willReturn(aResponse()
106                                                 .withStatus(202)
107                                                 .withHeader("Content-Type", "application/json")));
108         }
109
110         public static void mockSDNCAdapterRest_500() {
111                 stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
112                                 .willReturn(aResponse()
113                                                 .withStatus(500)
114                                                 .withHeader("Content-Type", "application/json")));
115         }
116
117         public static void mockSDNCAdapterRest(String requestContaining) {
118                 stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
119                                 .withRequestBody(containing(requestContaining))
120                                 .willReturn(aResponse()
121                                                 .withStatus(202)
122                                                 .withHeader("Content-Type", "application/json")));
123         }
124
125         public static void mockSDNCAdapterRest_500(String requestContaining) {
126                 stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
127                                 .withRequestBody(containing(requestContaining))
128                                 .willReturn(aResponse()
129                                                 .withStatus(500)
130                                                 .withHeader("Content-Type", "application/json")));
131         }
132
133         public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) {
134                 MockResource mockResource = new MockResource();
135                 mockResource.updateProperties("sdnc_delay", "300");             
136                 stubFor(post(urlEqualTo("/SDNCAdapter"))
137                                 .withRequestBody(containing(requestContaining))
138                                 .willReturn(aResponse()
139                                                 .withStatus(200)
140                                                 .withHeader("Content-Type", "text/xml")
141                                                 .withTransformers("network-topology-operation-transformer")
142                                                 .withBodyFile(responseFile)));
143         }
144
145         
146 }