summaryrefslogtreecommitdiffstats
path: root/plugins/reception-plugins/src/test
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@ericsson.com>2018-09-14 10:15:40 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-14 10:15:40 +0000
commitdbffbe7e96ae04ca75f0bb143c483c284cd88cb8 (patch)
treeffa5dfaaba021fc713f884c4432f6f358274ce23 /plugins/reception-plugins/src/test
parent4b045ef40ee55394cc0a352c5460573e64be531b (diff)
parenta03bfe0ac168a61a8c34329b2bfb73e360b812e1 (diff)
Merge "Adding statistics endpoint to distribution"
Diffstat (limited to 'plugins/reception-plugins/src/test')
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandler.java14
1 files changed, 14 insertions, 0 deletions
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 231c50ff..bf42476f 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
@@ -57,6 +57,7 @@ import org.onap.policy.distribution.reception.handling.AbstractReceptionHandler;
import org.onap.policy.distribution.reception.handling.PluginHandler;
import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
+import org.onap.policy.distribution.reception.statistics.DistributionStatisticsManager;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
@@ -99,6 +100,7 @@ public class TestSdcReceptionHandler {
*/
@Before
public final void init() throws IOException {
+ DistributionStatisticsManager.resetAllStatistics();
final Gson gson = new GsonBuilder().create();
pssdConfigParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdc.json"),
SdcReceptionHandlerConfigurationParameterGroup.class);
@@ -237,6 +239,12 @@ public class TestSdcReceptionHandler {
assertTrue(policyDecoder.getDecodedPolicy().getPolicyName().contains(DUMMY_SERVICE_CSAR));
assertEquals(1, policyForwarder.getNumberOfPoliciesReceived());
assertTrue(policyForwarder.receivedPolicyWithGivenType(DummyDecoder.DUMMY_POLICY));
+ assertEquals(1, DistributionStatisticsManager.getTotalDistributionCount());
+ assertEquals(1, DistributionStatisticsManager.getDistributionSuccessCount());
+ assertEquals(0, DistributionStatisticsManager.getDistributionFailureCount());
+ assertEquals(1, DistributionStatisticsManager.getTotalDownloadCount());
+ assertEquals(1, DistributionStatisticsManager.getDownloadSuccessCount());
+ assertEquals(0, DistributionStatisticsManager.getDownloadFailureCount());
}
@Test
@@ -260,6 +268,12 @@ public class TestSdcReceptionHandler {
assertEquals(null, policyDecoder.getDecodedPolicy());
assertEquals(0, policyForwarder.getNumberOfPoliciesReceived());
+ assertEquals(1, DistributionStatisticsManager.getTotalDistributionCount());
+ assertEquals(0, DistributionStatisticsManager.getDistributionSuccessCount());
+ assertEquals(1, DistributionStatisticsManager.getDistributionFailureCount());
+ assertEquals(1, DistributionStatisticsManager.getTotalDownloadCount());
+ assertEquals(0, DistributionStatisticsManager.getDownloadSuccessCount());
+ assertEquals(1, DistributionStatisticsManager.getDownloadFailureCount());
}
@Test