diff options
author | sunil.unnava <sunil.unnava@att.com> | 2019-04-02 18:56:40 -0400 |
---|---|---|
committer | sunil.unnava <sunil.unnava@att.com> | 2019-04-02 18:56:57 -0400 |
commit | 49924c6b07a7f9418f04d09f9c94fac8e7d44485 (patch) | |
tree | 4284dc7af194cc0e74b556a25e624d2030ed241b /src/test | |
parent | deaef554cc6ac0025a088b6c11ce82b85fd89083 (diff) |
add testcases
Issue-ID: DMAAP-1140
Change-Id: Ib2a91bd5961050c11f20f8a10f856d21bcda7e30
Signed-off-by: sunil.unnava <sunil.unnava@att.com>
Diffstat (limited to 'src/test')
3 files changed, 65 insertions, 9 deletions
diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/DMaaPKafkaMetaBrokerTest.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/DMaaPKafkaMetaBrokerTest.java index 35f3064..0f4702a 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/DMaaPKafkaMetaBrokerTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/DMaaPKafkaMetaBrokerTest.java @@ -17,7 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.beans; +package org.onap.dmaap.mr.cambria.beans; import static org.junit.Assert.assertTrue; @@ -41,6 +41,7 @@ import org.onap.dmaap.dmf.mr.CambriaApiException; import org.apache.kafka.clients.admin.AdminClient; import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker; +import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker.KafkaTopic; import org.onap.dmaap.dmf.mr.constants.CambriaConstants; import org.onap.dmaap.dmf.mr.metabroker.Topic; import org.onap.dmaap.dmf.mr.metabroker.Broker1.TopicExistsException; @@ -48,9 +49,8 @@ import com.att.nsa.configs.ConfigDb; import com.att.nsa.configs.ConfigDbException; import com.att.nsa.configs.ConfigPath; - @RunWith(PowerMockRunner.class) -@PrepareForTest({ AdminClient.class}) +@PrepareForTest({ AdminClient.class }) public class DMaaPKafkaMetaBrokerTest { @InjectMocks @@ -74,11 +74,28 @@ public class DMaaPKafkaMetaBrokerTest { public void setUp() { MockitoAnnotations.initMocks(this); PowerMockito.mockStatic(AdminClient.class); - //PowerMockito.when(AdminClient.create (any(Properties.class) )).thenReturn(fKafkaAdminClient); - - //PowerMockito.mockStatic(AdminUtils.class); + // PowerMockito.when(AdminClient.create (any(Properties.class) + // )).thenReturn(fKafkaAdminClient); + + // PowerMockito.mockStatic(AdminUtils.class); PowerMockito.when(configDb.parse("/topics")).thenReturn(fBaseTopicData); - + + } + + @Test + public void testBrokercreate() { + DMaaPKafkaMetaBroker broker = new DMaaPKafkaMetaBroker(); + + } + + @Test + public void testcreateTopicEntry() { + try { + KafkaTopic kafkaTopic = new KafkaTopic("topics", configDb, fBaseTopicData); + dMaaPKafkaMetaBroker.createTopicEntry("name", "desc", "owner", true); + } catch (Exception e) { + assertTrue(true); + } } @@ -108,7 +125,6 @@ public class DMaaPKafkaMetaBrokerTest { } } - @Test public void testcreateTopic_wrongPartition() { diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/LogDetailsTest.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/LogDetailsTest.java index 8d83821..8cab96a 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/LogDetailsTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/LogDetailsTest.java @@ -65,6 +65,23 @@ public class LogDetailsTest { assertEquals(details.getSubscriberGroupId(),"1"); } + @Test + public void testPublisherdetails(){ + LogDetails details = new LogDetails(); + assertNotNull(details.getPublisherLogDetails()); + assertNull(details.getTransactionIdTs()); + assertFalse(details.isTransactionEnabled()); + assertEquals(details.getMessageLengthInBytes(),0); + assertNotNull(details.getPublishTimestamp()); + assertNull(details.getMessageTimestamp()); + assertNull(details.getMessageSequence()); + assertNull(details.getMessageBatchId()); + assertNull(details.getPublisherIp()); + assertNull(details.getTopicId()); + + + } + } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/resources/CambriaOutboundEventStreamTest.java b/src/test/java/org/onap/dmaap/mr/cambria/resources/CambriaOutboundEventStreamTest.java index 970bc60..3b556fb 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/resources/CambriaOutboundEventStreamTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/resources/CambriaOutboundEventStreamTest.java @@ -22,6 +22,9 @@ import static org.junit.Assert.*; +import java.io.IOException; + +import org.json.JSONException; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -29,6 +32,7 @@ import org.junit.Test; import org.onap.dmaap.dmf.mr.beans.DMaaPContext; import org.onap.dmaap.dmf.mr.constants.CambriaConstants; import org.onap.dmaap.dmf.mr.resources.CambriaOutboundEventStream; +import org.onap.dmaap.dmf.mr.resources.CambriaOutboundEventStream.operation; public class CambriaOutboundEventStreamTest { @@ -63,7 +67,26 @@ public class CambriaOutboundEventStreamTest { @Test public void testForEachMessage() { - //fail("Not yet implemented"); + try { + coes.forEachMessage(new operation(){ + + @Override + public void onWait() throws IOException { + // TODO Auto-generated method stub + + } + + @Override + public void onMessage(int count, String msg, String transId, long offSet) + throws IOException, JSONException { + // TODO Auto-generated method stub + + } + + }); + } catch (Exception e) { + // TODO Auto-generated catch block + } } @Test |