1 package org.openecomp.core.nosqldb;
3 import org.openecomp.core.nosqldb.api.NoSqlDb;
5 import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
7 import com.datastax.driver.core.ResultSet;
8 import com.datastax.driver.core.Row;
10 import org.testng.Assert;
11 import org.testng.annotations.Test;
13 import java.util.List;
15 public class NoSqlDbTest {
17 private static NoSqlDb noSqlDb;
21 public void testNoSqlDbFactoryFactoryInit(){
22 this.noSqlDb = NoSqlDbFactory.getInstance().createInterface();
23 Assert.assertNotNull(this.noSqlDb);
24 Assert.assertEquals(this.noSqlDb.getClass().getName(),"org.openecomp.core.nosqldb.impl.cassandra.CassandraNoSqlDbImpl");
27 // @Test(dependsOnMethods = {"testNoSqlDbFactoryFactoryInit"})
28 public void testCreateTable(){
29 this.noSqlDb.execute("test.drop",null);
30 this.noSqlDb.execute("test.create",null);
33 // @Test(dependsOnMethods = {"testCreateTable"})
34 public void testInsertTable(){
35 this.noSqlDb.insert("test",new String[]{"name","value"},new String[]{"TestName","testValue"});
36 this.noSqlDb.execute("test.insert",new String[]{"TestName2","testValue2"});
39 // @Test(dependsOnMethod`s = {"testInsertTable"})
40 public void gettestSelectTable(){
41 ResultSet result = this.noSqlDb.execute("test.select.all",null);
42 List<Row> rows = result.all();
43 Assert.assertEquals(rows.size(),2);
45 System.out.format("%s %s\n", row.getString("name"), row.getString("value"));