diff options
author | Michael Lando <ml636r@att.com> | 2017-02-19 12:35:04 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-02-19 12:35:04 +0200 |
commit | f5f13c4f6b6fe3b4d98e349dfd7db59339803436 (patch) | |
tree | 72caffc93fab394ffa3b761505775331f1c559b9 /openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java | |
parent | 451a3400b76511393c62a444f588a4ed15f4a549 (diff) |
push addional code
Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java')
-rw-r--r-- | openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java new file mode 100644 index 0000000000..e53c482b86 --- /dev/null +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java @@ -0,0 +1,48 @@ +package org.openecomp.core.nosqldb; + +import org.openecomp.core.nosqldb.api.NoSqlDb; + +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.Row; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.List; + +public class NoSqlDbTest { + + private static NoSqlDb noSqlDb; + + +// @Test + public void testNoSqlDbFactoryFactoryInit(){ + this.noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + Assert.assertNotNull(this.noSqlDb); + Assert.assertEquals(this.noSqlDb.getClass().getName(),"org.openecomp.core.nosqldb.impl.cassandra.CassandraNoSqlDbImpl"); + } + +// @Test(dependsOnMethods = {"testNoSqlDbFactoryFactoryInit"}) + public void testCreateTable(){ + this.noSqlDb.execute("test.drop",null); + this.noSqlDb.execute("test.create",null); + } + +// @Test(dependsOnMethods = {"testCreateTable"}) + public void testInsertTable(){ + this.noSqlDb.insert("test",new String[]{"name","value"},new String[]{"TestName","testValue"}); + this.noSqlDb.execute("test.insert",new String[]{"TestName2","testValue2"}); + } + +// @Test(dependsOnMethod`s = {"testInsertTable"}) + public void gettestSelectTable(){ + ResultSet result = this.noSqlDb.execute("test.select.all",null); + List<Row> rows = result.all(); + Assert.assertEquals(rows.size(),2); + for (Row row:rows){ + System.out.format("%s %s\n", row.getString("name"), row.getString("value")); + } + } +} |