X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fdbcapi.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Fservice%2FTopicServiceTest.java;h=575752230de5c0c30021fd94928502aa5686e6a7;hp=0d39350f43930d35f440c7cfb2fba9a50c03ba55;hb=503da874ce876dbe463bcc1a03f63ea0f48fe650;hpb=0afd0dd2f1fa4435fa730a287e68fec4f271e617 diff --git a/src/test/java/org/onap/dmaap/dbcapi/service/TopicServiceTest.java b/src/test/java/org/onap/dmaap/dbcapi/service/TopicServiceTest.java index 0d39350..5757522 100644 --- a/src/test/java/org/onap/dmaap/dbcapi/service/TopicServiceTest.java +++ b/src/test/java/org/onap/dmaap/dbcapi/service/TopicServiceTest.java @@ -26,6 +26,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.List; +import java.util.ArrayList; public class TopicServiceTest { @@ -34,10 +35,13 @@ public class TopicServiceTest { ReflectionHarness rh = new ReflectionHarness(); TopicService ts; + MR_ClusterService mcs; + String locname = "central-onap"; @Before public void setUp() throws Exception { ts = new TopicService(); + mcs = new MR_ClusterService(); } @After @@ -74,27 +78,63 @@ public class TopicServiceTest { } + @Test + public void test3a() { + Topic topic = new Topic(); + ApiError err = new ApiError(); + topic.setTopicName( "test3" ); + topic.setFqtnStyle( FqtnType.Validator("none") ); + topic.getFqtn(); + String t = "org.onap.dmaap.interestingTopic"; + String f = "mrc.onap.org:3904/events/org.onap.dmaap.interestingTopic"; + String c = "publisher"; + String[] a = { "sub", "view" }; + MR_Client sub = new MR_Client( locname, f, c, a ); + String[] b = { "pub", "view" }; + MR_Client pub = new MR_Client( "edge", f, c, b ); + ArrayList clients = new ArrayList(); + + clients.add( sub ); + clients.add( pub ); + + topic.setClients( clients ); + + ts.reviewTopic( topic ); + ts.checkForBridge( topic, err ); + + Topic nTopic = ts.addTopic( topic, err ); + if ( nTopic != null ) { + assertTrue( nTopic.getTopicName().equals( topic.getTopicName() )); + } + + + ts.removeTopic( "test3", err ); + } + @Test public void test4() { List l = ts.getAllTopics(); } -/* @Test public void test5() { - Topic topic = new Topic(); ApiError err = new ApiError(); +/* + +TODO: find a null pointer in here... + String[] hl = { "host1", "host2", "host3" }; + String loc = "central-onap"; + MR_Cluster cluster = new MR_Cluster( loc, "localhost", "", hl ); + mcs.addMr_Cluster( cluster, err ); + Topic topic = new Topic(); topic.setTopicName( "test5" ); topic.setFqtnStyle( FqtnType.Validator("none") ); topic.setReplicationCase( ReplicationType.Validator("none") ); - topic.getFqtn(); + String f = topic.getFqtn(); Topic nTopic = ts.updateTopic( topic, err ); - if ( nTopic != null ) { - assertTrue( nTopic.getTopicName().equals( topic.getTopicName() )); - } - - } */ + assertTrue( err.getCode() == 0 ); + } }