diff options
Diffstat (limited to 'dblib/provider/src/test/java')
-rw-r--r-- | dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/TestDBResourceManager.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/TestDBResourceManager.java b/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/TestDBResourceManager.java new file mode 100644 index 000000000..dca07921b --- /dev/null +++ b/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/TestDBResourceManager.java @@ -0,0 +1,55 @@ +package org.onap.ccsdk.sli.core.dblib; + +import static org.junit.Assert.*; + +import java.io.InputStream; +import java.net.URL; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; + +import ch.vorburger.mariadb4j.DB; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; + +public class TestDBResourceManager { + + DbLibService dblibSvc; + + @Before + public void setUp() throws Exception { + URL propUrl = getClass().getResource("/dblib.properties"); + + InputStream propStr = getClass().getResourceAsStream("/dblib.properties"); + + Properties props = new Properties(); + + props.load(propStr); + + + // Start MariaDB4j database + DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder(); + config.setPort(0); // 0 => autom. detect free port + DB db = DB.newEmbeddedDB(config.build()); + db.start(); + + + // Override jdbc URL and database name + props.setProperty("org.onap.ccsdk.sli.jdbc.database", "test"); + props.setProperty("org.onap.ccsdk.sli.jdbc.url", config.getURL("test")); + + + dblibSvc = new DBResourceManager(props); + + dblibSvc.writeData("CREATE TABLE DBLIB_TEST (name varchar(20));", null, null); + dblibSvc.getData("SELECT * FROM DBLIB_TEST", null, null); + + } + + @Test + public void test() { + + + } + +} |