[MSO-8] Update the maven dependency
[so.git] / bpmn / MSOMockServer / src / main / java / org / openecomp / mso / bpmn / mock / StubResponseDatabase.java
1 /*
2  * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
3  */
4 /*- 
5  * ============LICENSE_START======================================================= 
6  * OPENECOMP - MSO 
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 
13  * 
14  *      http://www.apache.org/licenses/LICENSE-2.0 
15  * 
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========================================================= 
22  */ 
23
24 package org.openecomp.mso.bpmn.mock;
25
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;
31
32 /**
33  * Stub response class for Database stubs
34  * including database adapter, catalog db,
35  * and other databases.
36  */
37 public class StubResponseDatabase {
38
39         public static void setupAllMocks() {
40
41         }
42
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)));
49         }
50
51         public static void MockGetAllottedResourcesByModelInvariantId(String modelInvariantId, String responseFile){
52                 stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
53                                 .willReturn(aResponse()
54                                 .withStatus(200)
55                             .withHeader("Content-Type", "application/json")
56                                 .withBodyFile(responseFile)));
57         }
58
59         public static void MockGetAllottedResourcesByModelInvariantId_500(String modelInvariantId, String responseFile){
60                 stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
61                                 .willReturn(aResponse()
62                                 .withStatus(500)));
63         }
64
65 }