X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=plans%2Fso%2Fintegration-etsi-testing%2Fso-simulators%2Fsdnc-simulator%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fso%2Fsdncsimulator%2Fproviders%2FServiceOperationsCacheServiceProviderimpl.java;h=88db4c13d28e2867ad345909eeadcf545ec8ce00;hb=1ac31d97454ec9e317d72f05b5c7847e541fedc7;hp=dae8b7f4ffe288c6141be33c8a873d829fa52a35;hpb=d0a68c3945879639bba7511fc8ea0c1a23518d90;p=integration%2Fcsit.git 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);