diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2018-08-20 01:58:56 +0530 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-08-21 16:28:36 +0000 |
commit | 9a35bce9c8d64a38d4b18f2d77776e66c4926da6 (patch) | |
tree | b6f281dc361e496ffd4c81a061e74fd138205ccc /appc-adapters | |
parent | 3098bcd71f40750cce76c28ca74f89be1d76c536 (diff) |
added test case to TestDmaapProducerImpl.java
to increase code coveraje
Issue-ID: APPC-1086
Change-Id: I2e507c2df03776fab33b023de6033cdd15e3a6ee
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-adapters')
-rw-r--r-- | appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapProducerImpl.java | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapProducerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapProducerImpl.java index 443cb1596..d37b3fe51 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapProducerImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapProducerImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * 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 @@ -31,23 +33,31 @@ import java.util.HashSet; import java.util.Properties; import java.util.Set; +import org.junit.Before; import org.junit.Ignore; import org.junit.Test; public class TestDmaapProducerImpl { - String[] hostList = { "192.168.1.1" }; - Collection<String> hosts = new HashSet<String>(Arrays.asList(hostList)); + String[] hostList = { "192.168.1.1" }; + Collection<String> hosts = new HashSet<String>(Arrays.asList(hostList)); + + String topic = "JunitTopicOne"; + String group = "junit-client"; + String id = "junit-consumer-one"; + String key = "key"; + String secret = "secret"; + String filter = null; - String topic = "JunitTopicOne"; - String group = "junit-client"; - String id = "junit-consumer-one"; - String key = "key"; - String secret = "secret"; - String filter = null; + private DmaapProducerImpl producer; + + @Before + public void setUp() { + producer = new DmaapProducerImpl(hosts, topic, null, null); + } @Test public void testDmaapProducerImplSingleTopic() { - DmaapProducerImpl producer = new DmaapProducerImpl(hosts, topic, key, secret); + producer = new DmaapProducerImpl(hosts, topic, key, secret); assertNotNull(producer); @@ -64,7 +74,7 @@ public class TestDmaapProducerImpl { String[] topicList = { "topic1", "topic2" }; Set<String> topicNames = new HashSet<String>(Arrays.asList(topicList)); - DmaapProducerImpl producer = new DmaapProducerImpl(hosts, topicNames, key, secret); + producer = new DmaapProducerImpl(hosts, topicNames, key, secret); assertNotNull(producer); @@ -79,8 +89,6 @@ public class TestDmaapProducerImpl { @Test public void testDmaapProducerImplNoUserPass() { - DmaapProducerImpl producer = new DmaapProducerImpl(hosts, topic, null, null); - assertNotNull(producer); Properties props = producer.getProperties(); @@ -93,8 +101,6 @@ public class TestDmaapProducerImpl { @Test public void testUpdateCredentials() { - DmaapProducerImpl producer = new DmaapProducerImpl(hosts, topic, null, null); - assertNotNull(producer); Properties props = producer.getProperties(); @@ -115,15 +121,15 @@ public class TestDmaapProducerImpl { } - @Ignore @Test public void testPost() { - fail("Not yet implemented"); + boolean successful = producer.post("partition", "data"); + assertEquals(true, successful); } @Test public void testCloseNoClient() { - DmaapProducerImpl producer = new DmaapProducerImpl(hosts, topic, key, secret); + producer = new DmaapProducerImpl(hosts, topic, key, secret); assertNotNull(producer); @@ -138,7 +144,7 @@ public class TestDmaapProducerImpl { @Test public void testUseHttps() { - DmaapProducerImpl producer = new DmaapProducerImpl(hosts, topic, key, secret); + producer = new DmaapProducerImpl(hosts, topic, key, secret); assertNotNull(producer); |