diff options
Diffstat (limited to 'components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/DbTest.java')
-rw-r--r-- | components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/DbTest.java | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/DbTest.java b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/DbTest.java index 81a7560c..0accf5a8 100644 --- a/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/DbTest.java +++ b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/DbTest.java @@ -20,6 +20,7 @@ package org.onap.datalake.feeder.domain; import org.junit.Test; +import org.onap.datalake.feeder.util.TestUtil; import java.util.HashSet; import java.util.Set; @@ -40,15 +41,29 @@ public class DbTest { @Test public void testIs() { - Db couchbase = new Db("Couchbase"); - Db mongoDB = new Db("MongoDB"); - Db mongoDB2 = new Db("MongoDB"); + Db couchbase = TestUtil.newDb("Couchbase"); + Db mongoDB = TestUtil.newDb("MongoDB"); + Db mongoDB2 = TestUtil.newDb("MongoDB"); assertNotEquals(couchbase.hashCode(), mongoDB.hashCode()); assertNotEquals(couchbase, mongoDB); - assertEquals(mongoDB, mongoDB2); - assertFalse(mongoDB2.equals(null)); - assertFalse(mongoDB2.equals(new Topic())); + assertNotEquals(mongoDB, mongoDB2); + assertEquals(mongoDB, mongoDB); + assertFalse(mongoDB2.equals(null)); + + DbType dbType = new DbType("MONGO", "MongoDB"); + dbType.setTool(false); + mongoDB.setDbType(dbType); + assertNotEquals(mongoDB2, dbType); + assertFalse(mongoDB.isTool()); + assertFalse(mongoDB.isHdfs()); + assertFalse(mongoDB.isElasticsearch()); + assertFalse(mongoDB.isCouchbase()); + assertFalse(mongoDB.isDruid()); + assertTrue(mongoDB.isMongoDB()); + assertFalse(mongoDB.getDbType().isTool()); + System.out.println(mongoDB); + new Db(); mongoDB2.setHost("localhost"); mongoDB2.setPort(1234); @@ -60,7 +75,9 @@ public class DbTest { mongoDB2.setProperty2("property2"); mongoDB2.setProperty3("property3"); Set<Topic> hash_set = new HashSet<>(); - hash_set.add(new Topic("topic1")); + Topic topic = TestUtil.newTopic("topic1"); + topic.setId(1); + hash_set.add(topic); mongoDB2.setTopics(hash_set); assertTrue("localhost".equals(mongoDB2.getHost())); assertFalse("1234".equals(mongoDB2.getPort())); |