summaryrefslogtreecommitdiffstats
path: root/appc-metric/appc-metric-bundle/src/test
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-02-22 09:51:58 +0000
committerTakamune Cho <takamune.cho@att.com>2019-02-22 16:22:56 +0000
commit6fbff11fd9d6bcf0319aeb8951bcd9c4e80be8d9 (patch)
tree070bc16f1690488ffe993118048ca47e7d77ec38 /appc-metric/appc-metric-bundle/src/test
parenta90eb56177c2e832e71f3329a624583d4ffb36b4 (diff)
Error in ScheduledPublishingPolicyImpl
Fix for error in code that causes failure in a particular case Issue-ID: APPC-1479 Change-Id: If9f8dc21d151ea3e06939ad4db4272f48a8e8b58 Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-metric/appc-metric-bundle/src/test')
-rw-r--r--appc-metric/appc-metric-bundle/src/test/java/org/onap/appc/metricservice/policy/impl/ScheduledPublishingPolicyImplTest.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/appc-metric/appc-metric-bundle/src/test/java/org/onap/appc/metricservice/policy/impl/ScheduledPublishingPolicyImplTest.java b/appc-metric/appc-metric-bundle/src/test/java/org/onap/appc/metricservice/policy/impl/ScheduledPublishingPolicyImplTest.java
index 31c23101d..d33d57184 100644
--- a/appc-metric/appc-metric-bundle/src/test/java/org/onap/appc/metricservice/policy/impl/ScheduledPublishingPolicyImplTest.java
+++ b/appc-metric/appc-metric-bundle/src/test/java/org/onap/appc/metricservice/policy/impl/ScheduledPublishingPolicyImplTest.java
@@ -30,12 +30,10 @@ import org.onap.appc.configuration.Configuration;
import org.onap.appc.configuration.ConfigurationFactory;
import org.onap.appc.metricservice.Publisher;
import org.onap.appc.metricservice.metric.Metric;
-import org.onap.appc.metricservice.metric.impl.DmaapRequestCounterMetricImpl;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
-import com.att.eelf.configuration.EELFLogger;
import org.junit.Assert;
@RunWith(PowerMockRunner.class)
@@ -122,4 +120,17 @@ public class ScheduledPublishingPolicyImplTest {
Assert.assertEquals(1, publishingPolicy.getPublishers().length);
}
+ @Test
+ public void testWithStartTimeOnly() {
+ Properties properties = new Properties();
+ properties.setProperty("schedule.policy.metric.start.time", "1000");
+ Mockito.when(configuration.getProperties()).thenReturn(properties);
+ PolicyBuilderFactoryImpl builderFactory = new PolicyBuilderFactoryImpl();
+ ScheduledPolicyBuilderImpl policyBuilder = (ScheduledPolicyBuilderImpl) builderFactory.scheduledPolicyBuilder();
+ Metric[] metrics = new Metric[0];
+ policyBuilder.withMetrics(metrics);
+ ScheduledPublishingPolicyImpl publishingPolicy = (ScheduledPublishingPolicyImpl) policyBuilder.build();
+ Assert.assertEquals(0, publishingPolicy.metrics().length);
+ }
+
}