Alternative MR replication method
[dmaap/dbcapi.git] / src / test / java / org / onap / dmaap / dbcapi / model / MirrorMakerTest.java
index 1949820..547bfc9 100644 (file)
@@ -24,6 +24,9 @@ import static org.junit.Assert.*;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
+
+import java.util.ArrayList;
 
 
 public class MirrorMakerTest {
@@ -32,12 +35,9 @@ public class MirrorMakerTest {
 
        ReflectionHarness rh = new ReflectionHarness();
 
-       String s, t;
 
        @Before
        public void setUp() throws Exception {
-               s = "source";
-               t = "target";
        }
 
        @After
@@ -52,21 +52,50 @@ public class MirrorMakerTest {
                rh.reflect( "org.onap.dmaap.dbcapi.model.MirrorMaker", "get", null );   
        
        }
-
        @Test
        public void test2() {
-               MirrorMaker m = new MirrorMaker( s, t );
-
 
-               assertTrue( s.equals( m.getSourceCluster() ));
-               assertTrue( t.equals( m.getTargetCluster() ));
+               String v = "Validate";
+               rh.reflect( "org.onap.dmaap.dbcapi.model.MirrorMaker", "set", v );
        }
 
        @Test
        public void test3() {
+               String f = "org.onap.interestingTopic";
+               String c1 =  "cluster1.onap.org";
+               String c2 =  "cluster2.onap.org";
+               MirrorMaker t = new MirrorMaker( c1, c2 );
+               String m = t.getMmName();
+
+               MirrorMaker.genKey( c1, c2 );
+
+               assertTrue( c1.equals( t.getSourceCluster() ));
+               assertTrue( c2.equals( t.getTargetCluster() ));
+       }
+
+
+       @Test
+       public void test4() {
+               String f = "org.onap.interestingTopic";
+               String c1 =  "cluster1.onap.org";
+               String c2 =  "cluster2.onap.org";
+               String p1 = "9092";
+               String p2 = "2081";
+               MirrorMaker t = new MirrorMaker( c1, c2 );
+               String m = t.getMmName();
+       
+
+               ArrayList<String> topics = new ArrayList<String>();
+               topics.add( f );
+               t.setTopics( topics );
+               t.addTopic( "org.onap.topic2" );
+
+               int i = t.getTopicCount();
+
+               String s = t.updateWhiteList();
+
+               s = t.createMirrorMaker(p1, p2);
 
-               String v = "Validate";
-               rh.reflect( "org.onap.dmaap.dbcapi.model.MirrorMaker", "set", v );
        }
 
 }