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

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

@ -18,9 +18,9 @@
package org.wso2.carbon.device.mgt.mobile.impl.dao; 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.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters; 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.impl.common.TestDBConfigurations;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil; import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import javax.sql.DataSource;
import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller; import javax.xml.bind.Unmarshaller;
@ -46,237 +47,237 @@ import java.util.List;
public class MobileFeatureDAOTestSuite { public class MobileFeatureDAOTestSuite {
private static final Log log = LogFactory.getLog(MobileFeatureDAOTestSuite.class); private static final Log log = LogFactory.getLog(MobileFeatureDAOTestSuite.class);
public static final String MBL_FEATURE_NAME = "Camera"; public static final String MBL_FEATURE_NAME = "Camera";
private static final String MBL_FEATURE_CODE = "500A"; private static final String MBL_FEATURE_CODE = "500A";
public static final String MBL_FEATURE_DESCRIPTION = "Camera enable or disable"; public static final String MBL_FEATURE_DESCRIPTION = "Camera enable or disable";
public static final String MBL_FEATURE_UPDATED_CODE = "501B"; public static final String MBL_FEATURE_UPDATED_CODE = "501B";
private TestDBConfiguration testDBConfiguration; private TestDBConfiguration testDBConfiguration;
private Connection conn = null; private Connection conn = null;
private Statement stmt = null; private Statement stmt = null;
private MobileFeatureDAOImpl mblFeatureDAO; private MobileFeatureDAOImpl mblFeatureDAO;
private int mblFeatureId; private int mblFeatureId;
@BeforeClass @BeforeClass
@Parameters("dbType") @Parameters("dbType")
public void setUpDB(String dbTypeStr) throws Exception { public void setUpDB(String dbTypeStr) throws Exception {
DBTypes dbType = DBTypes.valueOf(dbTypeStr); DBTypes dbType = DBTypes.valueOf(dbTypeStr);
testDBConfiguration = getTestDBConfiguration(dbType); testDBConfiguration = getTestDBConfiguration(dbType);
switch (dbType) { switch (dbType) {
case H2: case H2:
createH2DB(testDBConfiguration); createH2DB(testDBConfiguration);
BasicDataSource testDataSource = new BasicDataSource(); DataSource testDataSource = new org.apache.tomcat.jdbc.pool.DataSource();
testDataSource.setDriverClassName(testDBConfiguration.getDriverClass()); PoolProperties properties = new PoolProperties();
testDataSource.setUrl(testDBConfiguration.getConnectionUrl()); properties.setUrl(testDBConfiguration.getConnectionURL());
testDataSource.setUsername(testDBConfiguration.getUserName()); properties.setDriverClassName(testDBConfiguration.getDriverClassName());
testDataSource.setPassword(testDBConfiguration.getPwd()); properties.setUsername(testDBConfiguration.getUsername());
mblFeatureDAO = new MobileFeatureDAOImpl(testDataSource); properties.setPassword(testDBConfiguration.getPassword());
default: mblFeatureDAO = new MobileFeatureDAOImpl(testDataSource);
} default:
} }
}
private TestDBConfiguration getTestDBConfiguration(DBTypes dbType) throws private TestDBConfiguration getTestDBConfiguration(DBTypes dbType) throws
MobileDeviceManagementDAOException, MobileDeviceManagementDAOException,
DeviceManagementException { DeviceManagementException {
File deviceMgtConfig = new File("src/test/resources/testdbconfig.xml"); File deviceMgtConfig = new File("src/test/resources/testdbconfig.xml");
Document doc = null; Document doc = null;
testDBConfiguration = null; testDBConfiguration = null;
TestDBConfigurations testDBConfigurations = null; TestDBConfigurations testDBConfigurations = null;
doc = MobileDeviceManagementUtil.convertToDocument(deviceMgtConfig); doc = MobileDeviceManagementUtil.convertToDocument(deviceMgtConfig);
JAXBContext testDBContext = null; JAXBContext testDBContext = null;
try { try {
testDBContext = JAXBContext.newInstance(TestDBConfigurations.class); testDBContext = JAXBContext.newInstance(TestDBConfigurations.class);
Unmarshaller unmarshaller = testDBContext.createUnmarshaller(); Unmarshaller unmarshaller = testDBContext.createUnmarshaller();
testDBConfigurations = (TestDBConfigurations) unmarshaller.unmarshal(doc); testDBConfigurations = (TestDBConfigurations) unmarshaller.unmarshal(doc);
} catch (JAXBException e) { } catch (JAXBException e) {
throw new MobileDeviceManagementDAOException("Error parsing test db configurations", e); throw new MobileDeviceManagementDAOException("Error parsing test db configurations", e);
} }
Iterator<TestDBConfiguration> itrDBConfigs = Iterator<TestDBConfiguration> itrDBConfigs =
testDBConfigurations.getDbTypesList().iterator(); testDBConfigurations.getDbTypesList().iterator();
while (itrDBConfigs.hasNext()) { while (itrDBConfigs.hasNext()) {
testDBConfiguration = itrDBConfigs.next(); testDBConfiguration = itrDBConfigs.next();
if (testDBConfiguration.getDbType().equals(dbType.toString())) { if (testDBConfiguration.getType().equals(dbType.toString())) {
break; break;
} }
} }
return testDBConfiguration; return testDBConfiguration;
} }
private void createH2DB(TestDBConfiguration testDBConf) throws Exception { private void createH2DB(TestDBConfiguration testDBConf) throws Exception {
Class.forName(testDBConf.getDriverClass()); 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'");
stmt.close(); stmt.close();
conn.close(); conn.close();
} }
@Test @Test
public void addMobileFeatureTest() public void addMobileFeatureTest()
throws MobileDeviceManagementDAOException { throws MobileDeviceManagementDAOException {
MobileFeature mobileFeature = new MobileFeature(); MobileFeature mobileFeature = new MobileFeature();
MobileFeature testMblFeature = new MobileFeature(); MobileFeature testMblFeature = new MobileFeature();
mobileFeature.setCode(MBL_FEATURE_CODE); mobileFeature.setCode(MBL_FEATURE_CODE);
mobileFeature.setDescription(MBL_FEATURE_DESCRIPTION); mobileFeature.setDescription(MBL_FEATURE_DESCRIPTION);
mobileFeature.setName(MBL_FEATURE_NAME); mobileFeature.setName(MBL_FEATURE_NAME);
boolean added = mblFeatureDAO.addMobileFeature(mobileFeature); boolean added = mblFeatureDAO.addMobileFeature(mobileFeature);
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionUrl()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
stmt = conn.createStatement(); stmt = conn.createStatement();
ResultSet resultSet = stmt ResultSet resultSet = stmt
.executeQuery( .executeQuery(
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = '500A'"); "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = '500A'");
while (resultSet.next()) { while (resultSet.next()) {
testMblFeature.setId(resultSet.getInt(1)); testMblFeature.setId(resultSet.getInt(1));
testMblFeature.setCode(resultSet.getString(2)); testMblFeature.setCode(resultSet.getString(2));
testMblFeature.setName(resultSet.getString(3)); testMblFeature.setName(resultSet.getString(3));
testMblFeature.setDescription(resultSet.getString(4)); testMblFeature.setDescription(resultSet.getString(4));
} }
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
log.error("Error in retrieving Mobile Feature data ", e); log.error("Error in retrieving Mobile Feature data ", e);
throw new MobileDeviceManagementDAOException("Error in retrieving Mobile Feature data ", throw new MobileDeviceManagementDAOException("Error in retrieving Mobile Feature data ",
e); e);
} finally { } finally {
TestUtils.cleanupResources(conn, stmt, null); TestUtils.cleanupResources(conn, stmt, null);
} }
mblFeatureId = testMblFeature.getId(); mblFeatureId = testMblFeature.getId();
Assert.assertTrue(added, "MobileFeature is added"); Assert.assertTrue(added, "MobileFeature is added");
Assert.assertEquals(MBL_FEATURE_CODE, testMblFeature.getCode(), Assert.assertEquals(MBL_FEATURE_CODE, testMblFeature.getCode(),
"MobileFeature code has persisted successfully"); "MobileFeature code has persisted successfully");
Assert.assertEquals(MBL_FEATURE_NAME, testMblFeature.getName(), Assert.assertEquals(MBL_FEATURE_NAME, testMblFeature.getName(),
"MobileFeature name has persisted successfully"); "MobileFeature name has persisted successfully");
Assert.assertEquals(MBL_FEATURE_DESCRIPTION, testMblFeature.getDescription(), Assert.assertEquals(MBL_FEATURE_DESCRIPTION, testMblFeature.getDescription(),
"MobileFeature description has persisted successfully"); "MobileFeature description has persisted successfully");
} }
@Test(dependsOnMethods = { "addMobileFeatureTest" }) @Test(dependsOnMethods = {"addMobileFeatureTest"})
public void getMobileFeatureByCodeTest() public void getMobileFeatureByCodeTest()
throws MobileDeviceManagementDAOException { throws MobileDeviceManagementDAOException {
MobileFeature mobileFeature = mblFeatureDAO.getMobileFeatureByCode(MBL_FEATURE_CODE); MobileFeature mobileFeature = mblFeatureDAO.getMobileFeatureByCode(MBL_FEATURE_CODE);
Assert.assertEquals(MBL_FEATURE_CODE, mobileFeature.getCode(), Assert.assertEquals(MBL_FEATURE_CODE, mobileFeature.getCode(),
"MobileFeature code has retrieved successfully"); "MobileFeature code has retrieved successfully");
Assert.assertEquals(MBL_FEATURE_NAME, mobileFeature.getName(), Assert.assertEquals(MBL_FEATURE_NAME, mobileFeature.getName(),
"MobileFeature name has retrieved successfully"); "MobileFeature name has retrieved successfully");
Assert.assertEquals(MBL_FEATURE_DESCRIPTION, mobileFeature.getDescription(), Assert.assertEquals(MBL_FEATURE_DESCRIPTION, mobileFeature.getDescription(),
"MobileFeature description has retrieved successfully"); "MobileFeature description has retrieved successfully");
} }
@Test(dependsOnMethods = { "addMobileFeatureTest" }) @Test(dependsOnMethods = {"addMobileFeatureTest"})
public void deleteMobileFeatureByCodeTest() public void deleteMobileFeatureByCodeTest()
throws MobileDeviceManagementDAOException { throws MobileDeviceManagementDAOException {
boolean status = mblFeatureDAO.deleteMobileFeatureByCode(MBL_FEATURE_CODE); boolean status = mblFeatureDAO.deleteMobileFeatureByCode(MBL_FEATURE_CODE);
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionUrl()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
stmt = conn.createStatement(); stmt = conn.createStatement();
ResultSet resultSet = stmt ResultSet resultSet = stmt
.executeQuery( .executeQuery(
"SELECT FEATURE_ID, CODE FROM MBL_FEATURE WHERE CODE = '500A'"); "SELECT FEATURE_ID, CODE FROM MBL_FEATURE WHERE CODE = '500A'");
while (resultSet.next()) { while (resultSet.next()) {
status = false; status = false;
} }
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
log.error("Error in deleting Mobile Feature data ", e); log.error("Error in deleting Mobile Feature data ", e);
throw new MobileDeviceManagementDAOException("Error in deleting Mobile Feature data ", throw new MobileDeviceManagementDAOException("Error in deleting Mobile Feature data ",
e); e);
} finally { } finally {
TestUtils.cleanupResources(conn, stmt, null); TestUtils.cleanupResources(conn, stmt, null);
} }
Assert.assertTrue(status, "MobileFeature has deleted successfully"); Assert.assertTrue(status, "MobileFeature has deleted successfully");
} }
@Test(dependsOnMethods = { "addMobileFeatureTest" }) @Test(dependsOnMethods = {"addMobileFeatureTest"})
public void getMobileFeatureByIdTest() public void getMobileFeatureByIdTest()
throws MobileDeviceManagementDAOException { throws MobileDeviceManagementDAOException {
MobileFeature mobileFeature = mblFeatureDAO.getMobileFeatureById(mblFeatureId); MobileFeature mobileFeature = mblFeatureDAO.getMobileFeatureById(mblFeatureId);
Assert.assertEquals(MBL_FEATURE_CODE, mobileFeature.getCode(), Assert.assertEquals(MBL_FEATURE_CODE, mobileFeature.getCode(),
"MobileFeature code has retrieved successfully"); "MobileFeature code has retrieved successfully");
Assert.assertEquals(MBL_FEATURE_NAME, mobileFeature.getName(), Assert.assertEquals(MBL_FEATURE_NAME, mobileFeature.getName(),
"MobileFeature name has retrieved successfully"); "MobileFeature name has retrieved successfully");
Assert.assertEquals(MBL_FEATURE_DESCRIPTION, mobileFeature.getDescription(), Assert.assertEquals(MBL_FEATURE_DESCRIPTION, mobileFeature.getDescription(),
"MobileFeature description has retrieved successfully"); "MobileFeature description has retrieved successfully");
} }
@Test(dependsOnMethods = { "addMobileFeatureTest" }) @Test(dependsOnMethods = {"addMobileFeatureTest"})
public void getAllMobileFeaturesTest() public void getAllMobileFeaturesTest()
throws MobileDeviceManagementDAOException { throws MobileDeviceManagementDAOException {
List<MobileFeature> mobileFeatures = mblFeatureDAO.getAllMobileFeatures(); List<MobileFeature> mobileFeatures = mblFeatureDAO.getAllMobileFeatures();
Assert.assertNotNull(mobileFeatures, "MobileFeature list is not null"); Assert.assertNotNull(mobileFeatures, "MobileFeature list is not null");
Assert.assertTrue(mobileFeatures.size() > 0, "MobileFeature list has 1 MobileFeature"); Assert.assertTrue(mobileFeatures.size() > 0, "MobileFeature list has 1 MobileFeature");
} }
@Test(dependsOnMethods = { "addMobileFeatureTest" }) @Test(dependsOnMethods = {"addMobileFeatureTest"})
public void deleteMobileFeatureByIdTest() public void deleteMobileFeatureByIdTest()
throws MobileDeviceManagementDAOException { throws MobileDeviceManagementDAOException {
boolean status = mblFeatureDAO.deleteMobileFeatureById(mblFeatureId); boolean status = mblFeatureDAO.deleteMobileFeatureById(mblFeatureId);
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionUrl()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
stmt = conn.createStatement(); ResultSet resultSet = stmt
ResultSet resultSet = stmt .executeQuery(
.executeQuery( "SELECT FEATURE_ID, CODE FROM MBL_FEATURE WHERE FEATURE_ID = " +
"SELECT FEATURE_ID, CODE FROM MBL_FEATURE WHERE FEATURE_ID = " + mblFeatureId);
mblFeatureId); while (resultSet.next()) {
while (resultSet.next()) { status = false;
status = false; }
} conn.close();
conn.close(); } catch (SQLException e) {
} catch (SQLException e) { log.error("Error in deleting Mobile Feature data ", e);
log.error("Error in deleting Mobile Feature data ", e); throw new MobileDeviceManagementDAOException("Error in deleting Mobile Feature data ",
throw new MobileDeviceManagementDAOException("Error in deleting Mobile Feature data ", e);
e); } finally {
} finally { TestUtils.cleanupResources(conn, stmt, null);
TestUtils.cleanupResources(conn, stmt, null); }
} Assert.assertTrue(status, "MobileFeature has deleted successfully");
Assert.assertTrue(status, "MobileFeature has deleted successfully"); }
}
@Test(dependsOnMethods = { "deleteMobileFeatureByCodeTest", "addMobileFeatureTest" }) @Test(dependsOnMethods = {"deleteMobileFeatureByCodeTest", "addMobileFeatureTest"})
public void updateMobileFeatureTest() public void updateMobileFeatureTest()
throws MobileDeviceManagementDAOException { throws MobileDeviceManagementDAOException {
MobileFeature mobileFeature = new MobileFeature(); MobileFeature mobileFeature = new MobileFeature();
MobileFeature testMblFeature = new MobileFeature(); MobileFeature testMblFeature = new MobileFeature();
mobileFeature.setCode(MBL_FEATURE_UPDATED_CODE); mobileFeature.setCode(MBL_FEATURE_UPDATED_CODE);
mobileFeature.setDescription(MBL_FEATURE_DESCRIPTION); mobileFeature.setDescription(MBL_FEATURE_DESCRIPTION);
mobileFeature.setName(MBL_FEATURE_NAME); mobileFeature.setName(MBL_FEATURE_NAME);
mobileFeature.setId(mblFeatureId); mobileFeature.setId(mblFeatureId);
boolean updated = mblFeatureDAO.updateMobileFeature(mobileFeature); boolean updated = mblFeatureDAO.updateMobileFeature(mobileFeature);
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionUrl()); conn = DriverManager.getConnection(testDBConfiguration.getDriverClassName());
stmt = conn.createStatement(); stmt = conn.createStatement();
ResultSet resultSet = stmt ResultSet resultSet = stmt
.executeQuery( .executeQuery(
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = '" + "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = '" +
MBL_FEATURE_UPDATED_CODE + "'"); MBL_FEATURE_UPDATED_CODE + "'");
while (resultSet.next()) { while (resultSet.next()) {
testMblFeature.setId(resultSet.getInt(1)); testMblFeature.setId(resultSet.getInt(1));
testMblFeature.setCode(resultSet.getString(2)); testMblFeature.setCode(resultSet.getString(2));
testMblFeature.setName(resultSet.getString(3)); testMblFeature.setName(resultSet.getString(3));
testMblFeature.setDescription(resultSet.getString(4)); testMblFeature.setDescription(resultSet.getString(4));
} }
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
log.error("Error in updating Mobile Feature data ", e); log.error("Error in updating Mobile Feature data ", e);
throw new MobileDeviceManagementDAOException("Error in updating Mobile Feature data ", throw new MobileDeviceManagementDAOException("Error in updating Mobile Feature data ",
e); e);
} finally { } finally {
TestUtils.cleanupResources(conn, stmt, null); TestUtils.cleanupResources(conn, stmt, null);
} }
Assert.assertTrue(updated, "MobileFeature has updated"); Assert.assertTrue(updated, "MobileFeature has updated");
Assert.assertEquals(MBL_FEATURE_UPDATED_CODE, testMblFeature.getCode(), Assert.assertEquals(MBL_FEATURE_UPDATED_CODE, testMblFeature.getCode(),
"MobileFeature data has updated successfully"); "MobileFeature data has updated successfully");
} }
} }

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

