fc96335daf5c160ca3d36e3a3779fee086f03ef0
[sdc.git] / openecomp-be / lib / openecomp-core-lib / openecomp-nosqldb-lib / openecomp-nosqldb-core / src / test / java / org / openecomp / core / nosqldb / NoSqlDbTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.core.nosqldb;
22
23 import com.datastax.driver.core.ResultSet;
24 import com.datastax.driver.core.Row;
25 import org.openecomp.core.nosqldb.api.NoSqlDb;
26 import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
27 import org.testng.Assert;
28 import org.testng.annotations.Test;
29
30 import java.util.List;
31
32
33 public class NoSqlDbTest {
34
35   private static NoSqlDb noSqlDb;
36 /*
37
38   @Test
39   public void testNoSqlDbFactoryFactoryInit() {
40     this.noSqlDb = NoSqlDbFactory.getInstance().createInterface();
41     Assert.assertNotNull(this.noSqlDb);
42     Assert.assertEquals(this.noSqlDb.getClass().getName(),
43         "org.openecomp.core.nosqldb.impl.cassandra.CassandraNoSqlDbImpl");
44   }
45
46   @Test(dependsOnMethods = {"testNoSqlDbFactoryFactoryInit"})
47   public void testCreateTable() {
48     this.noSqlDb.execute("test.drop", null);
49     this.noSqlDb.execute("test.create", null);
50   }
51
52   @Test(dependsOnMethods = {"testCreateTable"})
53   public void testInsertTable() {
54     this.noSqlDb
55         .insert("test", new String[]{"name", "value"}, new String[]{"TestName", "testValue"});
56     this.noSqlDb.execute("test.insert", new String[]{"TestName2", "testValue2"});
57   }
58
59   @Test(dependsOnMethods = {"testInsertTable"})
60   public void gettestSelectTable() {
61     ResultSet result = this.noSqlDb.execute("test.select.all", null);
62     List<Row> rows = result.all();
63     Assert.assertEquals(rows.size(), 2);
64     for (Row row : rows) {
65       System.out.format("%s %s\n", row.getString("name"), row.getString("value"));
66     }
67   }
68
69   */
70 }