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.apihandlerinfra;
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;
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;
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;
69 public class OrchestrationRequestsTest extends BaseTest {
71 private RequestsDbClient requestsDbClient;
74 private OrchestrationRequests orchReq;
76 private static final GetOrchestrationListResponse ORCHESTRATION_LIST = generateOrchestrationList();
77 private static final String INVALID_REQUEST_ID = "invalid-request-id";
79 private static GetOrchestrationListResponse generateOrchestrationList() {
80 GetOrchestrationListResponse list = null;
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();
96 public void testGetOrchestrationRequest() throws Exception {
97 setupTestGetOrchestrationRequest();
99 GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
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);
109 UriComponentsBuilder builder = UriComponentsBuilder
110 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
112 ResponseEntity<GetOrchestrationResponse> response =
113 restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
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-1a18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
123 assertNotNull(response.getBody().getRequest().getFinishTime());
127 public void testGetOrchestrationRequestInstanceGroup() throws Exception {
128 setupTestGetOrchestrationRequestInstanceGroup();
129 // TEST VALID REQUEST
130 GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
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);
140 UriComponentsBuilder builder = UriComponentsBuilder
141 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
143 ResponseEntity<GetOrchestrationResponse> response =
144 restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
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"));
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();
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}",
165 cloudData.setCloudRequest(reqData);
166 cloudRequestData.add(cloudData);
167 request.setCloudRequestData(cloudRequestData);
168 testResponse.setRequest(request);
169 String testRequestId = request.getRequestId();
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);
176 UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(
177 "/onap/so/infra/orchestrationRequests/v7/" + testRequestId + "?includeCloudRequest=true"));
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());
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));
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/"));
202 ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(),
203 HttpMethod.GET, entity, GetOrchestrationListResponse.class);
204 assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
208 public void testGetOrchestrationRequestInvalidRequestID() throws Exception {
209 setupTestGetOrchestrationRequest();
210 // TEST INVALID REQUESTID
211 GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
213 Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
214 testResponse.setRequest(request);
215 String testRequestId = "00032ab7-pfb3-42e5-965d-8ea592502016";
216 HttpHeaders headers = new HttpHeaders();
217 headers.set("Accept", MediaType.APPLICATION_JSON);
218 headers.set("Content-Type", MediaType.APPLICATION_JSON);
219 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
221 UriComponentsBuilder builder = UriComponentsBuilder
222 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
224 ResponseEntity<GetOrchestrationResponse> response =
225 restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
227 assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
231 public void testGetOrchestrationRequestFilter() throws Exception {
232 setupTestGetOrchestrationRequestFilter();
233 List<String> values = new ArrayList<>();
234 values.add("EQUALS");
235 values.add("vfModule");
237 ObjectMapper mapper = new ObjectMapper();
238 GetOrchestrationListResponse testResponse =
239 mapper.readValue(new File("src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json"),
240 GetOrchestrationListResponse.class);
242 Map<String, List<String>> orchestrationMap = new HashMap<>();
243 orchestrationMap.put("modelType", values);
244 List<GetOrchestrationResponse> testResponses = new ArrayList<>();
246 List<InfraActiveRequests> requests = requestsDbClient.getOrchestrationFiltersFromInfraActive(orchestrationMap);
247 HttpHeaders headers = new HttpHeaders();
248 headers.set("Accept", MediaType.APPLICATION_JSON);
249 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
251 UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(
252 createURLWithPort("/onap/so/infra/orchestrationRequests/v6?filter=modelType:EQUALS:vfModule"));
254 ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(),
255 HttpMethod.GET, entity, GetOrchestrationListResponse.class);
256 assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("requestList.request.startTime")
257 .ignoring("requestList.request.finishTime").ignoring("requestList.request.requestStatus.timeStamp"));
258 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
259 assertEquals(requests.size(), response.getBody().getRequestList().size());
264 public void testUnlockOrchestrationRequest() throws Exception {
265 setupTestUnlockOrchestrationRequest("0017f68c-eb2d-45bb-b7c7-ec31b37dc349", "UNLOCKED");
266 ObjectMapper mapper = new ObjectMapper();
267 mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
269 new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
270 HttpHeaders headers = new HttpHeaders();
271 headers.set("Accept", MediaType.APPLICATION_JSON);
272 headers.set("Content-Type", MediaType.APPLICATION_JSON);
273 HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
275 UriComponentsBuilder builder;
276 ResponseEntity<String> response;
277 RequestError expectedRequestError;
278 RequestError actualRequestError;
282 expectedRequestError = new RequestError();
283 se = new ServiceException();
284 se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
286 "Orchestration RequestId 0017f68c-eb2d-45bb-b7c7-ec31b37dc349 has a status of UNLOCKED and can not be unlocked");
287 expectedRequestError.setServiceException(se);
289 builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(
290 "/onap/so/infra/orchestrationRequests/v6/0017f68c-eb2d-45bb-b7c7-ec31b37dc349/unlock"));
292 response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
293 actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
295 assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
296 assertThat(actualRequestError, sameBeanAs(expectedRequestError));
300 public void testUnlockOrchestrationRequest_invalid_Json() throws Exception {
301 setupTestUnlockOrchestrationRequest_invalid_Json();
302 ObjectMapper mapper = new ObjectMapper();
303 mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
305 new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
306 HttpHeaders headers = new HttpHeaders();
307 headers.set("Accept", MediaType.APPLICATION_JSON);
308 headers.set("Content-Type", MediaType.APPLICATION_JSON);
309 HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
311 UriComponentsBuilder builder;
312 ResponseEntity<String> response;
313 RequestError expectedRequestError;
314 RequestError actualRequestError;
317 // Test invalid requestId
318 expectedRequestError = new RequestError();
319 se = new ServiceException();
320 se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
321 se.setText("Null response from RequestDB when searching by RequestId");
322 expectedRequestError.setServiceException(se);
324 builder = UriComponentsBuilder.fromHttpUrl(
325 createURLWithPort("/onap/so/infra/orchestrationRequests/v6/" + INVALID_REQUEST_ID + "/unlock"));
327 response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
328 actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
330 assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
331 assertThat(actualRequestError, sameBeanAs(expectedRequestError));
335 public void testUnlockOrchestrationRequest_Valid_Status()
336 throws JsonParseException, JsonMappingException, IOException, ValidationException {
337 setupTestUnlockOrchestrationRequest_Valid_Status("5ffbabd6-b793-4377-a1ab-082670fbc7ac", "PENDING");
338 ObjectMapper mapper = new ObjectMapper();
340 new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
341 HttpHeaders headers = new HttpHeaders();
342 headers.set("Accept", MediaType.APPLICATION_JSON);
343 headers.set("Content-Type", MediaType.APPLICATION_JSON);
344 HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
346 UriComponentsBuilder builder;
347 ResponseEntity<String> response;
351 request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
352 builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(
353 "/onap/so/infra/orchestrationRequests/v7/" + "5ffbabd6-b793-4377-a1ab-082670fbc7ac" + "/unlock"));
355 response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
356 // Cannot assert anything further here, already have a wiremock in place
357 // which ensures that the post was
358 // properly called to update.
362 public void mapRequestProcessingDataTest() throws JsonParseException, JsonMappingException, IOException {
363 RequestProcessingData entry = new RequestProcessingData();
364 RequestProcessingData secondEntry = new RequestProcessingData();
365 List<HashMap<String, String>> expectedList = new ArrayList<>();
366 HashMap<String, String> expectedMap = new HashMap<>();
367 List<HashMap<String, String>> secondExpectedList = new ArrayList<>();
368 HashMap<String, String> secondExpectedMap = new HashMap<>();
369 List<RequestProcessingData> expectedDataList = new ArrayList<>();
370 entry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
371 entry.setTag("pincFabricConfigRequest");
372 expectedMap.put("requestAction", "assign");
373 expectedMap.put("pincFabricId", "testId");
374 expectedList.add(expectedMap);
375 entry.setDataPairs(expectedList);
376 secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
377 secondEntry.setTag("pincFabricConfig");
378 secondExpectedMap.put("requestAction", "unassign");
379 secondExpectedList.add(secondExpectedMap);
380 secondEntry.setDataPairs(secondExpectedList);
381 expectedDataList.add(entry);
382 expectedDataList.add(secondEntry);
384 List<org.onap.so.db.request.beans.RequestProcessingData> processingData = new ArrayList<>();
385 List<RequestProcessingData> actualProcessingData = new ArrayList<>();
386 ObjectMapper mapper = new ObjectMapper();
388 mapper.readValue(new File("src/test/resources/OrchestrationRequest/RequestProcessingData.json"),
389 new TypeReference<List<org.onap.so.db.request.beans.RequestProcessingData>>() {});
390 actualProcessingData = orchReq.mapRequestProcessingData(processingData);
391 assertThat(actualProcessingData, sameBeanAs(expectedDataList));
394 public void setupTestGetOrchestrationRequest() throws Exception {
395 // For testGetOrchestrationRequest
396 wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-1a18-42e5-965d-8ea592502018"))
397 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
398 .withBody(new String(Files.readAllBytes(
399 Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequest.json"))))
400 .withStatus(HttpStatus.SC_OK)));
402 .stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
403 .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-1a18-42e5-965d-8ea592502018"))
404 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
405 .withBody(new String(Files.readAllBytes(Paths
406 .get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
407 .withStatus(HttpStatus.SC_OK)));
410 public void setupTestGetOrchestrationRequestInstanceGroup() throws Exception {
411 // For testGetOrchestrationRequest
412 wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-1a18-42e5-965d-8ea592502018"))
413 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
414 .withBody(new String(Files.readAllBytes(Paths.get(
415 "src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json"))))
416 .withStatus(HttpStatus.SC_OK)));
418 .stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
419 .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-1a18-42e5-965d-8ea592502018"))
420 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
421 .withBody(new String(Files.readAllBytes(Paths
422 .get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
423 .withStatus(HttpStatus.SC_OK)));
426 private void setupTestGetOrchestrationRequestRequestDetails(String requestId, String status) throws Exception {
427 wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse()
428 .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
429 .withBody(new String(Files.readAllBytes(
430 Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestDetails.json"))))
431 .withStatus(HttpStatus.SC_OK)));
434 private void setupTestGetOrchestrationRequestOpenstackDetails(String requestId, String status) throws Exception {
435 wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse()
436 .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
437 .withBody(new String(Files.readAllBytes(Paths
438 .get("src/test/resources/OrchestrationRequest/getOrchestrationOpenstackRequestDetails.json"))))
439 .withStatus(HttpStatus.SC_OK)));
442 private void setupTestUnlockOrchestrationRequest(String requestId, String status) {
443 wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId)))
444 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
445 .withBody(String.format(getResponseTemplate, requestId, status)).withStatus(HttpStatus.SC_OK)));
448 private void setupTestUnlockOrchestrationRequest_invalid_Json() {
449 wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(INVALID_REQUEST_ID))).willReturn(aResponse()
450 .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_NOT_FOUND)));
454 private void setupTestUnlockOrchestrationRequest_Valid_Status(String requestID, String status) {
455 wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestID)))
456 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
457 .withBody(String.format(getResponseTemplate, requestID, status)).withStatus(HttpStatus.SC_OK)));
459 wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl("")))
460 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
461 .withBody(String.format(infraActivePost, requestID)).withStatus(HttpStatus.SC_OK)));
464 private void setupTestGetOrchestrationRequestFilter() throws Exception {
465 // for testGetOrchestrationRequestFilter();
466 wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/getOrchestrationFiltersFromInfraActive/"))
467 .withRequestBody(equalToJson("{\"modelType\":[\"EQUALS\",\"vfModule\"]}"))
468 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
469 .withBody(new String(Files.readAllBytes(
470 Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json"))))
471 .withStatus(HttpStatus.SC_OK)));