2 * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
5 * ============LICENSE_START=======================================================
7 * ================================================================================
8 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
9 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=========================================================
24 package org.openecomp.mso.bpmn.mock;
26 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
27 import static com.github.tomakehurst.wiremock.client.WireMock.post;
28 import static com.github.tomakehurst.wiremock.client.WireMock.get;
29 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
30 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
33 * Stub response class for Database stubs
34 * including database adapter, catalog db,
35 * and other databases.
37 public class StubResponseDatabase {
39 public static void setupAllMocks() {
43 public static void mockUpdateRequestDB(int statusCode, String reponseFile) {
44 stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
45 .willReturn(aResponse()
46 .withStatus(statusCode)
47 .withHeader("Content-Type", "text/xml")
48 .withBodyFile(reponseFile)));
51 public static void MockGetAllottedResourcesByModelInvariantId(String modelInvariantId, String responseFile){
52 stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
53 .willReturn(aResponse()
55 .withHeader("Content-Type", "application/json")
56 .withBodyFile(responseFile)));
59 public static void MockGetAllottedResourcesByModelInvariantId_500(String modelInvariantId, String responseFile){
60 stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
61 .willReturn(aResponse()