added test cases to TestDBResourceManager

to increase code coverage

Issue-ID: CCSDK-595
Change-Id: I8def1aa2e4108f48bc549e63e533f8a63e7a0377
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
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
index dca0792..8d7d343 100644
--- 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
@@ -4,6 +4,7 @@
 
 import java.io.InputStream;
 import java.net.URL;
+import java.sql.SQLException;
 import java.util.Properties;
 
 import org.junit.Before;
@@ -14,42 +15,56 @@
 
 public class TestDBResourceManager {
 
-	DbLibService dblibSvc;
+    DbLibService dblibSvc;
+    DBResourceManager dbm;
 
-	@Before
-	public void setUp() throws Exception {
-		URL propUrl = getClass().getResource("/dblib.properties");
+    @Before
+    public void setUp() throws Exception {
+        URL propUrl = getClass().getResource("/dblib.properties");
 
-		InputStream propStr = getClass().getResourceAsStream("/dblib.properties");
+        InputStream propStr = getClass().getResourceAsStream("/dblib.properties");
 
-		Properties props = new Properties();
+        Properties props = new Properties();
 
-		props.load(propStr);
+        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();
 
-		// 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);
+        dbm = new DBResourceManager(props);
+        dblibSvc.writeData("CREATE TABLE DBLIB_TEST (name varchar(20));", null, null);
+        dblibSvc.getData("SELECT * FROM DBLIB_TEST", null, null);
 
-		// 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"));
+    }
 
+    @Test
+    public void testForceRecovery() {
+        dbm.testForceRecovery();
+    }
 
-		dblibSvc = new DBResourceManager(props);
+    @Test
+    public void testGetConnection() throws SQLException {
+        assertNotNull(dbm.getConnection());
+        assertNotNull(dbm.getConnection("testUser", "testPaswd"));
+    }
 
-		dblibSvc.writeData("CREATE TABLE DBLIB_TEST (name varchar(20));", null, null);
-		dblibSvc.getData("SELECT * FROM DBLIB_TEST", null, null);
+    @Test
+    public void testCleanup() {
+        dbm.cleanUp();
 
-	}
+    }
 
-	@Test
-	public void test() {
-
-
-	}
+    @Test
+    public void testGetLogWriter() throws SQLException {
+        assertNull(dbm.getLogWriter());
+    }
 
 }