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;
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.requestStatus.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));
131 public void testGetOrchestrationRequestInstanceGroup() throws Exception {
132 setupTestGetOrchestrationRequestInstanceGroup();
133 // TEST VALID REQUEST
134 GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
136 Request request = ORCHESTRATION_LIST.getRequestList().get(8).getRequest();
137 testResponse.setRequest(request);
138 String testRequestId = request.getRequestId();
139 HttpHeaders headers = new HttpHeaders();
140 headers.set("Accept", MediaType.APPLICATION_JSON);
141 headers.set("Content-Type", MediaType.APPLICATION_JSON);
142 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
144 UriComponentsBuilder builder = UriComponentsBuilder
145 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
147 ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET,
148 entity, GetOrchestrationResponse.class);
150 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
151 assertThat(response.getBody(),
152 sameBeanAs(testResponse).ignoring("request.startTime")
153 .ignoring("request.requestStatus.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")
181 .ignoring("request.requestStatus.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")
231 .ignoring("requestList.request.requestStatus.finishTime")
232 .ignoring("requestList.request.requestStatus.timeStamp"));
233 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
234 assertEquals(requests.size(), response.getBody().getRequestList().size());
239 public void testUnlockOrchestrationRequest() throws Exception {
240 setupTestUnlockOrchestrationRequest("0017f68c-eb2d-45bb-b7c7-ec31b37dc349", "UNLOCKED");
241 ObjectMapper mapper = new ObjectMapper();
242 mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
243 String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
244 HttpHeaders headers = new HttpHeaders();
245 headers.set("Accept", MediaType.APPLICATION_JSON);
246 headers.set("Content-Type", MediaType.APPLICATION_JSON);
247 HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
249 UriComponentsBuilder builder;
250 ResponseEntity<String> response;
251 RequestError expectedRequestError;
252 RequestError actualRequestError;
256 expectedRequestError = new RequestError();
257 se = new ServiceException();
258 se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
259 se.setText("Orchestration RequestId 0017f68c-eb2d-45bb-b7c7-ec31b37dc349 has a status of UNLOCKED and can not be unlocked");
260 expectedRequestError.setServiceException(se);
262 builder = UriComponentsBuilder.fromHttpUrl(
263 createURLWithPort("/onap/so/infra/orchestrationRequests/v6/0017f68c-eb2d-45bb-b7c7-ec31b37dc349/unlock"));
265 response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
266 actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
268 assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
269 assertThat(actualRequestError, sameBeanAs(expectedRequestError));
273 public void testUnlockOrchestrationRequest_invalid_Json() throws Exception {
274 setupTestUnlockOrchestrationRequest_invalid_Json();
275 ObjectMapper mapper = new ObjectMapper();
276 mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
277 String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
278 HttpHeaders headers = new HttpHeaders();
279 headers.set("Accept", MediaType.APPLICATION_JSON);
280 headers.set("Content-Type", MediaType.APPLICATION_JSON);
281 HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
283 UriComponentsBuilder builder;
284 ResponseEntity<String> response;
285 RequestError expectedRequestError;
286 RequestError actualRequestError;
289 // Test invalid requestId
290 expectedRequestError = new RequestError();
291 se = new ServiceException();
292 se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
293 se.setText("Null response from RequestDB when searching by RequestId");
294 expectedRequestError.setServiceException(se);
296 builder = UriComponentsBuilder.fromHttpUrl(
297 createURLWithPort("/onap/so/infra/orchestrationRequests/v6/" + INVALID_REQUEST_ID + "/unlock"));
299 response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
300 actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
302 assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
303 assertThat(actualRequestError, sameBeanAs(expectedRequestError));
307 public void testUnlockOrchestrationRequest_Valid_Status()
308 throws JsonParseException, JsonMappingException, IOException, ValidationException {
309 setupTestUnlockOrchestrationRequest_Valid_Status("5ffbabd6-b793-4377-a1ab-082670fbc7ac", "PENDING");
310 ObjectMapper mapper = new ObjectMapper();
311 String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
312 HttpHeaders headers = new HttpHeaders();
313 headers.set("Accept", MediaType.APPLICATION_JSON);
314 headers.set("Content-Type", MediaType.APPLICATION_JSON);
315 HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
317 UriComponentsBuilder builder;
318 ResponseEntity<String> response;
322 request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
323 builder = UriComponentsBuilder.fromHttpUrl(
324 createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + "5ffbabd6-b793-4377-a1ab-082670fbc7ac" + "/unlock"));
326 response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
327 //Cannot assert anything further here, already have a wiremock in place which ensures that the post was properly called to update.
330 @Ignore //What is this testing?
332 public void testGetOrchestrationRequestRequestDetailsWhiteSpace() throws Exception {
333 InfraActiveRequests requests = new InfraActiveRequests();
334 requests.setAction("create");
335 requests.setRequestBody(" ");
336 requests.setRequestId("requestId");
337 requests.setRequestScope("service");
338 requests.setRequestType("createInstance");
339 ObjectMapper mapper = new ObjectMapper();
340 String json = mapper.writeValueAsString(requests);
342 requestsDbClient.save(requests);
343 HttpHeaders headers = new HttpHeaders();
344 headers.set("Accept", MediaType.APPLICATION_JSON);
345 headers.set("Content-Type", MediaType.APPLICATION_JSON);
346 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
348 UriComponentsBuilder builder = UriComponentsBuilder
349 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/requestId"));
351 ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET,
352 entity, GetOrchestrationResponse.class);
354 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
355 assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
356 assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
357 assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
358 assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
359 assertEquals("requestId", response.getHeaders().get("X-TransactionID").get(0));
362 @Ignore //What is this testing?
364 public void testGetOrchestrationRequestRequestDetailsAlaCarte() throws IOException {
365 InfraActiveRequests requests = new InfraActiveRequests();
367 String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/AlaCarteRequest.json")));
369 requests.setAction("create");
370 requests.setRequestBody(requestJSON);
371 requests.setRequestId("requestId");
372 requests.setRequestScope("service");
373 requests.setRequestType("createInstance");
374 // iar.save(requests);
375 HttpHeaders headers = new HttpHeaders();
376 headers.set("Accept", MediaType.APPLICATION_JSON);
377 headers.set("Content-Type", MediaType.APPLICATION_JSON);
378 HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
380 UriComponentsBuilder builder = UriComponentsBuilder
381 .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/requestId"));
383 ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET,
384 entity, GetOrchestrationResponse.class);
386 assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
387 assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
388 assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
389 assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
390 assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
391 assertEquals("requestId", response.getHeaders().get("X-TransactionID").get(0));
394 public void mapRequestProcessingDataTest() throws JsonParseException, JsonMappingException, IOException{
395 RequestProcessingData entry = new RequestProcessingData();
396 RequestProcessingData secondEntry = new RequestProcessingData();
397 List<HashMap<String, String>> expectedList = new ArrayList<>();
398 HashMap<String, String> expectedMap = new HashMap<>();
399 List<HashMap<String, String>> secondExpectedList = new ArrayList<>();
400 HashMap<String, String> secondExpectedMap = new HashMap<>();
401 List<RequestProcessingData> expectedDataList = new ArrayList<>();
402 entry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
403 entry.setTag("pincFabricConfigRequest");
404 expectedMap.put("requestAction", "assign");
405 expectedMap.put("pincFabricId", "testId");
406 expectedList.add(expectedMap);
407 entry.setDataPairs(expectedList);
408 secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
409 secondEntry.setTag("pincFabricConfig");
410 secondExpectedMap.put("requestAction", "unassign");
411 secondExpectedList.add(secondExpectedMap);
412 secondEntry.setDataPairs(secondExpectedList);
413 expectedDataList.add(entry);
414 expectedDataList.add(secondEntry);
416 List<org.onap.so.db.request.beans.RequestProcessingData> processingData = new ArrayList<>();
417 List<RequestProcessingData> actualProcessingData = new ArrayList<>();
418 ObjectMapper mapper = new ObjectMapper();
419 processingData = mapper.readValue(new File("src/test/resources/OrchestrationRequest/RequestProcessingData.json"),
420 new TypeReference<List<org.onap.so.db.request.beans.RequestProcessingData>>(){});
421 actualProcessingData = orchReq.mapRequestProcessingData(processingData);
422 assertThat(actualProcessingData,sameBeanAs(expectedDataList));
425 public void setupTestGetOrchestrationRequest() throws Exception{
426 //For testGetOrchestrationRequest
427 stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
428 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequest.json"))))
429 .withStatus(HttpStatus.SC_OK)));
430 stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
431 .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
432 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
433 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
434 .withStatus(HttpStatus.SC_OK)));
436 public void setupTestGetOrchestrationRequestInstanceGroup() throws Exception{
437 //For testGetOrchestrationRequest
438 stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
439 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json"))))
440 .withStatus(HttpStatus.SC_OK)));
441 stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
442 .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
443 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
444 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
445 .withStatus(HttpStatus.SC_OK)));
448 private void setupTestGetOrchestrationRequestRequestDetails(String requestId, String status) throws Exception{
449 stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
450 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestDetails.json"))))
451 .withStatus(HttpStatus.SC_OK)));
454 private void setupTestUnlockOrchestrationRequest(String requestId, String status) {
455 stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
456 .withBody(String.format(getResponseTemplate, requestId, status))
457 .withStatus(HttpStatus.SC_OK)));
463 private void setupTestUnlockOrchestrationRequest_invalid_Json() {
464 stubFor(get(urlPathEqualTo(getTestUrl(INVALID_REQUEST_ID))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
465 .withStatus(HttpStatus.SC_NOT_FOUND)));
469 private void setupTestUnlockOrchestrationRequest_Valid_Status(String requestID, String status) {
470 stubFor(get(urlPathEqualTo(getTestUrl(requestID))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
471 .withBody(String.format(getResponseTemplate, requestID, status))
472 .withStatus(HttpStatus.SC_OK)));
474 stubFor(post(urlPathEqualTo(getTestUrl(""))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
475 .withBody(String.format(infraActivePost, requestID))
476 .withStatus(HttpStatus.SC_OK)));
479 private void setupTestGetOrchestrationRequestFilter() throws Exception{
480 //for testGetOrchestrationRequestFilter();
481 stubFor(any(urlPathEqualTo("/infraActiveRequests/getOrchestrationFiltersFromInfraActive/")).withRequestBody(equalToJson("{\"modelType\":[\"EQUALS\",\"vfModule\"]}")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
482 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json"))))
483 .withStatus(HttpStatus.SC_OK)));