summaryrefslogtreecommitdiffstats
path: root/plugins/reception-plugins/src/test/java
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@est.tech>2019-02-05 15:34:35 +0000
committerramverma <ram.krishna.verma@est.tech>2019-02-05 15:34:35 +0000
commitb5f4934afdc2601c925e83458d0e3d136c36cf1c (patch)
tree1217188ee7f3b6194362c5f9fea1acbc8c515a95 /plugins/reception-plugins/src/test/java
parent9255568baf91af0065a5fea1963d19ecfcf90f7a (diff)
Change policy/distribution logging to slf4j
1) Changed logging from FlexLogger to SLF4J with logback 2) Fixed test cases of distribution REST endpoints having infinite while loop Change-Id: I1551873b3d348f9a7d2b4f8dfc3ae5dd6462bdb8 Issue-ID: POLICY-1346 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
Diffstat (limited to 'plugins/reception-plugins/src/test/java')
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java14
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java19
2 files changed, 17 insertions, 16 deletions
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java
index 28408700..fdb01007 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java
@@ -43,11 +43,11 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
import org.onap.policy.distribution.reception.statistics.DistributionStatisticsManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Class to perform unit test of {@link FileSystemReceptionHandler}.
@@ -55,7 +55,7 @@ import org.onap.policy.distribution.reception.statistics.DistributionStatisticsM
@RunWith(MockitoJUnitRunner.class)
public class TestFileSystemReceptionHandler {
- private static final Logger LOGGER = FlexLogger.getLogger(TestFileSystemReceptionHandler.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestFileSystemReceptionHandler.class);
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
@@ -97,7 +97,7 @@ public class TestFileSystemReceptionHandler {
try {
sypHandler.initializeReception(pssdConfigParameters.getName());
} catch (final Exception exp) {
- LOGGER.error(exp);
+ LOGGER.error("testInit failed", exp);
fail("Test should not throw any exception");
}
}
@@ -110,7 +110,7 @@ public class TestFileSystemReceptionHandler {
sypHandler.initializeReception(pssdConfigParameters.getName());
sypHandler.destroy();
} catch (final Exception exp) {
- LOGGER.error(exp);
+ LOGGER.error("testDestroy failed", exp);
fail("Test should not throw any exception");
}
@@ -143,7 +143,7 @@ public class TestFileSystemReceptionHandler {
try {
sypHandler.initFileWatcher(watchPath);
} catch (final IOException ex) {
- LOGGER.error(ex);
+ LOGGER.error("testMain failed", ex);
}
});
@@ -170,7 +170,7 @@ public class TestFileSystemReceptionHandler {
th.interrupt();
th.join();
} catch (final InterruptedException ex) {
- LOGGER.error(ex);
+ LOGGER.error("testMain failed", ex);
}
Mockito.verify(sypHandler, Mockito.times(1)).createPolicyInputAndCallHandler(Mockito.isA(String.class));
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java
index 557a7683..3118f95d 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
+ * Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,8 +45,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.PolicyForwarder;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
@@ -63,6 +62,8 @@ import org.onap.sdc.api.results.IDistributionClientDownloadResult;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.impl.mock.DistributionClientStubImpl;
import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Class to perform unit test of {@link SdcReceptionHandler}.
@@ -72,7 +73,7 @@ import org.onap.sdc.utils.DistributionActionResultEnum;
@RunWith(MockitoJUnitRunner.class)
public class TestSdcReceptionHandler {
- private static final Logger LOGGER = FlexLogger.getLogger(TestSdcReceptionHandler.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestSdcReceptionHandler.class);
private static final String DUMMY_SERVICE_CSAR = "dummyService.csar";
@Mock
@@ -145,7 +146,7 @@ public class TestSdcReceptionHandler {
try {
sypHandler.initializeReception(pssdConfigParameters.getName());
} catch (final Exception exp) {
- LOGGER.error(exp);
+ LOGGER.error("testInitializeSdcClient failed", exp);
fail("Test should not throw any exception");
}
}
@@ -158,7 +159,7 @@ public class TestSdcReceptionHandler {
try {
sypHandler.initializeReception(pssdConfigParameters.getName());
} catch (final Exception exp) {
- LOGGER.error(exp);
+ LOGGER.error("testInitializeSdcClient_Failure failed", exp);
fail("Test should not throw any exception");
}
}
@@ -170,7 +171,7 @@ public class TestSdcReceptionHandler {
.thenReturn(successfulClientInitResult);
sypHandler.initializeReception(pssdConfigParameters.getName());
} catch (final Exception exp) {
- LOGGER.error(exp);
+ LOGGER.error("testStartSdcClient_Failure failed", exp);
fail("Test should not throw any exception");
}
}
@@ -181,7 +182,7 @@ public class TestSdcReceptionHandler {
sypHandler.initializeReception(pssdConfigParameters.getName());
sypHandler.destroy();
} catch (final Exception exp) {
- LOGGER.error(exp);
+ LOGGER.error("testStopSdcClient failed", exp);
fail("Test should not throw any exception");
}
@@ -196,7 +197,7 @@ public class TestSdcReceptionHandler {
try {
sypHandler.destroy();
} catch (final Exception exp) {
- LOGGER.error(exp);
+ LOGGER.error("testStopSdcClient_Failure failed", exp);
fail("Test should not throw any exception");
}
}
@@ -206,7 +207,7 @@ public class TestSdcReceptionHandler {
try {
sypHandler.destroy();
} catch (final Exception exp) {
- LOGGER.error(exp);
+ LOGGER.error("testStopSdcClientWithoutStart", exp);
fail("Test should not throw any exception");
}