Adding proper dependency exclusions to poms, making MobileFeatureDAOTestSuite use jdbc pooling instead of dbcp and making testdbconfig.xml to be compliant with platform naming standards

revert-dabc3590
prabathabey 10 years ago
parent 3017d53432
commit 733ae8ed10

@ -90,8 +90,8 @@
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
@ -111,16 +111,20 @@
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
<artifactId>org.wso2.carbon.apimgt.api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.core</artifactId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.wso2</groupId>
<artifactId>jdbc-pool</artifactId>
</dependency>
</dependencies>
</project>

@ -22,69 +22,69 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "DBType")
@XmlRootElement(name = "Type")
public class TestDBConfiguration {
private String connectionUrl;
private String driverClass;
private String userName;
private String pwd;
private String connectionURL;
private String driverClassName;
private String username;
private String password;
@Override public String toString() {
return "TestDBConfiguration{" +
"connectionUrl='" + connectionUrl + '\'' +
", driverClass='" + driverClass + '\'' +
", userName='" + userName + '\'' +
", pwd='" + pwd + '\'' +
", dbType='" + dbType + '\'' +
return "TestDataSourceConfiguration{" +
"ConnectionURL='" + connectionURL + '\'' +
", DriverClassName='" + driverClassName + '\'' +
", Username='" + username + '\'' +
", Password='" + password + '\'' +
", Type='" + dbType + '\'' +
'}';
}
private String dbType;
@XmlElement(name = "connectionurl", nillable = false)
public String getConnectionUrl() {
return connectionUrl;
@XmlElement(name = "ConnectionURL", nillable = false)
public String getConnectionURL() {
return connectionURL;
}
public void setConnectionUrl(String connectionUrl) {
this.connectionUrl = connectionUrl;
public void setConnectionURL(String connectionURL) {
this.connectionURL = connectionURL;
}
@XmlElement(name = "driverclass", nillable = false)
public String getDriverClass() {
return driverClass;
@XmlElement(name = "DriverClassName", nillable = false)
public String getDriverClassName() {
return driverClassName;
}
public void setDriverClass(String driverClass) {
this.driverClass = driverClass;
public void setDriverClassName(String driverClassName) {
this.driverClassName = driverClassName;
}
@XmlElement(name = "userName", nillable = false)
public String getUserName() {
return userName;
@XmlElement(name = "Username", nillable = false)
public String getUsername() {
return username;
}
public void setUserName(String userName) {
this.userName = userName;
public void setUsername(String username) {
this.username = username;
}
@XmlElement(name = "pwd", nillable = false)
public String getPwd() {
return pwd;
@XmlElement(name = "Password", nillable = false)
public String getPassword() {
return password;
}
public void setPwd(String pwd) {
this.pwd = pwd;
public void setPassword(String password) {
this.password = password;
}
@XmlAttribute(name = "typeName")
public String getDbType() {
@XmlAttribute(name = "name")
public String getType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType;
public void setType(String type) {
this.dbType = type;
}
}

@ -18,9 +18,9 @@
package org.wso2.carbon.device.mgt.mobile.impl.dao;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;
@ -36,6 +36,7 @@ import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfiguration;
import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfigurations;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import javax.sql.DataSource;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
@ -67,11 +68,12 @@ public class MobileFeatureDAOTestSuite {
switch (dbType) {
case H2:
createH2DB(testDBConfiguration);
BasicDataSource testDataSource = new BasicDataSource();
testDataSource.setDriverClassName(testDBConfiguration.getDriverClass());
testDataSource.setUrl(testDBConfiguration.getConnectionUrl());
testDataSource.setUsername(testDBConfiguration.getUserName());
testDataSource.setPassword(testDBConfiguration.getPwd());
DataSource testDataSource = new org.apache.tomcat.jdbc.pool.DataSource();
PoolProperties properties = new PoolProperties();
properties.setUrl(testDBConfiguration.getConnectionURL());
properties.setDriverClassName(testDBConfiguration.getDriverClassName());
properties.setUsername(testDBConfiguration.getUsername());
properties.setPassword(testDBConfiguration.getPassword());
mblFeatureDAO = new MobileFeatureDAOImpl(testDataSource);
default:
}
@ -101,7 +103,7 @@ public class MobileFeatureDAOTestSuite {
testDBConfigurations.getDbTypesList().iterator();
while (itrDBConfigs.hasNext()) {
testDBConfiguration = itrDBConfigs.next();
if (testDBConfiguration.getDbType().equals(dbType.toString())) {
if (testDBConfiguration.getType().equals(dbType.toString())) {
break;
}
}
@ -110,8 +112,8 @@ public class MobileFeatureDAOTestSuite {
}
private void createH2DB(TestDBConfiguration testDBConf) throws Exception {
Class.forName(testDBConf.getDriverClass());
conn = DriverManager.getConnection(testDBConf.getConnectionUrl());
Class.forName(testDBConf.getDriverClassName());
conn = DriverManager.getConnection(testDBConf.getConnectionURL());
stmt = conn.createStatement();
stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'");
stmt.close();
@ -129,7 +131,7 @@ public class MobileFeatureDAOTestSuite {
mobileFeature.setName(MBL_FEATURE_NAME);
boolean added = mblFeatureDAO.addMobileFeature(mobileFeature);
try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionUrl());
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
stmt = conn.createStatement();
ResultSet resultSet = stmt
.executeQuery(
@ -158,7 +160,7 @@ public class MobileFeatureDAOTestSuite {
"MobileFeature description has persisted successfully");
}
@Test(dependsOnMethods = { "addMobileFeatureTest" })
@Test(dependsOnMethods = {"addMobileFeatureTest"})
public void getMobileFeatureByCodeTest()
throws MobileDeviceManagementDAOException {
@ -171,12 +173,12 @@ public class MobileFeatureDAOTestSuite {
"MobileFeature description has retrieved successfully");
}
@Test(dependsOnMethods = { "addMobileFeatureTest" })
@Test(dependsOnMethods = {"addMobileFeatureTest"})
public void deleteMobileFeatureByCodeTest()
throws MobileDeviceManagementDAOException {
boolean status = mblFeatureDAO.deleteMobileFeatureByCode(MBL_FEATURE_CODE);
try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionUrl());
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
stmt = conn.createStatement();
ResultSet resultSet = stmt
.executeQuery(
@ -195,7 +197,7 @@ public class MobileFeatureDAOTestSuite {
Assert.assertTrue(status, "MobileFeature has deleted successfully");
}
@Test(dependsOnMethods = { "addMobileFeatureTest" })
@Test(dependsOnMethods = {"addMobileFeatureTest"})
public void getMobileFeatureByIdTest()
throws MobileDeviceManagementDAOException {
@ -208,7 +210,7 @@ public class MobileFeatureDAOTestSuite {
"MobileFeature description has retrieved successfully");
}
@Test(dependsOnMethods = { "addMobileFeatureTest" })
@Test(dependsOnMethods = {"addMobileFeatureTest"})
public void getAllMobileFeaturesTest()
throws MobileDeviceManagementDAOException {
@ -217,13 +219,12 @@ public class MobileFeatureDAOTestSuite {
Assert.assertTrue(mobileFeatures.size() > 0, "MobileFeature list has 1 MobileFeature");
}
@Test(dependsOnMethods = { "addMobileFeatureTest" })
@Test(dependsOnMethods = {"addMobileFeatureTest"})
public void deleteMobileFeatureByIdTest()
throws MobileDeviceManagementDAOException {
boolean status = mblFeatureDAO.deleteMobileFeatureById(mblFeatureId);
try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionUrl());
stmt = conn.createStatement();
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
ResultSet resultSet = stmt
.executeQuery(
"SELECT FEATURE_ID, CODE FROM MBL_FEATURE WHERE FEATURE_ID = " +
@ -242,7 +243,7 @@ public class MobileFeatureDAOTestSuite {
Assert.assertTrue(status, "MobileFeature has deleted successfully");
}
@Test(dependsOnMethods = { "deleteMobileFeatureByCodeTest", "addMobileFeatureTest" })
@Test(dependsOnMethods = {"deleteMobileFeatureByCodeTest", "addMobileFeatureTest"})
public void updateMobileFeatureTest()
throws MobileDeviceManagementDAOException {
@ -254,7 +255,7 @@ public class MobileFeatureDAOTestSuite {
mobileFeature.setId(mblFeatureId);
boolean updated = mblFeatureDAO.updateMobileFeature(mobileFeature);
try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionUrl());
conn = DriverManager.getConnection(testDBConfiguration.getDriverClassName());
stmt = conn.createStatement();
ResultSet resultSet = stmt
.executeQuery(

@ -14,11 +14,11 @@
~ under the License.
-->
<DeviceMgtTestDBConfigurations>
<DBType typeName="H2">
<connectionurl>jdbc:h2:mem:cdm-mobile-test-db;DB_CLOSE_DELAY=-1</connectionurl>
<driverclass>org.h2.Driver</driverclass>
<userName></userName>
<pwd></pwd>
</DBType>
</DeviceMgtTestDBConfigurations>
<TestDataSourceConfigurations>
<Type name="H2">
<ConnectionURL>jdbc:h2:mem:cdm-mobile-test-db;DB_CLOSE_DELAY=-1</ConnectionURL>
<DriverClassName>org.h2.Driver</DriverClassName>
<Username></Username>
<Password></Password>
</Type>
</TestDataSourceConfigurations>

@ -42,7 +42,6 @@
<module>product</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
@ -75,7 +74,6 @@
<version>${stub.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.user.core</artifactId>
@ -96,6 +94,20 @@
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
<version>${carbon.kernel.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.log4j.wso2</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.bootstrap</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
@ -125,7 +137,6 @@
<version>${cdm.core.version}</version>
</dependency>
<!--Osgi dependencies-->
<dependency>
<groupId>org.eclipse.osgi</groupId>
@ -137,21 +148,142 @@
<artifactId>org.eclipse.equinox.common</artifactId>
<version>${eclipse.equinox.common.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>org.beanshell</groupId>
<artifactId>bsh</artifactId>
</exclusion>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
<version>${carbon.kernel.version}</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle.wso2</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.user.api</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.queuing</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.base</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
</exclusion>
<exclusion>
<groupId>org.igniterealtime.smack.wso2</groupId>
<artifactId>smack</artifactId>
</exclusion>
<exclusion>
<groupId>org.igniterealtime.smack.wso2</groupId>
<artifactId>smackx</artifactId>
</exclusion>
<exclusion>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
</exclusion>
<exclusion>
<groupId>commons-fileupload.wso2</groupId>
<artifactId>commons-fileupload</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.ant.wso2</groupId>
<artifactId>ant</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.ant.wso2</groupId>
<artifactId>ant</artifactId>
</exclusion>
<exclusion>
<groupId>commons-httpclient.wso2</groupId>
<artifactId>commons-httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.equinox</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
<version>${carbon.kernel.version}</version>
<exclusions>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.core</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.user.core</artifactId>
</exclusion>
<exclusion>
<groupId>com.hazelcast.wso2</groupId>
<artifactId>hazelcast</artifactId>
</exclusion>
<exclusion>
<groupId>org.bouncycastle.wso2</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina-ha</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents.wso2</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.neethi.wso2</groupId>
<artifactId>neethi</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
</exclusion>
<exclusion>
<groupId>commons-collections.wso2</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.http.helper</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>javax.cache.wso2</artifactId>
</exclusion>
<exclusion>
<groupId>wsdl4j.wso2</groupId>
<artifactId>wsdl4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
@ -177,11 +309,134 @@
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.core</artifactId>
<version>${apim.version}</version>
<exclusions>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.mediation.initializer</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.api</artifactId>
<version>${apim.version}</version>
<exclusions>
<exclusion>
<groupId>com.googlecode.json-simple.wso2</groupId>
<artifactId>json-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
<version>${apim.version}</version>
<exclusions>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.mediation.initializer</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.woden.wso2</groupId>
<artifactId>woden</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.user.core</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.governance.api</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.ws.client</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.identity.core</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.keymgt.client</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.rest.api.stub</artifactId>
</exclusion>
<exclusion>
<groupId>org.json.wso2</groupId>
<artifactId>json</artifactId>
</exclusion>
<exclusion>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.handlers.security.stub</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.user.mgt.stub</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.um.ws.api</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.mediation.dependency.mgt</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.mediation.registry</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.event.core</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.sequences.stub</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.mediation.security.stub</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.indexing</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.keymgt.stub</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.securevault</artifactId>
</exclusion>
<exclusion>
<groupId>com.googlecode.json-simple.wso2</groupId>
<artifactId>json-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.tomcat.wso2</groupId>
@ -198,7 +453,11 @@
<artifactId>org.wso2.carbon.tomcat</artifactId>
<version>${carbon.kernel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.wso2</groupId>
<artifactId>jdbc-pool</artifactId>
<version>${tomcat.jdbc.pooling.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -240,8 +499,9 @@
<eclipse.osgi.version>3.8.1.v20120830-144521</eclipse.osgi.version>
<orbit.version.h2.engine>1.2.140.wso2v3</orbit.version.h2.engine>
<apim.version>1.2.1</apim.version>
<apim.version>4.3.0-SNAPSHOT</apim.version>
<orbit.version.tomcat>7.0.52.wso2v5</orbit.version.tomcat>
<tomcat.jdbc.pooling.version>7.0.34.wso2v2</tomcat.jdbc.pooling.version>
</properties>

Loading…
Cancel
Save