From 8fe3168b910b5088d4874890961a26792b6d7325 Mon Sep 17 00:00:00 2001 From: GuangrongFu Date: Thu, 22 Oct 2020 19:02:27 +0800 Subject: Added Some Debugging Logs Change-Id: I15bb6ada02424a65884522e4a2727fac29d2162a Issue-ID: HOLMES-369 Signed-off-by: GuangrongFu --- .../java/org/onap/holmes/common/dcae/DcaeConfigurationsCache.java | 5 +++++ .../src/main/java/org/onap/holmes/common/dmaap/DmaapService.java | 3 ++- .../org/onap/holmes/common/dcae/DcaeConfigurationsCacheTest.java | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'holmes-actions/src') diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationsCache.java b/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationsCache.java index 2503ce2..2dd5ac5 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationsCache.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationsCache.java @@ -18,6 +18,7 @@ package org.onap.holmes.common.dcae; import lombok.extern.slf4j.Slf4j; import org.onap.holmes.common.dcae.entity.DcaeConfigurations; import org.onap.holmes.common.dcae.entity.SecurityInfo; +import org.onap.holmes.common.utils.GsonUtil; @Slf4j public class DcaeConfigurationsCache { @@ -40,4 +41,8 @@ public class DcaeConfigurationsCache { public synchronized static void setDcaeConfigurations(DcaeConfigurations configurations) { dcaeConfigurations = configurations; } + + public synchronized static String getDcaeConfigurations() { + return GsonUtil.beanToJson(dcaeConfigurations); + } } diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java index f29f1d9..7e33bf9 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java @@ -71,7 +71,8 @@ public class DmaapService { } catch (CorrelationException e) { log.error("Failed to publish the control loop event to DMaaP", e); } catch (NullPointerException e) { - log.error("DMaaP configurations do not exist!"); + log.error(String.format("DMaaP configurations do not exist!\n DCAE Configurations: \n %s", + DcaeConfigurationsCache.getDcaeConfigurations()), e); } } diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/dcae/DcaeConfigurationsCacheTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/dcae/DcaeConfigurationsCacheTest.java index d1a3dcb..11a112c 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/dcae/DcaeConfigurationsCacheTest.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/dcae/DcaeConfigurationsCacheTest.java @@ -37,6 +37,7 @@ public class DcaeConfigurationsCacheTest { securityInfo.setAafUsername("tset11"); dcaeConfigurations.addPubSecInfo("test", securityInfo); DcaeConfigurationsCache.setDcaeConfigurations(dcaeConfigurations); + System.out.println(DcaeConfigurationsCache.getDcaeConfigurations()); assertThat(DcaeConfigurationsCache.getPubSecInfo("test").getAafUsername(), equalTo(securityInfo.getAafUsername())); } -- cgit 1.2.3-korg