From b5dd0fc4de9fc2d6d01392b90c5232664ae0293c Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Tue, 4 Feb 2020 17:19:14 +0900 Subject: Fix logging issue in so-simulator Use a logger to log this exception Either log or rethrow this exception Issue-ID: SO-1841 Change-Id: I5a9802fcf11d610cd60b61c0760781add7cdc91d Signed-off-by: Parshad Patel --- .../java/org/onap/so/simulator/actions/aai/ProcessNetwork.java | 6 ++++-- .../main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java | 2 +- .../onap/so/simulator/scenarios/openstack/CreateAAInventory.java | 6 +++++- .../simulator/scenarios/sdnc/grapi/ProcessSDNCAssignService.java | 7 +++++-- 4 files changed, 15 insertions(+), 6 deletions(-) (limited to 'so-simulator') diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java index 075a5b7a6b..7b6fb36fab 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java @@ -5,6 +5,8 @@ import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.consol.citrus.actions.AbstractTestAction; import com.consol.citrus.context.TestContext; @@ -13,7 +15,7 @@ public class ProcessNetwork extends AbstractTestAction { @Override public void doExecute(TestContext context) { - + final Logger logger = LoggerFactory.getLogger(ProcessNetwork.class); try { int random = (int) (Math.random() * 50 + 1); @@ -35,7 +37,7 @@ public class ProcessNetwork extends AbstractTestAction { aaiResourceClient.delete(networkURI); } } catch (Exception e) { - e.printStackTrace(); + logger.debug("Exception in ProcessNetwork.doExecute", e); } } diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java index e061d2b79d..76ad823f18 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java @@ -58,7 +58,7 @@ public class ProcessVnfc extends AbstractTestAction { aaiResourceClient.connect(vfModuleURI, vnfcURI); } } catch (Exception e) { - logger.debug(e.getMessage()); + logger.debug("Exception in ProcessVnfc.doExecute", e); } } } diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java index eae5ef2135..c8fddcf19c 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java @@ -7,6 +7,8 @@ import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.core.io.ClassPathResource; import com.consol.citrus.actions.AbstractTestAction; import com.consol.citrus.context.TestContext; @@ -15,6 +17,8 @@ public class CreateAAInventory extends AbstractTestAction { @Override public void doExecute(TestContext context) { + final Logger logger = LoggerFactory.getLogger(CreateAAInventory.class); + try { String stackName = context.getVariable("stackName"); @@ -30,7 +34,7 @@ public class CreateAAInventory extends AbstractTestAction { aaiResourceClient.create(vserverURI, vserver); } } catch (Exception e) { - e.printStackTrace(); + logger.debug("Exception in CreateAAInventory.doExecute", e); } } diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ProcessSDNCAssignService.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ProcessSDNCAssignService.java index c1ba812513..d3e9fc045d 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ProcessSDNCAssignService.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ProcessSDNCAssignService.java @@ -1,13 +1,16 @@ package org.onap.so.simulator.scenarios.sdnc.grapi; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.consol.citrus.actions.AbstractTestAction; import com.consol.citrus.context.TestContext; public class ProcessSDNCAssignService extends AbstractTestAction { - @Override public void doExecute(TestContext context) { + final Logger logger = LoggerFactory.getLogger(ProcessSDNCAssignService.class); + try { String serviceName = context.getVariable("serviceName"); String action = context.getVariable("action"); @@ -21,7 +24,7 @@ public class ProcessSDNCAssignService extends AbstractTestAction { } } catch (Exception e) { - e.printStackTrace(); + logger.debug("Exception in ProcessSDNCAssignService.doExecute", e); } } -- cgit 1.2.3-korg