Unit test code changes

merge-requests/1/head
harshanL 10 years ago
parent c4b255b751
commit 84b40f802f

@ -124,5 +124,10 @@
<groupId>org.apache.tomcat.wso2</groupId> <groupId>org.apache.tomcat.wso2</groupId>
<artifactId>jdbc-pool</artifactId> <artifactId>jdbc-pool</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -22,12 +22,12 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.util.List; import java.util.List;
@XmlRootElement(name = "DeviceMgtTestDBConfigurations") @XmlRootElement(name = "TestDataSourceConfigurations")
public class TestDBConfigurations { public class TestDBConfigurations {
private List<TestDBConfiguration> dbTypesList; private List<TestDBConfiguration> dbTypesList;
@XmlElement(name = "DBType") @XmlElement(name = "Type")
public List<TestDBConfiguration> getDbTypesList() { public List<TestDBConfiguration> getDbTypesList() {
return dbTypesList; return dbTypesList;
} }

@ -112,12 +112,16 @@ public class MobileFeatureDAOTestSuite {
} }
private void createH2DB(TestDBConfiguration testDBConf) throws Exception { private void createH2DB(TestDBConfiguration testDBConf) throws Exception {
try {
Class.forName(testDBConf.getDriverClassName()); Class.forName(testDBConf.getDriverClassName());
conn = DriverManager.getConnection(testDBConf.getConnectionURL()); conn = DriverManager.getConnection(testDBConf.getConnectionURL());
stmt = conn.createStatement(); stmt = conn.createStatement();
stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'"); stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'");
} finally {
stmt.close(); stmt.close();
conn.close(); conn.close();
TestUtils.cleanupResources(conn, stmt, null);
}
} }
@Test @Test

Loading…
Cancel
Save