From 5cdae4bc7e38c832028cff161979a17e25d0af80 Mon Sep 17 00:00:00 2001 From: Joss Armstrong Date: Tue, 12 Feb 2019 15:21:50 +0000 Subject: Test Coverage in DmaapConsumerImpl Increased coverage Issue-ID: APPC-1415 Change-Id: I29e2d0883914aeec652a47436c86c6ea8e5ab7a5 Signed-off-by: Joss Armstrong --- .../adapter/messaging/dmaap/impl/DmaapConsumerImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main') diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java index 686bb071f..30455201e 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java @@ -8,6 +8,8 @@ * ================================================================================ * Modifications Copyright (C) 2018 IBM * ================================================================================ + * Modifications Copyright (C) 2019 Ericsson + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -53,7 +55,7 @@ import org.osgi.framework.ServiceReference; public class DmaapConsumerImpl implements Consumer { private static final EELFLogger LOG = EELFManager.getInstance().getLogger(DmaapConsumerImpl.class); - private final Configuration configuration = ConfigurationFactory.getConfiguration(); + private Configuration configuration = ConfigurationFactory.getConfiguration(); // Default values private static final int DEFAULT_TIMEOUT_MS = 60000; private static final int DEFAULT_LIMIT = 1000; @@ -93,7 +95,7 @@ public class DmaapConsumerImpl implements Consumer { private void initMetric() { LOG.debug("Metric getting initialized"); - MetricService metricService = getMetricservice(); + MetricService metricService = getMetricService(); if (metricService != null) { metricRegistry = metricService.createRegistry("APPC"); @@ -108,7 +110,10 @@ public class DmaapConsumerImpl implements Consumer { logPublishers[0] = logPublisher; PublishingPolicy manuallyScheduledPublishingPolicy = metricRegistry.policyBuilderFactory() - .scheduledPolicyBuilder().withPublishers(logPublishers).withMetrics(metrics).build(); + .scheduledPolicyBuilder() + .withPublishers(logPublishers) + .withMetrics(metrics) + .build(); LOG.debug("Policy getting initialized"); manuallyScheduledPublishingPolicy.init(); @@ -215,7 +220,7 @@ public class DmaapConsumerImpl implements Consumer { useHttps = yes; } - private MetricService getMetricservice() { + protected MetricService getMetricService() { BundleContext bctx = FrameworkUtil.getBundle(MetricService.class).getBundleContext(); ServiceReference sref = bctx.getServiceReference(MetricService.class.getName()); if (sref != null) { -- cgit 1.2.3-korg