@ -42,7 +42,6 @@
<module>product</module> <module>product</module>
</modules> </modules>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
@ -75,7 +74,6 @@
<version>${stub.version}</version> <version>${stub.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.user.core</artifactId> <artifactId>org.wso2.carbon.user.core</artifactId>
@ -96,6 +94,20 @@
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId> <artifactId>org.wso2.carbon.logging</artifactId>
<version>${carbon.kernel.version}</version> <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>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
@ -125,7 +137,6 @@
<version>${cdm.core.version}</version> <version>${cdm.core.version}</version>
</dependency> </dependency>
<!--Osgi dependencies--> <!--Osgi dependencies-->
<dependency> <dependency>
<groupId>org.eclipse.osgi</groupId> <groupId>org.eclipse.osgi</groupId>
@ -137,21 +148,142 @@
<artifactId>org.eclipse.equinox.common</artifactId> <artifactId>org.eclipse.equinox.common</artifactId>
<version>${eclipse.equinox.common.version}</version> <version>${eclipse.equinox.common.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<version>${testng.version}</version> <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>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId> <artifactId>org.wso2.carbon.utils</artifactId>
<version>${carbon.kernel.version}</version> <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>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId> <artifactId>org.wso2.carbon.core</artifactId>
<version>${carbon.kernel.version}</version> <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>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
@ -177,11 +309,134 @@
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.core</artifactId> <artifactId>org.wso2.carbon.apimgt.core</artifactId>
<version>${apim.version}</version> <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>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId> <artifactId>org.wso2.carbon.apimgt.impl</artifactId>
<version>${apim.version}</version> <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>
<dependency> <dependency>
<groupId>org.apache.tomcat.wso2</groupId> <groupId>org.apache.tomcat.wso2</groupId>
@ -198,7 +453,11 @@
<artifactId>org.wso2.carbon.tomcat</artifactId> <artifactId>org.wso2.carbon.tomcat</artifactId>
<version>${carbon.kernel.version}</version> <version>${carbon.kernel.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.tomcat.wso2</groupId>
<artifactId>jdbc-pool</artifactId>
<version>${tomcat.jdbc.pooling.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -240,8 +499,9 @@
<eclipse.osgi.version>3.8.1.v20120830-144521</eclipse.osgi.version> <eclipse.osgi.version>3.8.1.v20120830-144521</eclipse.osgi.version>
<orbit.version.h2.engine>1.2.140.wso2v3</orbit.version.h2.engine> <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> <orbit.version.tomcat>7.0.52.wso2v5</orbit.version.tomcat>
<tomcat.jdbc.pooling.version>7.0.34.wso2v2</tomcat.jdbc.pooling.version>
</properties> </properties>

Loading…
Cancel
Save