Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / onap / so / bpmn / mock / StubResponseSDNCAdapter.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 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
28 import com.github.tomakehurst.wiremock.WireMockServer;
29
30 /**
31  * Please describe the StubResponseSDNC.java class
32  */
33 public class StubResponseSDNCAdapter {
34
35     public static void setupAllMocks() {
36
37     }
38
39     public static void mockSDNCAdapter_500(WireMockServer wireMockServer) {
40         wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")).willReturn(aResponse().withStatus(500)));
41     }
42
43     public static void mockSDNCAdapter_500(WireMockServer wireMockServer, String requestContaining) {
44         wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")).withRequestBody(containing(requestContaining))
45                 .willReturn(aResponse().withStatus(500)));
46     }
47
48     public static void mockSDNCAdapter(WireMockServer wireMockServer, int statusCode) {
49         wireMockServer.stubFor(post(urlMatching(".*/SDNCAdapter")).willReturn(aResponse().withStatus(statusCode)));
50     }
51
52     public static void mockSDNCAdapter(WireMockServer wireMockServer, String endpoint, int statusCode,
53             String responseFile) {
54         wireMockServer.stubFor(post(urlEqualTo(endpoint)).willReturn(
55                 aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
56     }
57
58     public static void mockSDNCAdapter(WireMockServer wireMockServer, String responseFile) {
59         wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")).willReturn(
60                 aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
61     }
62
63     public static void mockSDNCAdapter(WireMockServer wireMockServer, String endpoint, String requestContaining,
64             int statusCode, String responseFile) {
65         wireMockServer.stubFor(post(urlEqualTo(endpoint)).withRequestBody(containing(requestContaining)).willReturn(
66                 aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
67     }
68
69     public static void mockSDNCAdapterRest(WireMockServer wireMockServer) {
70         wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
71                 .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
72     }
73
74     public static void mockSDNCAdapterRest_500(WireMockServer wireMockServer) {
75         wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
76                 .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "application/json")));
77     }
78
79     public static void mockSDNCAdapterRest(WireMockServer wireMockServer, String requestContaining) {
80         wireMockServer.stubFor(
81                 post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")).withRequestBody(containing(requestContaining))
82                         .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
83     }
84
85     public static void mockSDNCAdapterRest_500(WireMockServer wireMockServer, String requestContaining) {
86         wireMockServer.stubFor(
87                 post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")).withRequestBody(containing(requestContaining))
88                         .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "application/json")));
89     }
90
91 }