4deaccd938f3413d2860a792da0766f9ebc4e299
[so.git] /
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.apihandlerinfra;
22
23 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
24 import static com.github.tomakehurst.wiremock.client.WireMock.any;
25 import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
26 import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
27 import static com.github.tomakehurst.wiremock.client.WireMock.get;
28 import static com.github.tomakehurst.wiremock.client.WireMock.post;
29 import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
30 import static com.shazam.shazamcrest.MatcherAssert.assertThat;
31 import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
32 import static org.junit.Assert.assertEquals;
33 import static org.junit.Assert.assertNotNull;
34 import java.io.File;
35 import java.io.IOException;
36 import java.nio.file.Files;
37 import java.nio.file.Paths;
38 import java.util.ArrayList;
39 import java.util.HashMap;
40 import java.util.List;
41 import java.util.Map;
42 import javax.ws.rs.core.MediaType;
43 import javax.ws.rs.core.Response;
44 import org.apache.http.HttpStatus;
45 import org.junit.Test;
46 import org.onap.so.apihandler.common.ErrorNumbers;
47 import org.onap.so.db.request.beans.InfraActiveRequests;
48 import org.onap.so.db.request.client.RequestsDbClient;
49 import org.onap.so.exceptions.ValidationException;
50 import org.onap.so.serviceinstancebeans.CloudRequestData;
51 import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
52 import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
53 import org.onap.so.serviceinstancebeans.Request;
54 import org.onap.so.serviceinstancebeans.RequestError;
55 import org.onap.so.serviceinstancebeans.RequestProcessingData;
56 import org.onap.so.serviceinstancebeans.ServiceException;
57 import org.springframework.beans.factory.annotation.Autowired;
58 import org.springframework.http.HttpEntity;
59 import org.springframework.http.HttpHeaders;
60 import org.springframework.http.HttpMethod;
61 import org.springframework.http.ResponseEntity;
62 import org.springframework.web.util.UriComponentsBuilder;
63 import com.fasterxml.jackson.core.JsonParseException;
64 import com.fasterxml.jackson.core.type.TypeReference;
65 import com.fasterxml.jackson.databind.DeserializationFeature;
66 import com.fasterxml.jackson.databind.JsonMappingException;
67 import com.fasterxml.jackson.databind.ObjectMapper;
68
69 public class OrchestrationRequestsTest extends BaseTest {
70     @Autowired
71     private RequestsDbClient requestsDbClient;
72
73     @Autowired
74     private OrchestrationRequests orchReq;
75
76     private static final GetOrchestrationListResponse ORCHESTRATION_LIST = generateOrchestrationList();
77     private static final String INVALID_REQUEST_ID = "invalid-request-id";
78
79     private static GetOrchestrationListResponse generateOrchestrationList() {
80         GetOrchestrationListResponse list = null;
81         try {
82             ObjectMapper mapper = new ObjectMapper();
83             list = mapper.readValue(new File("src/test/resources/OrchestrationRequest/OrchestrationList.json"),
84                     GetOrchestrationListResponse.class);
85         } catch (JsonParseException jpe) {
86             jpe.printStackTrace();
87         } catch (JsonMappingException jme) {
88             jme.printStackTrace();
89         } catch (IOException ioe) {
90             ioe.printStackTrace();
91         }
92         return list;
93     }
94
95     @Test
96     public void testGetOrchestrationRequest() throws Exception {
97         setupTestGetOrchestrationRequest();
98         // TEST VALID REQUEST
99         GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
100
101         Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
102         testResponse.setRequest(request);
103         String testRequestId = request.getRequestId();
104         HttpHeaders headers = new HttpHeaders();
105         headers.set("Accept", MediaType.APPLICATION_JSON);
106         headers.set("Content-Type", MediaType.APPLICATION_JSON);
107         HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
108
109         UriComponentsBuilder builder = UriComponentsBuilder
110                 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
111
112         ResponseEntity<GetOrchestrationResponse> response =
113                 restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
114
115         assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
116         assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime")
117                 .ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp"));
118         assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
119         assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
120         assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
121         assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
122         assertEquals("00032ab7-na18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
123         assertNotNull(response.getBody().getRequest().getFinishTime());
124     }
125
126     @Test
127     public void testGetOrchestrationRequestInstanceGroup() throws Exception {
128         setupTestGetOrchestrationRequestInstanceGroup();
129         // TEST VALID REQUEST
130         GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
131
132         Request request = ORCHESTRATION_LIST.getRequestList().get(8).getRequest();
133         testResponse.setRequest(request);
134         String testRequestId = request.getRequestId();
135         HttpHeaders headers = new HttpHeaders();
136         headers.set("Accept", MediaType.APPLICATION_JSON);
137         headers.set("Content-Type", MediaType.APPLICATION_JSON);
138         HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
139
140         UriComponentsBuilder builder = UriComponentsBuilder
141                 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
142
143         ResponseEntity<GetOrchestrationResponse> response =
144                 restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
145
146         assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
147         assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime")
148                 .ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp"));
149     }
150
151     @Test
152     public void testGetOrchestrationRequestWithOpenstackDetails() throws Exception {
153         setupTestGetOrchestrationRequestOpenstackDetails("00032ab7-3fb3-42e5-965d-8ea592502017", "COMPLETED");
154         // Test request with modelInfo request body
155         GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
156
157         Request request = ORCHESTRATION_LIST.getRequestList().get(0).getRequest();
158         List<CloudRequestData> cloudRequestData = new ArrayList<>();
159         CloudRequestData cloudData = new CloudRequestData();
160         cloudData.setCloudIdentifier("heatstackName/123123");
161         ObjectMapper mapper = new ObjectMapper();
162         Object reqData = mapper.readValue(
163                 "{\r\n  \"test\": \"00032ab7-3fb3-42e5-965d-8ea592502016\",\r\n  \"test2\": \"deleteInstance\",\r\n  \"test3\": \"COMPLETE\",\r\n  \"test4\": \"Vf Module has been deleted successfully.\",\r\n  \"test5\": 100\r\n}",
164                 Object.class);
165         cloudData.setCloudRequest(reqData);
166         cloudRequestData.add(cloudData);
167         request.setCloudRequestData(cloudRequestData);
168         testResponse.setRequest(request);
169         String testRequestId = request.getRequestId();
170
171         HttpHeaders headers = new HttpHeaders();
172         headers.set("Accept", MediaType.APPLICATION_JSON);
173         headers.set("Content-Type", MediaType.APPLICATION_JSON);
174         HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
175
176         UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(
177                 "/onap/so/infra/orchestrationRequests/v7/" + testRequestId + "?includeCloudRequest=true"));
178
179         ResponseEntity<GetOrchestrationResponse> response =
180                 restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
181         System.out.println("Response :" + response.getBody().toString());
182         assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
183
184         assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime")
185                 .ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp"));
186         assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
187         assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
188         assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
189         assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
190         assertEquals("00032ab7-3fb3-42e5-965d-8ea592502017", response.getHeaders().get("X-TransactionID").get(0));
191     }
192
193     @Test
194     public void testGetOrchestrationRequestNoRequestID() {
195         HttpHeaders headers = new HttpHeaders();
196         headers.set("Accept", "application/json; charset=UTF-8");
197         headers.set("Content-Type", "application/json; charset=UTF-8");
198         HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
199         UriComponentsBuilder builder =
200                 UriComponentsBuilder.fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v6/"));
201
202         ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(),
203                 HttpMethod.GET, entity, GetOrchestrationListResponse.class);
204         assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
205     }
206
207     @Test
208     public void testGetOrchestrationRequestFilter() throws Exception {
209         setupTestGetOrchestrationRequestFilter();
210         List<String> values = new ArrayList<>();
211         values.add("EQUALS");
212         values.add("vfModule");
213
214         ObjectMapper mapper = new ObjectMapper();
215         GetOrchestrationListResponse testResponse =
216                 mapper.readValue(new File("src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json"),
217                         GetOrchestrationListResponse.class);
218
219         Map<String, List<String>> orchestrationMap = new HashMap<>();
220         orchestrationMap.put("modelType", values);
221         List<GetOrchestrationResponse> testResponses = new ArrayList<>();
222
223         List<InfraActiveRequests> requests = requestsDbClient.getOrchestrationFiltersFromInfraActive(orchestrationMap);
224         HttpHeaders headers = new HttpHeaders();
225         headers.set("Accept", MediaType.APPLICATION_JSON);
226         HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
227
228         UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(
229                 createURLWithPort("/onap/so/infra/orchestrationRequests/v6?filter=modelType:EQUALS:vfModule"));
230
231         ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(),
232                 HttpMethod.GET, entity, GetOrchestrationListResponse.class);
233         assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("requestList.request.startTime")
234                 .ignoring("requestList.request.finishTime").ignoring("requestList.request.requestStatus.timeStamp"));
235         assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
236         assertEquals(requests.size(), response.getBody().getRequestList().size());
237
238     }
239
240     @Test
241     public void testUnlockOrchestrationRequest() throws Exception {
242         setupTestUnlockOrchestrationRequest("0017f68c-eb2d-45bb-b7c7-ec31b37dc349", "UNLOCKED");
243         ObjectMapper mapper = new ObjectMapper();
244         mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
245         String requestJSON =
246                 new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
247         HttpHeaders headers = new HttpHeaders();
248         headers.set("Accept", MediaType.APPLICATION_JSON);
249         headers.set("Content-Type", MediaType.APPLICATION_JSON);
250         HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
251
252         UriComponentsBuilder builder;
253         ResponseEntity<String> response;
254         RequestError expectedRequestError;
255         RequestError actualRequestError;
256         ServiceException se;
257
258         // Test invalid JSON
259         expectedRequestError = new RequestError();
260         se = new ServiceException();
261         se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
262         se.setText(
263                 "Orchestration RequestId 0017f68c-eb2d-45bb-b7c7-ec31b37dc349 has a status of UNLOCKED and can not be unlocked");
264         expectedRequestError.setServiceException(se);
265
266         builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(
267                 "/onap/so/infra/orchestrationRequests/v6/0017f68c-eb2d-45bb-b7c7-ec31b37dc349/unlock"));
268
269         response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
270         actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
271
272         assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
273         assertThat(actualRequestError, sameBeanAs(expectedRequestError));
274     }
275
276     @Test
277     public void testUnlockOrchestrationRequest_invalid_Json() throws Exception {
278         setupTestUnlockOrchestrationRequest_invalid_Json();
279         ObjectMapper mapper = new ObjectMapper();
280         mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
281         String requestJSON =
282                 new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
283         HttpHeaders headers = new HttpHeaders();
284         headers.set("Accept", MediaType.APPLICATION_JSON);
285         headers.set("Content-Type", MediaType.APPLICATION_JSON);
286         HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
287
288         UriComponentsBuilder builder;
289         ResponseEntity<String> response;
290         RequestError expectedRequestError;
291         RequestError actualRequestError;
292         ServiceException se;
293
294         // Test invalid requestId
295         expectedRequestError = new RequestError();
296         se = new ServiceException();
297         se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
298         se.setText("Null response from RequestDB when searching by RequestId");
299         expectedRequestError.setServiceException(se);
300
301         builder = UriComponentsBuilder.fromHttpUrl(
302                 createURLWithPort("/onap/so/infra/orchestrationRequests/v6/" + INVALID_REQUEST_ID + "/unlock"));
303
304         response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
305         actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
306
307         assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
308         assertThat(actualRequestError, sameBeanAs(expectedRequestError));
309     }
310
311     @Test
312     public void testUnlockOrchestrationRequest_Valid_Status()
313             throws JsonParseException, JsonMappingException, IOException, ValidationException {
314         setupTestUnlockOrchestrationRequest_Valid_Status("5ffbabd6-b793-4377-a1ab-082670fbc7ac", "PENDING");
315         ObjectMapper mapper = new ObjectMapper();
316         String requestJSON =
317                 new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
318         HttpHeaders headers = new HttpHeaders();
319         headers.set("Accept", MediaType.APPLICATION_JSON);
320         headers.set("Content-Type", MediaType.APPLICATION_JSON);
321         HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
322
323         UriComponentsBuilder builder;
324         ResponseEntity<String> response;
325         Request request;
326
327         // Test valid status
328         request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
329         builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(
330                 "/onap/so/infra/orchestrationRequests/v7/" + "5ffbabd6-b793-4377-a1ab-082670fbc7ac" + "/unlock"));
331
332         response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
333         // Cannot assert anything further here, already have a wiremock in place
334         // which ensures that the post was
335         // properly called to update.
336     }
337
338     @Test
339     public void mapRequestProcessingDataTest() throws JsonParseException, JsonMappingException, IOException {
340         RequestProcessingData entry = new RequestProcessingData();
341         RequestProcessingData secondEntry = new RequestProcessingData();
342         List<HashMap<String, String>> expectedList = new ArrayList<>();
343         HashMap<String, String> expectedMap = new HashMap<>();
344         List<HashMap<String, String>> secondExpectedList = new ArrayList<>();
345         HashMap<String, String> secondExpectedMap = new HashMap<>();
346         List<RequestProcessingData> expectedDataList = new ArrayList<>();
347         entry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
348         entry.setTag("pincFabricConfigRequest");
349         expectedMap.put("requestAction", "assign");
350         expectedMap.put("pincFabricId", "testId");
351         expectedList.add(expectedMap);
352         entry.setDataPairs(expectedList);
353         secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
354         secondEntry.setTag("pincFabricConfig");
355         secondExpectedMap.put("requestAction", "unassign");
356         secondExpectedList.add(secondExpectedMap);
357         secondEntry.setDataPairs(secondExpectedList);
358         expectedDataList.add(entry);
359         expectedDataList.add(secondEntry);
360
361         List<org.onap.so.db.request.beans.RequestProcessingData> processingData = new ArrayList<>();
362         List<RequestProcessingData> actualProcessingData = new ArrayList<>();
363         ObjectMapper mapper = new ObjectMapper();
364         processingData =
365                 mapper.readValue(new File("src/test/resources/OrchestrationRequest/RequestProcessingData.json"),
366                         new TypeReference<List<org.onap.so.db.request.beans.RequestProcessingData>>() {});
367         actualProcessingData = orchReq.mapRequestProcessingData(processingData);
368         assertThat(actualProcessingData, sameBeanAs(expectedDataList));
369     }
370
371     public void setupTestGetOrchestrationRequest() throws Exception {
372         // For testGetOrchestrationRequest
373         wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018"))
374                 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
375                         .withBody(new String(Files.readAllBytes(
376                                 Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequest.json"))))
377                         .withStatus(HttpStatus.SC_OK)));
378         wireMockServer
379                 .stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
380                         .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
381                         .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
382                                 .withBody(new String(Files.readAllBytes(Paths
383                                         .get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
384                                 .withStatus(HttpStatus.SC_OK)));
385     }
386
387     public void setupTestGetOrchestrationRequestInstanceGroup() throws Exception {
388         // For testGetOrchestrationRequest
389         wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018"))
390                 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
391                         .withBody(new String(Files.readAllBytes(Paths.get(
392                                 "src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json"))))
393                         .withStatus(HttpStatus.SC_OK)));
394         wireMockServer
395                 .stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
396                         .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
397                         .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
398                                 .withBody(new String(Files.readAllBytes(Paths
399                                         .get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
400                                 .withStatus(HttpStatus.SC_OK)));
401     }
402
403     private void setupTestGetOrchestrationRequestRequestDetails(String requestId, String status) throws Exception {
404         wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse()
405                 .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
406                 .withBody(new String(Files.readAllBytes(
407                         Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestDetails.json"))))
408                 .withStatus(HttpStatus.SC_OK)));
409     }
410
411     private void setupTestGetOrchestrationRequestOpenstackDetails(String requestId, String status) throws Exception {
412         wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse()
413                 .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
414                 .withBody(new String(Files.readAllBytes(Paths
415                         .get("src/test/resources/OrchestrationRequest/getOrchestrationOpenstackRequestDetails.json"))))
416                 .withStatus(HttpStatus.SC_OK)));
417     }
418
419     private void setupTestUnlockOrchestrationRequest(String requestId, String status) {
420         wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId)))
421                 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
422                         .withBody(String.format(getResponseTemplate, requestId, status)).withStatus(HttpStatus.SC_OK)));
423     }
424
425     private void setupTestUnlockOrchestrationRequest_invalid_Json() {
426         wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(INVALID_REQUEST_ID))).willReturn(aResponse()
427                 .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_NOT_FOUND)));
428
429     }
430
431     private void setupTestUnlockOrchestrationRequest_Valid_Status(String requestID, String status) {
432         wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestID)))
433                 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
434                         .withBody(String.format(getResponseTemplate, requestID, status)).withStatus(HttpStatus.SC_OK)));
435
436         wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl("")))
437                 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
438                         .withBody(String.format(infraActivePost, requestID)).withStatus(HttpStatus.SC_OK)));
439     }
440
441     private void setupTestGetOrchestrationRequestFilter() throws Exception {
442         // for testGetOrchestrationRequestFilter();
443         wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/getOrchestrationFiltersFromInfraActive/"))
444                 .withRequestBody(equalToJson("{\"modelType\":[\"EQUALS\",\"vfModule\"]}"))
445                 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
446                         .withBody(new String(Files.readAllBytes(
447                                 Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json"))))
448                         .withStatus(HttpStatus.SC_OK)));
449     }
450 }