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