diff options
author | Witold Ficio Kopel <w.kopel@samsung.com> | 2019-04-29 16:51:05 +0200 |
---|---|---|
committer | Witold Ficio Kopel <w.kopel@samsung.com> | 2019-04-29 16:56:24 +0200 |
commit | d26574fe0e44f43bfbf507adbf91a28c1b53c63a (patch) | |
tree | da5c52088d9db4de0d9a1358ad0f41274fa9d051 /asdc-controller/src/main/java | |
parent | 9fde49a65e7a4f6344fa5c20bf323f21f81f2b81 (diff) |
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 <w.kopel@samsung.com>
Diffstat (limited to 'asdc-controller/src/main/java')
-rw-r--r-- | asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java | 25 |
1 files changed, 11 insertions, 14 deletions
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. - * + * <p> * i.e. http://localhost:8080/asdc/treatNotification/v1 - * + * <p> * 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; } } |