2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.so.bpmn.mock;
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.stubFor;
27 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
28 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
31 * Please describe the StubResponseSDNC.java class
33 public class StubResponseSDNCAdapter {
35 public static void setupAllMocks() {
39 public static void mockSDNCAdapter_500() {
40 stubFor(post(urlEqualTo("/SDNCAdapter"))
41 .willReturn(aResponse()
45 public static void mockSDNCAdapter_500(String requestContaining) {
46 stubFor(post(urlEqualTo("/SDNCAdapter"))
47 .withRequestBody(containing(requestContaining))
48 .willReturn(aResponse()
52 public static void mockSDNCAdapter(int statusCode) {
53 stubFor(post(urlMatching(".*/SDNCAdapter"))
54 .willReturn(aResponse()
55 .withStatus(statusCode)));
58 public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) {
59 stubFor(post(urlEqualTo(endpoint))
60 .willReturn(aResponse()
61 .withStatus(statusCode)
62 .withHeader("Content-Type", "text/xml")
63 .withBodyFile(responseFile)));
66 public static void mockSDNCAdapter(String responseFile) {
67 stubFor(post(urlEqualTo("/SDNCAdapter"))
68 .willReturn(aResponse()
70 .withHeader("Content-Type", "text/xml")
71 .withBodyFile(responseFile)));
74 public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) {
75 stubFor(post(urlEqualTo(endpoint))
76 .withRequestBody(containing(requestContaining))
77 .willReturn(aResponse()
78 .withStatus(statusCode)
79 .withHeader("Content-Type", "text/xml")
80 .withBodyFile(responseFile)));
83 public static void mockSDNCAdapterRest() {
84 stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
85 .willReturn(aResponse()
87 .withHeader("Content-Type", "application/json")));
90 public static void mockSDNCAdapterRest_500() {
91 stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
92 .willReturn(aResponse()
94 .withHeader("Content-Type", "application/json")));
97 public static void mockSDNCAdapterRest(String requestContaining) {
98 stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
99 .withRequestBody(containing(requestContaining))
100 .willReturn(aResponse()
102 .withHeader("Content-Type", "application/json")));
105 public static void mockSDNCAdapterRest_500(String requestContaining) {
106 stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
107 .withRequestBody(containing(requestContaining))
108 .willReturn(aResponse()
110 .withHeader("Content-Type", "application/json")));