Improve support for http to MR
[dmaap/dbcapi.git] / src / test / java / org / onap / dmaap / dbcapi / testframework / DmaapObjectFactory.java
index 18a397f..0bce106 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.onap.dmaap.dbcapi.model;
+package org.onap.dmaap.dbcapi.testframework;
+
+import org.onap.dmaap.dbcapi.model.DR_Node;
+import org.onap.dmaap.dbcapi.model.DR_Sub;
+import org.onap.dmaap.dbcapi.model.DcaeLocation;
+import org.onap.dmaap.dbcapi.model.Dmaap;
+import org.onap.dmaap.dbcapi.model.FqtnType;
+import org.onap.dmaap.dbcapi.model.MR_Client;
+import org.onap.dmaap.dbcapi.model.MR_Cluster;
+import org.onap.dmaap.dbcapi.model.Topic;
+import org.onap.dmaap.dbcapi.util.RandomInteger;
 
 import static org.junit.Assert.*;
 
@@ -61,6 +71,8 @@ public class DmaapObjectFactory {
        private static final String edge_subnet = "10.10.20.0/24";
        private static final String edge_cluster_fqdn = "localhost";
        private static final String[]hosts = { "host1", "host2", "host3" };
+       private static final String port = "3904";
+       private static final String prot = "http";
 
        public Dmaap genDmaap() {
                return new Dmaap( dmaap_ver, dmaap_topic_root, dmaap_name, dmaap_dr, dmaap_log_url, dmaap_mm_topic, "nk", "ako" );
@@ -76,16 +88,17 @@ public class DmaapObjectFactory {
 
        public MR_Cluster genMR_Cluster( String layer ) {
                if ( layer.contains( "edge" ) ) {
-                       return new MR_Cluster( edge_loc, edge_cluster_fqdn, "ignore", hosts );
+                       return new MR_Cluster( edge_loc, edge_cluster_fqdn,  prot, port );
                }
-               return new MR_Cluster( central_loc, central_cluster_fqdn, "ignore", hosts );
+               return new MR_Cluster( central_loc, central_cluster_fqdn, prot, port );
        }
 
        public Topic genSimpleTopic( String tname ) {
                Topic t = new Topic();
                t.setTopicName( tname );
         t.setFqtnStyle( FqtnType.Validator("none") );
-        t.getFqtn();
+        t.setTopicDescription( "a simple Topic named " + tname );
+        t.setOwner( "ut");
                return t;
        }
 
@@ -117,6 +130,19 @@ public class DmaapObjectFactory {
                }
                return new DR_Sub( central_loc, un, up, feed, du, lu, u100 );
        }
+
+       public DR_Node genDR_Node( String l ) {
+        String version = "1.0.1";
+               RandomInteger ri = new RandomInteger( 1000 );
+               int i = ri.next();
+               String fqdn = String.format( "drns%d.onap.org", i );
+               String host = String.format( "host%d.onap.org", i );
+
+               if ( l.contains( "edge" ) ) {
+                       return new DR_Node( fqdn, edge_loc, host, version );
+               }
+               return new DR_Node( fqdn, central_loc, host, version );
+       }
                                
 
 }