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;
36 import java.io.IOException;
37 import java.nio.file.Files;
38 import java.nio.file.Paths;
39 import java.util.ArrayList;
40 import java.util.HashMap;
41 import java.util.List;
44 import javax.ws.rs.core.MediaType;
45 import javax.ws.rs.core.Response;
47 import org.apache.http.HttpStatus;
48 import org.junit.Ignore;
49 import org.junit.Test;
50 import org.onap.so.apihandler.common.ErrorNumbers;
51 import org.onap.so.db.request.beans.InfraActiveRequests;
52 import org.onap.so.db.request.client.RequestsDbClient;
53 import org.onap.so.exceptions.ValidationException;
54 import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
55 import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
56 import org.onap.so.serviceinstancebeans.Request;
57 import org.onap.so.serviceinstancebeans.RequestError;
58 import org.onap.so.serviceinstancebeans.RequestProcessingData;
59 import org.onap.so.serviceinstancebeans.ServiceException;
60 import org.springframework.beans.factory.annotation.Autowired;
61 import org.springframework.http.HttpEntity;
62 import org.springframework.http.HttpHeaders;
63 import org.springframework.http.HttpMethod;
64 import org.springframework.http.ResponseEntity;
65 import org.springframework.web.util.UriComponentsBuilder;
67 import com.fasterxml.jackson.core.JsonParseException;
68 import com.fasterxml.jackson.core.type.TypeReference;
69 import com.fasterxml.jackson.databind.DeserializationFeature;
70 import com.fasterxml.jackson.databind.JsonMappingException;
71 import com.fasterxml.jackson.databind.ObjectMapper;
73 public class OrchestrationRequestsTest extends BaseTest {
75 private RequestsDbClient requestsDbClient;
78 private OrchestrationRequests orchReq;
80 private static final GetOrchestrationListResponse ORCHESTRATION_LIST = generateOrchestrationList();
81 private static final String INVALID_REQUEST_ID = "invalid-request-id";
83 private static GetOrchestrationListResponse generateOrchestrationList() {
84 GetOrchestrationListResponse list = null;
86 ObjectMapper mapper = new ObjectMapper();
87 list = mapper.readValue(new File("src/test/resources/OrchestrationRequest/OrchestrationList.json"),
88 GetOrchestrationListResponse.class);
89 } catch (JsonParseException jpe) {
90 jpe.printStackTrace();
91 } catch (JsonMappingException jme) {
92 jme.printStackTrace();
93 } catch (IOException ioe) {
94 ioe.printStackTrace();
100 public void testGetOrchestrationRequest() throws Exception {
101 setupTestGetOrchestrationRequest();
102 // TEST VALID REQUEST
103 GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
105 Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
106 testResponse.setRequest(request);
107 String testRequestId = request.getRequestId();
108 HttpHeaders headers = new HttpHeaders();
109 headers.set("Accept", MediaType.APPLICATION_JSON);
110 headers.set("Content-Type", MediaType.APPLICATION_JSON);
111 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
113 UriComponentsBuilder builder = UriComponentsBuilder
114 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
116 ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET,
117 entity, GetOrchestrationResponse.class);
119 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
120 assertThat(response.getBody(),
121 sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.finishTime")
122 .ignoring("request.requestStatus.timeStamp"));
123 assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
124 assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
125 assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
126 assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
127 assertEquals("00032ab7-na18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
128 assertNotNull(response.getBody().getRequest().getFinishTime());
132 public void testGetOrchestrationRequestInstanceGroup() throws Exception {
133 setupTestGetOrchestrationRequestInstanceGroup();
134 // TEST VALID REQUEST
135 GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
137 Request request = ORCHESTRATION_LIST.getRequestList().get(8).getRequest();
138 testResponse.setRequest(request);
139 String testRequestId = request.getRequestId();
140 HttpHeaders headers = new HttpHeaders();
141 headers.set("Accept", MediaType.APPLICATION_JSON);
142 headers.set("Content-Type", MediaType.APPLICATION_JSON);
143 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
145 UriComponentsBuilder builder = UriComponentsBuilder
146 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
148 ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET,
149 entity, GetOrchestrationResponse.class);
151 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
152 assertThat(response.getBody(),
153 sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.finishTime")
154 .ignoring("request.requestStatus.timeStamp"));
158 public void testGetOrchestrationRequestRequestDetails() throws Exception {
159 setupTestGetOrchestrationRequestRequestDetails("00032ab7-3fb3-42e5-965d-8ea592502017", "COMPLETED");
160 //Test request with modelInfo request body
161 GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
163 Request request = ORCHESTRATION_LIST.getRequestList().get(0).getRequest();
164 testResponse.setRequest(request);
165 String testRequestId = request.getRequestId();
167 HttpHeaders headers = new HttpHeaders();
168 headers.set("Accept", MediaType.APPLICATION_JSON);
169 headers.set("Content-Type", MediaType.APPLICATION_JSON);
170 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
172 UriComponentsBuilder builder = UriComponentsBuilder
173 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
175 ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET,
176 entity, GetOrchestrationResponse.class);
178 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
179 assertThat(response.getBody(),
180 sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.finishTime")
181 .ignoring("request.requestStatus.timeStamp"));
182 assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
183 assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
184 assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
185 assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
186 assertEquals("00032ab7-3fb3-42e5-965d-8ea592502017", response.getHeaders().get("X-TransactionID").get(0));
190 public void testGetOrchestrationRequestNoRequestID() {
191 HttpHeaders headers = new HttpHeaders();
192 headers.set("Accept", "application/json; charset=UTF-8");
193 headers.set("Content-Type", "application/json; charset=UTF-8");
194 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
195 UriComponentsBuilder builder = UriComponentsBuilder
196 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v6/"));
198 ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(),
199 HttpMethod.GET, entity, GetOrchestrationListResponse.class);
200 assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
204 public void testGetOrchestrationRequestFilter() throws Exception {
205 setupTestGetOrchestrationRequestFilter();
206 List<String> values = new ArrayList<>();
207 values.add("EQUALS");
208 values.add("vfModule");
210 ObjectMapper mapper = new ObjectMapper();
211 GetOrchestrationListResponse testResponse = mapper.readValue(new File("src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json"),
212 GetOrchestrationListResponse.class);
214 Map<String, List<String>> orchestrationMap = new HashMap<>();
215 orchestrationMap.put("modelType", values);
216 List<GetOrchestrationResponse> testResponses = new ArrayList<>();
218 List<InfraActiveRequests> requests = requestsDbClient.getOrchestrationFiltersFromInfraActive(orchestrationMap);
219 HttpHeaders headers = new HttpHeaders();
220 headers.set("Accept", MediaType.APPLICATION_JSON);
221 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
223 UriComponentsBuilder builder = UriComponentsBuilder
224 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v6?filter=modelType:EQUALS:vfModule"));
226 ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(),
227 HttpMethod.GET, entity, GetOrchestrationListResponse.class);
228 assertThat(response.getBody(),
229 sameBeanAs(testResponse).ignoring("requestList.request.startTime").ignoring("requestList.request.finishTime")
230 .ignoring("requestList.request.requestStatus.timeStamp"));
231 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
232 assertEquals(requests.size(), response.getBody().getRequestList().size());
237 public void testUnlockOrchestrationRequest() throws Exception {
238 setupTestUnlockOrchestrationRequest("0017f68c-eb2d-45bb-b7c7-ec31b37dc349", "UNLOCKED");
239 ObjectMapper mapper = new ObjectMapper();
240 mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
241 String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
242 HttpHeaders headers = new HttpHeaders();
243 headers.set("Accept", MediaType.APPLICATION_JSON);
244 headers.set("Content-Type", MediaType.APPLICATION_JSON);
245 HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
247 UriComponentsBuilder builder;
248 ResponseEntity<String> response;
249 RequestError expectedRequestError;
250 RequestError actualRequestError;
254 expectedRequestError = new RequestError();
255 se = new ServiceException();
256 se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
257 se.setText("Orchestration RequestId 0017f68c-eb2d-45bb-b7c7-ec31b37dc349 has a status of UNLOCKED and can not be unlocked");
258 expectedRequestError.setServiceException(se);
260 builder = UriComponentsBuilder.fromHttpUrl(
261 createURLWithPort("/onap/so/infra/orchestrationRequests/v6/0017f68c-eb2d-45bb-b7c7-ec31b37dc349/unlock"));
263 response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
264 actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
266 assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
267 assertThat(actualRequestError, sameBeanAs(expectedRequestError));
271 public void testUnlockOrchestrationRequest_invalid_Json() throws Exception {
272 setupTestUnlockOrchestrationRequest_invalid_Json();
273 ObjectMapper mapper = new ObjectMapper();
274 mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
275 String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
276 HttpHeaders headers = new HttpHeaders();
277 headers.set("Accept", MediaType.APPLICATION_JSON);
278 headers.set("Content-Type", MediaType.APPLICATION_JSON);
279 HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
281 UriComponentsBuilder builder;
282 ResponseEntity<String> response;
283 RequestError expectedRequestError;
284 RequestError actualRequestError;
287 // Test invalid requestId
288 expectedRequestError = new RequestError();
289 se = new ServiceException();
290 se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
291 se.setText("Null response from RequestDB when searching by RequestId");
292 expectedRequestError.setServiceException(se);
294 builder = UriComponentsBuilder.fromHttpUrl(
295 createURLWithPort("/onap/so/infra/orchestrationRequests/v6/" + INVALID_REQUEST_ID + "/unlock"));
297 response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
298 actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
300 assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
301 assertThat(actualRequestError, sameBeanAs(expectedRequestError));
305 public void testUnlockOrchestrationRequest_Valid_Status()
306 throws JsonParseException, JsonMappingException, IOException, ValidationException {
307 setupTestUnlockOrchestrationRequest_Valid_Status("5ffbabd6-b793-4377-a1ab-082670fbc7ac", "PENDING");
308 ObjectMapper mapper = new ObjectMapper();
309 String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
310 HttpHeaders headers = new HttpHeaders();
311 headers.set("Accept", MediaType.APPLICATION_JSON);
312 headers.set("Content-Type", MediaType.APPLICATION_JSON);
313 HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
315 UriComponentsBuilder builder;
316 ResponseEntity<String> response;
320 request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
321 builder = UriComponentsBuilder.fromHttpUrl(
322 createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + "5ffbabd6-b793-4377-a1ab-082670fbc7ac" + "/unlock"));
324 response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
325 //Cannot assert anything further here, already have a wiremock in place which ensures that the post was properly called to update.
328 @Ignore //What is this testing?
330 public void testGetOrchestrationRequestRequestDetailsWhiteSpace() throws Exception {
331 InfraActiveRequests requests = new InfraActiveRequests();
332 requests.setAction("create");
333 requests.setRequestBody(" ");
334 requests.setRequestId("requestId");
335 requests.setRequestScope("service");
336 requests.setRequestType("createInstance");
337 ObjectMapper mapper = new ObjectMapper();
338 String json = mapper.writeValueAsString(requests);
340 requestsDbClient.save(requests);
341 HttpHeaders headers = new HttpHeaders();
342 headers.set("Accept", MediaType.APPLICATION_JSON);
343 headers.set("Content-Type", MediaType.APPLICATION_JSON);
344 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
346 UriComponentsBuilder builder = UriComponentsBuilder
347 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/requestId"));
349 ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET,
350 entity, GetOrchestrationResponse.class);
352 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
353 assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
354 assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
355 assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
356 assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
357 assertEquals("requestId", response.getHeaders().get("X-TransactionID").get(0));
360 @Ignore //What is this testing?
362 public void testGetOrchestrationRequestRequestDetailsAlaCarte() throws IOException {
363 InfraActiveRequests requests = new InfraActiveRequests();
365 String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/AlaCarteRequest.json")));
367 requests.setAction("create");
368 requests.setRequestBody(requestJSON);
369 requests.setRequestId("requestId");
370 requests.setRequestScope("service");
371 requests.setRequestType("createInstance");
372 // iar.save(requests);
373 HttpHeaders headers = new HttpHeaders();
374 headers.set("Accept", MediaType.APPLICATION_JSON);
375 headers.set("Content-Type", MediaType.APPLICATION_JSON);
376 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
378 UriComponentsBuilder builder = UriComponentsBuilder
379 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/requestId"));
381 ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET,
382 entity, GetOrchestrationResponse.class);
384 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
385 assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
386 assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
387 assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
388 assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
389 assertEquals("requestId", response.getHeaders().get("X-TransactionID").get(0));
392 public void mapRequestProcessingDataTest() throws JsonParseException, JsonMappingException, IOException{
393 RequestProcessingData entry = new RequestProcessingData();
394 RequestProcessingData secondEntry = new RequestProcessingData();
395 List<HashMap<String, String>> expectedList = new ArrayList<>();
396 HashMap<String, String> expectedMap = new HashMap<>();
397 List<HashMap<String, String>> secondExpectedList = new ArrayList<>();
398 HashMap<String, String> secondExpectedMap = new HashMap<>();
399 List<RequestProcessingData> expectedDataList = new ArrayList<>();
400 entry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
401 entry.setTag("pincFabricConfigRequest");
402 expectedMap.put("requestAction", "assign");
403 expectedMap.put("pincFabricId", "testId");
404 expectedList.add(expectedMap);
405 entry.setDataPairs(expectedList);
406 secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
407 secondEntry.setTag("pincFabricConfig");
408 secondExpectedMap.put("requestAction", "unassign");
409 secondExpectedList.add(secondExpectedMap);
410 secondEntry.setDataPairs(secondExpectedList);
411 expectedDataList.add(entry);
412 expectedDataList.add(secondEntry);
414 List<org.onap.so.db.request.beans.RequestProcessingData> processingData = new ArrayList<>();
415 List<RequestProcessingData> actualProcessingData = new ArrayList<>();
416 ObjectMapper mapper = new ObjectMapper();
417 processingData = mapper.readValue(new File("src/test/resources/OrchestrationRequest/RequestProcessingData.json"),
418 new TypeReference<List<org.onap.so.db.request.beans.RequestProcessingData>>(){});
419 actualProcessingData = orchReq.mapRequestProcessingData(processingData);
420 assertThat(actualProcessingData,sameBeanAs(expectedDataList));
423 public void setupTestGetOrchestrationRequest() throws Exception{
424 //For testGetOrchestrationRequest
425 wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
426 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequest.json"))))
427 .withStatus(HttpStatus.SC_OK)));
428 wireMockServer.stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
429 .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
430 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
431 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
432 .withStatus(HttpStatus.SC_OK)));
434 public void setupTestGetOrchestrationRequestInstanceGroup() throws Exception{
435 //For testGetOrchestrationRequest
436 wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
437 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json"))))
438 .withStatus(HttpStatus.SC_OK)));
439 wireMockServer.stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
440 .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
441 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
442 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
443 .withStatus(HttpStatus.SC_OK)));
446 private void setupTestGetOrchestrationRequestRequestDetails(String requestId, String status) throws Exception{
447 wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
448 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestDetails.json"))))
449 .withStatus(HttpStatus.SC_OK)));
452 private void setupTestUnlockOrchestrationRequest(String requestId, String status) {
453 wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
454 .withBody(String.format(getResponseTemplate, requestId, status))
455 .withStatus(HttpStatus.SC_OK)));
461 private void setupTestUnlockOrchestrationRequest_invalid_Json() {
462 wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(INVALID_REQUEST_ID))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
463 .withStatus(HttpStatus.SC_NOT_FOUND)));
467 private void setupTestUnlockOrchestrationRequest_Valid_Status(String requestID, String status) {
468 wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestID))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
469 .withBody(String.format(getResponseTemplate, requestID, status))
470 .withStatus(HttpStatus.SC_OK)));
472 wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl(""))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
473 .withBody(String.format(infraActivePost, requestID))
474 .withStatus(HttpStatus.SC_OK)));
477 private void setupTestGetOrchestrationRequestFilter() throws Exception{
478 //for testGetOrchestrationRequestFilter();
479 wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/getOrchestrationFiltersFromInfraActive/")).withRequestBody(equalToJson("{\"modelType\":[\"EQUALS\",\"vfModule\"]}")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
480 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json"))))
481 .withStatus(HttpStatus.SC_OK)));