import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZoneOffset;
-
@RunWith(SpringRunner.class)
@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
.andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON)
.location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/123456")));
-
final InlineResponse200 firstOperationQueryResponse = createOperationQueryResponse(
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.INSTANTIATE,
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
mockRestServer.expect(requestTo("http://vnfm:8080/vnf_lcm_op_occs/1234567"))
.andRespond(withSuccess(gson.toJson(firstOperationQueryResponse), MediaType.APPLICATION_JSON));
-
final InlineResponse200 secondOperationQueryReponse = createOperationQueryResponse(
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
mockRestServer.expect(requestTo("http://vnfm:8080/vnf_lcm_op_occs/1234567"))
.andRespond(withSuccess(gson.toJson(secondOperationQueryReponse), MediaType.APPLICATION_JSON));
-
final RequestEntity<Void> request = RequestEntity
.delete(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myTestVnfId"))
.accept(MediaType.APPLICATION_JSON).header("X-ONAP-RequestId", "myRequestId")
assertEquals(202, deleteVnfResponse.getStatusCode().value());
assertNotNull(deleteVnfResponse.getBody().getJobId());
-
final EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
esrSystemInfo.setServiceUrl("http://vnfm:8080");
esrSystemInfo.setType("vnfmType");
doReturn(Optional.of(esrSystemInfoList)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/...")));
-
final ResponseEntity<QueryJobResponse> firstJobQueryResponse =
controller.jobQuery(deleteVnfResponse.getBody().getJobId(), "", "so", "1213");
assertEquals(OperationEnum.TERMINATE, firstJobQueryResponse.getBody().getOperation());
mockRestServer.expect(requestTo("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm/terminate"))
.andRespond(withStatus(HttpStatus.BAD_REQUEST).contentType(MediaType.APPLICATION_JSON));
-
final RequestEntity<Void> request = RequestEntity
.delete(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myTestVnfId"))
.accept(MediaType.APPLICATION_JSON).header("X-ONAP-RequestId", "myRequestId")
}
-
}