import org.junit.Before;
import org.junit.Test;
import java.util.List;
+import java.util.ArrayList;
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
}
+ @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<MR_Client> clients = new ArrayList<MR_Client>();
+
+ 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<Topic> 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 );
+ }
}