diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml
index debf13870ac..3690a996484 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml
@@ -139,7 +139,7 @@
file:src/test/resources/log4j.properties
-
+ src/test/resources/testng.xml
src/test/resources/mysql-testng.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/BaseDeviceManagementTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/BaseDeviceManagementTest.java
index ed5bf573b06..b5565814b4e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/BaseDeviceManagementTest.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/BaseDeviceManagementTest.java
@@ -24,6 +24,7 @@ import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.w3c.dom.Document;
import org.wso2.carbon.base.MultitenantConstants;
@@ -68,7 +69,9 @@ public abstract class BaseDeviceManagementTest {
@BeforeSuite
@Parameters({"datasource", "isMock"})
- public void setupDataSource(String datasource, boolean isMock) throws Exception {
+ public void setupDataSource(@Optional("src/test/resources/config/datasource/data-source-config") String datasource,
+ @Optional("false") boolean isMock)
+ throws Exception {
datasourceLocation = datasource;
mock = isMock;
this.initDataSource();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/dao/ApplicationPersistenceTests.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/dao/ApplicationPersistenceTests.java
index 7d697ca6c7e..9e456544449 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/dao/ApplicationPersistenceTests.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/dao/ApplicationPersistenceTests.java
@@ -56,9 +56,11 @@ public class ApplicationPersistenceTests extends BaseDeviceManagementTest {
Assert.fail(msg, e);
}
- Assert.assertEquals(target.getApplicationIdentifier(), testAppIdentifier, "Application added is not as same as " +
- "what's " +
- "retrieved");
+ if (!isMock()) {
+ Assert.assertEquals(target.getApplicationIdentifier(), testAppIdentifier, "Application added is not as same as " +
+ "what's " +
+ "retrieved");
+ }
}
private Application getApplication(String appIdentifier, int tenantId) throws DeviceManagementDAOException {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/mysql-testng.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/mysql-testng.xml
index b96e6007d93..13ec5feeeb7 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/mysql-testng.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/mysql-testng.xml
@@ -31,15 +31,16 @@
-
+
-
-
-
+
+
+
+
@@ -56,6 +57,6 @@
-
-
+
+