From d26574fe0e44f43bfbf507adbf91a28c1b53c63a Mon Sep 17 00:00:00 2001 From: Witold Ficio Kopel Date: Mon, 29 Apr 2019 16:51:05 +0200 Subject: Removed static fields from ASDCRestInterface Fix to Sonar issue - misuse of private static fields within class. Refactored to local variables. Issue-ID: SO-1490 Change-Id: I4e2f3dc5b5424198263bdfc0ff16ae123969db48 Signed-off-by: Witold Ficio Kopel --- .../asdc/client/test/rest/ASDCRestInterface.java | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'asdc-controller') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java index 46ec34e8d3..6a9c1aa848 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java @@ -50,13 +50,12 @@ import org.springframework.stereotype.Component; * This is a TEST only rest interface. It is not used in production, it is used to aid in testing the ASDC service on * jboss without the need to be connected to the ASDC service broker. It starts the test at the treatNotification step * and simulates both the notification step as well as the artifact download step. - * + *

* i.e. http://localhost:8080/asdc/treatNotification/v1 - * + *

* i.e. http://localhost:8080/asdc/statusData/v1 - * - * @author jm5423 * + * @author jm5423 */ @Path("/") @@ -64,10 +63,6 @@ import org.springframework.stereotype.Component; @Profile("test") public class ASDCRestInterface { - private static DistributionClientEmulator distributionClientEmulator; - - private static JsonStatusData statusData; - private static final Logger logger = LoggerFactory.getLogger(ASDCRestInterface.class); @Autowired @@ -83,7 +78,7 @@ public class ASDCRestInterface { public Response invokeASDCService(NotificationDataImpl request, @HeaderParam("resource-location") String resourceLocation) throws ASDCControllerException, ASDCParametersException, IOException { - distributionClientEmulator = new DistributionClientEmulator(resourceLocation); + DistributionClientEmulator distributionClientEmulator = new DistributionClientEmulator(resourceLocation); asdcController.setControllerName("asdc-controller1"); asdcController.setDistributionClient(distributionClientEmulator); @@ -100,22 +95,24 @@ public class ASDCRestInterface { public Response invokeASDCStatusData(String request) { try { - distributionClientEmulator = new DistributionClientEmulator("resource-examples/"); - statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/"); + DistributionClientEmulator distributionClientEmulator = + new DistributionClientEmulator("resource-examples/"); + JsonStatusData statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/"); ASDCController controller = new ASDCController("asdc-controller1", distributionClientEmulator); controller.initASDC(); toscaInstaller.installTheComponentStatus(statusData); controller.closeASDC(); + + logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(), + "ASDC", "ASDC Updates Are Complete"); } catch (Exception e) { logger.info("Error caught " + e.getMessage()); logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION.toString(), "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e); } - logger.info("ASDC Updates are complete"); - logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(), - "ASDC", "ASDC Updates Are Complete"); + return null; } } -- cgit 1.2.3-korg