From 1ac31d97454ec9e317d72f05b5c7847e541fedc7 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Tue, 28 Jan 2020 16:07:47 +0000 Subject: [PATCH] Fix for SO-2617 Change-Id: Ie562083754e82068fd54118c5ba73714b7a53f2d Issue-ID: SO-2617 Signed-off-by: waqas.ikram --- .../so-simulators/aai-simulator/pom.xml | 16 ++ .../integration-etsi-testing/so-simulators/pom.xml | 31 ++- .../controller/OperationsController.java | 5 +- .../ServiceOperationsCacheServiceProviderimpl.java | 20 +- .../controller/OperationsControllerTest.java | 19 +- .../so-simulators/vnfm-simulator/vnfm-api/pom.xml | 223 +++++++++++---------- 6 files changed, 184 insertions(+), 130 deletions(-) diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml index e6a210a5..26815ad0 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml @@ -39,6 +39,22 @@ org.apache.httpcomponents httpclient + + javax.xml.bind + jaxb-api + + + com.sun.xml.bind + jaxb-core + + + com.sun.xml.bind + jaxb-impl + + + javax.activation + activation + diff --git a/plans/so/integration-etsi-testing/so-simulators/pom.xml b/plans/so/integration-etsi-testing/so-simulators/pom.xml index 80d4ba95..372b073d 100644 --- a/plans/so/integration-etsi-testing/so-simulators/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/pom.xml @@ -1,23 +1,21 @@ 4.0.0 - org.onap.so.simulators so-simulators - pom ${project.artifactId} 1.0-SNAPSHOT - 2.1 UTF-8 UTF-8 1.8 1.8 + 2.3.0 + 1.1.1 1.8 - common sdc-simulator @@ -26,16 +24,35 @@ vnfm-simulator package - org.springframework.boot spring-boot-starter-parent - 2.0.5.RELEASE + 2.1.5.RELEASE pom import + + javax.xml.bind + jaxb-api + ${jaxb.version} + + + com.sun.xml.bind + jaxb-core + ${jaxb.version} + + + com.sun.xml.bind + jaxb-impl + ${jaxb.version} + + + javax.activation + activation + ${javax.version} + @@ -67,4 +84,4 @@ ${jax.ws.rs} - + \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java index f96224d3..2f24ef69 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java @@ -52,6 +52,7 @@ import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping(path = OPERATIONS_URL) public class OperationsController { + private static final String HTTP_STATUS_OK = HttpStatus.OK.value() + ""; private static final Logger LOGGER = LoggerFactory.getLogger(OperationsController.class); @@ -80,7 +81,7 @@ public class OperationsController { final Output output = getOutput(apiServiceOperationInformation); final OutputRequest outputRequest = new OutputRequest(output); - if (output.getResponseCode().equals(HttpStatus.OK.toString())) { + if (output.getResponseCode().equals(HTTP_STATUS_OK)) { LOGGER.info("Sucessfully executed service request sending response: {}", outputRequest); return ResponseEntity.ok(outputRequest); } @@ -106,7 +107,7 @@ public class OperationsController { final Output output = getOutput(apiVnfOperationInformation); final OutputRequest outputRequest = new OutputRequest(output); - if (output.getResponseCode().equals(HttpStatus.OK.toString())) { + if (output.getResponseCode().equals(HTTP_STATUS_OK)) { LOGGER.info("Sucessfully executed request vnf sending response: {}", outputRequest); return ResponseEntity.ok(outputRequest); } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java index dae8b7f4..88db4c13 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java @@ -78,6 +78,8 @@ import org.springframework.stereotype.Service; public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServiceProvider implements ServiceOperationsCacheServiceProvider { + private static final String HTTP_STATUS_BAD_REQUEST = Integer.toString(HttpStatus.BAD_REQUEST.value()); + private static final String HTTP_STATUS_OK = Integer.toString(HttpStatus.OK.value()); private static final String EMPTY_STRING = ""; private static final Logger LOGGER = LoggerFactory.getLogger(ServiceOperationsCacheServiceProviderimpl.class); @@ -114,7 +116,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ .instanceId(serviceInstanceId).objectPath(getObjectPath(serviceInstanceId))); } LOGGER.error("serviceInstanceId: {} already exists", serviceInstanceId); - return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString()) + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_BAD_REQUEST) .responseMessage("serviceInstanceId: " + serviceInstanceId + " already exists") .svcRequestId(svcRequestId); } @@ -122,7 +124,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ LOGGER.error( "Unable to add GenericResourceApiServiceOperationInformation in cache due to invalid input: {}... ", input); - return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString()) + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_BAD_REQUEST) .responseMessage("Service instance not found").svcRequestId(svcRequestId); } @@ -141,7 +143,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ LOGGER.info("Deleting GenericResourceApiServiceOperationInformation from cache using key: {}", serviceInstanceId); cache.evict(serviceInstanceId); - return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.OK.toString()) + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_OK) .responseMessage(EMPTY_STRING).svcRequestId(svcRequestId).serviceResponseInformation( new GenericResourceApiInstanceReference().instanceId(serviceInstanceId)); } @@ -151,7 +153,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ } LOGGER.error("Unable to remove service instance from cache due to invalid input: {}... ", input); - return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString()) + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_BAD_REQUEST) .responseMessage("Unable to remove service").svcRequestId(svcRequestId); } @@ -208,7 +210,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ .objectPath(getObjectPath(serviceInstanceId, vnfId))); } LOGGER.error("vnfId: {} already exists with SVC Action: {}", vnfId, svcAction); - return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString()) + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_BAD_REQUEST) .responseMessage("vnfId: " + vnfId + " already exists").svcRequestId(svcRequestId); } } @@ -220,7 +222,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ LOGGER.error( "Unable to add GenericResourceApiServiceOperationInformation in cache due to invalid input: {}... ", input); - return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString()) + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_BAD_REQUEST) .responseMessage("Unable to add vnf").svcRequestId(svcRequestId); } @@ -256,7 +258,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ return false; }); - return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.OK.toString()) + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_OK) .responseMessage(EMPTY_STRING).svcRequestId(svcRequestId) .serviceResponseInformation( new GenericResourceApiInstanceReference().instanceId(serviceInstanceId)) @@ -271,7 +273,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ } LOGGER.error("Unable to remove vnf instance from cache due to invalid input: {}... ", input); - return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString()) + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_BAD_REQUEST) .responseMessage("Unable to remove vnf").svcRequestId(svcRequestId); } @@ -406,7 +408,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ final GenericResourceApiServicestatusServiceStatus serviceStatus = getServiceStatus(getSvcAction(input.getSdncRequestHeader()), - getRequestAction(input.getRequestInformation()), HttpStatus.OK.toString()); + getRequestAction(input.getRequestInformation()), HTTP_STATUS_OK); return new GenericResourceApiServicemodelinfrastructureService().serviceData(apiServicedataServiceData) .serviceStatus(serviceStatus).serviceInstanceId(serviceInstanceId); diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java index b498bd6e..888a251e 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java @@ -71,6 +71,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @Configuration public class OperationsControllerTest { + private static final String HTTP_STATUS_BAD_REQUEST = Integer.toString(HttpStatus.BAD_REQUEST.value()); + private static final String HTTP_STATUS_OK = Integer.toString(HttpStatus.OK.value()); + private static final String SVC_REQUEST_ID = "04fc9f50-87b8-430d-a232-ef24bd6c4150"; private static final String VNF_SVC_REQUEST_ID = "8fd2622b-01fc-424d-bfc8-f48bcd64e546"; @@ -112,7 +115,7 @@ public class OperationsControllerTest { final Output actualObject = actualOutputRequest.getOutput(); assertNotNull(actualObject); - assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode()); + assertEquals(HTTP_STATUS_OK, actualObject.getResponseCode()); assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); assertEquals(SVC_REQUEST_ID, actualObject.getSvcRequestId()); assertNotNull(actualObject.getServiceResponseInformation()); @@ -157,7 +160,7 @@ public class OperationsControllerTest { final Output actualObject = actualOutputRequest.getOutput(); assertNotNull(actualObject); - assertEquals(HttpStatus.BAD_REQUEST.toString(), actualObject.getResponseCode()); + assertEquals(HTTP_STATUS_BAD_REQUEST, actualObject.getResponseCode()); assertEquals(SVC_REQUEST_ID, actualObject.getSvcRequestId()); assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); @@ -183,7 +186,7 @@ public class OperationsControllerTest { final Output actualObject = actualOutputRequest.getOutput(); - assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode()); + assertEquals(HTTP_STATUS_OK, actualObject.getResponseCode()); assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); assertEquals(VNF_SVC_REQUEST_ID, actualObject.getSvcRequestId()); assertNotNull(actualObject.getServiceResponseInformation()); @@ -242,7 +245,7 @@ public class OperationsControllerTest { final Output actualObject = badOutputRequest.getOutput(); assertNotNull(actualObject); - assertEquals(HttpStatus.BAD_REQUEST.toString(), actualObject.getResponseCode()); + assertEquals(HTTP_STATUS_BAD_REQUEST, actualObject.getResponseCode()); assertEquals(VNF_SVC_REQUEST_ID, actualObject.getSvcRequestId()); assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); @@ -276,7 +279,7 @@ public class OperationsControllerTest { final Output actualObject = actualOutputRequest.getOutput(); - assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode()); + assertEquals(HTTP_STATUS_OK, actualObject.getResponseCode()); assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); assertEquals(VNF_SVC_REQUEST_ID, actualObject.getSvcRequestId()); assertNotNull(actualObject.getServiceResponseInformation()); @@ -349,7 +352,7 @@ public class OperationsControllerTest { final Output actualObject = actualOutputRequest.getOutput(); - assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode()); + assertEquals(HTTP_STATUS_OK, actualObject.getResponseCode()); assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); assertEquals(VNF_SVC_REQUEST_ID, actualObject.getSvcRequestId()); @@ -395,7 +398,7 @@ public class OperationsControllerTest { final Output actualObject = actualOutputRequest.getOutput(); - assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode()); + assertEquals(HTTP_STATUS_OK, actualObject.getResponseCode()); assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); assertEquals(SVC_REQUEST_ID, actualObject.getSvcRequestId()); @@ -435,7 +438,7 @@ public class OperationsControllerTest { final Output actualObject = actualOutputRequest.getOutput(); - assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode()); + assertEquals(HTTP_STATUS_OK, actualObject.getResponseCode()); assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); assertEquals(SVC_REQUEST_ID, actualObject.getSvcRequestId()); diff --git a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-api/pom.xml b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-api/pom.xml index ade3e012..23dc243f 100644 --- a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-api/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-api/pom.xml @@ -1,106 +1,121 @@ - 4.0.0 - - org.onap.so.simulators.vnfm - vnfm-simulator - 1.0-SNAPSHOT - - vnfm-api - ${project.artifactId} - - 1.8.2 - 2.3.0 - 1.3.5 - 2.0.0-RC1 - 1.0.1 - 1.5.15 - 2.8.5 - - VNFM Simulator adapter API - - - - - io.swagger - swagger-codegen-maven-plugin - 2.3.1 - - - vnfmsimulator - generate-sources - - generate - - - ${basedir}/src/main/resources/vnfm-sim-swagger.yaml - java - retrofit2 - ${project.build.directory}/generated-sources/vnfmsimulator - org.onap.vnfm.v1.api - org.onap.vnfm.v1.model - - true - src/gen/java/main - true - true - - - - - - - - - - io.swagger - swagger-annotations - ${swagger-core-version} - - - com.squareup.retrofit2 - converter-gson - ${retrofit-version} - - - com.squareup.retrofit2 - retrofit - ${retrofit-version} - - - com.squareup.retrofit2 - converter-scalars - ${retrofit-version} - - - org.apache.oltu.oauth2 - org.apache.oltu.oauth2.client - ${oltu-version} - - - io.gsonfire - gson-fire - ${gson-fire-version} - - - org.threeten - threetenbp - ${threetenbp-version} - - - io.reactivex.rxjava2 - rxjava - ${rxjava-version} - - - com.squareup.retrofit2 - adapter-rxjava2 - ${retrofit-version} - - - com.google.code.gson - gson - ${gson-version} - - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.onap.so.simulators.vnfm + vnfm-simulator + 1.0-SNAPSHOT + + vnfm-api + ${project.artifactId} + + 1.8.2 + 2.3.0 + 1.3.5 + 2.0.0-RC1 + 1.0.1 + 1.5.15 + 2.8.5 + + VNFM Simulator adapter API + + + + io.swagger + swagger-codegen-maven-plugin + 2.3.1 + + + vnfmsimulator + generate-sources + + generate + + + ${basedir}/src/main/resources/vnfm-sim-swagger.yaml + java + retrofit2 + ${project.build.directory}/generated-sources/vnfmsimulator + org.onap.vnfm.v1.api + org.onap.vnfm.v1.model + + true + src/gen/java/main + true + true + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-core-version} + + + com.squareup.retrofit2 + converter-gson + ${retrofit-version} + + + com.squareup.retrofit2 + retrofit + ${retrofit-version} + + + com.squareup.retrofit2 + converter-scalars + ${retrofit-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + ${oltu-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.threeten + threetenbp + ${threetenbp-version} + + + io.reactivex.rxjava2 + rxjava + ${rxjava-version} + + + com.squareup.retrofit2 + adapter-rxjava2 + ${retrofit-version} + + + com.google.code.gson + gson + ${gson-version} + + + javax.xml.bind + jaxb-api + + + com.sun.xml.bind + jaxb-core + + + com.sun.xml.bind + jaxb-impl + + + javax.activation + activation + + \ No newline at end of file -- 2.16.6