diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml
index 850525cc3..3fc481638 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml
@@ -124,5 +124,10 @@
org.apache.tomcat.wso2
jdbc-pool
+
+ com.h2database.wso2
+ h2-database-engine
+ test
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfigurations.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfigurations.java
index 42a6fcf4d..ab7c18a46 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfigurations.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfigurations.java
@@ -22,12 +22,12 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
-@XmlRootElement(name = "DeviceMgtTestDBConfigurations")
+@XmlRootElement(name = "TestDataSourceConfigurations")
public class TestDBConfigurations {
private List dbTypesList;
- @XmlElement(name = "DBType")
+ @XmlElement(name = "Type")
public List getDbTypesList() {
return dbTypesList;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileFeatureDAOTestSuite.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileFeatureDAOTestSuite.java
index 1d62d1b78..070b3c7b5 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileFeatureDAOTestSuite.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileFeatureDAOTestSuite.java
@@ -112,12 +112,16 @@ public class MobileFeatureDAOTestSuite {
}
private void createH2DB(TestDBConfiguration testDBConf) throws Exception {
- Class.forName(testDBConf.getDriverClassName());
- conn = DriverManager.getConnection(testDBConf.getConnectionURL());
- stmt = conn.createStatement();
- stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'");
- stmt.close();
- conn.close();
+ try {
+ Class.forName(testDBConf.getDriverClassName());
+ conn = DriverManager.getConnection(testDBConf.getConnectionURL());
+ stmt = conn.createStatement();
+ stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'");
+ } finally {
+ stmt.close();
+ conn.close();
+ TestUtils.cleanupResources(conn, stmt, null);
+ }
}
@Test