aboutsummaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-07-17 18:05:21 +0530
committerPatrick Brady <pb071s@att.com>2018-07-19 19:50:58 +0000
commitb493b1ac7b495cca73f864a4f9835b1a910ac2f1 (patch)
tree40542fd4ca38ede814fa54857062792ecb366324 /appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src
parent90abecd6e1d3d1c673e20a983853f48b10c18276 (diff)
added few test cases to increase code coverage
added few test cases to increase code-coverage for DmaapConsumerImpl.java Issue-ID: APPC-1086 Change-Id: I3cf10a195063a05acf77b01aa2ea66e3da44d179 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src')
-rw-r--r--appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java6
-rw-r--r--appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapConsumerImpl.java35
2 files changed, 34 insertions, 7 deletions
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 40ee1c71f..7291e4603 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
@@ -5,7 +5,9 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
- * =============================================================================
+ * ================================================================================
+ * Modifications Copyright (C) 2018 IBM
+ * ================================================================================
* 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
@@ -117,7 +119,7 @@ public class DmaapConsumerImpl implements Consumer {
/**
* @return An instance of MRConsumer created from our class variables.
*/
- private synchronized MRConsumer getClient(int waitMs, int limit) {
+ synchronized MRConsumer getClient(int waitMs, int limit) {
try {
props.setProperty("timeout", String.valueOf(waitMs));
props.setProperty("limit", String.valueOf(limit));
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapConsumerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapConsumerImpl.java
index e71cb7580..dd76ef6af 100644
--- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapConsumerImpl.java
+++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapConsumerImpl.java
@@ -3,7 +3,9 @@
* ONAP : APPC
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * =============================================================================
+ * ================================================================================
+ * Modifications Copyright (C) 2018 IBM
+ * ================================================================================
* 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
@@ -24,7 +26,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
@@ -33,6 +34,7 @@ import java.util.Properties;
import org.junit.Ignore;
import org.junit.Test;
+
public class TestDmaapConsumerImpl {
String[] hostList = { "192.168.1.1" };
Collection<String> hosts = new HashSet<String>(Arrays.asList(hostList));
@@ -61,6 +63,7 @@ public class TestDmaapConsumerImpl {
@Test
public void testDmaapConsumerImplwithFilter() {
+ filter="";
DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret, filter);
assertNotNull(consumer);
@@ -102,10 +105,14 @@ public class TestDmaapConsumerImpl {
assertEquals("secret", props.getProperty("password"));
}
- @Ignore
+
@Test
public void testFetch() {
- fail("Not yet implemented");
+ DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
+
+ assertNotNull(consumer);
+
+ consumer.fetch(5000,500);
}
@Ignore
@@ -152,5 +159,23 @@ public class TestDmaapConsumerImpl {
assertEquals(true, consumer.isHttps());
}
-
+
+ @Test
+ public void testGetClient()
+ {
+ DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
+ assertNotNull(consumer);
+ consumer.getClient(1000,5);
+ Properties props= consumer.getProperties();
+ assertEquals("1000", props.getProperty("timeout"));
+ assertEquals("5", props.getProperty("limit"));
+ }
+
+ @Test
+ public void testInitMetric()
+ {
+ DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
+ assertNotNull(consumer);
+
+ }
}