diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 58b1f600a73..f070641070f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -83,27 +83,19 @@ test - commons-dbcp.wso2 - commons-dbcp - 1.4.0.wso2v1 - test + commons-dbcp.wso2 + commons-dbcp + test + + + commons-pool.wso2 + commons-pool + test - - commons-pool.wso2 - commons-pool - 1.5.6.wso2v1 - org.wso2.carbon.governance org.wso2.carbon.governance.registry.extensions - 4.7.8 test - - - org.slf4j - jcl-over-slf4j - - org.wso2.carbon.registry diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java index a71d8c01859..e705661daa0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java @@ -252,21 +252,24 @@ public class DeviceTypePluginDAOImpl implements PluginDAO { } private void initializeDbQueries() { - selectDBQueryForGetDevice = "SELECT " + getDeviceTableColumnNames() + " FROM " + - deviceDAODefinition.getDeviceTableName() + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?"; + selectDBQueryForGetDevice = + "SELECT " + getDeviceTableColumnNames() + " FROM " + deviceDAODefinition.getDeviceTableName() + + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?"; - createDBqueryForAddDevice = "INSERT INTO " + deviceDAODefinition.getDeviceTableName() + "(" - + deviceDAODefinition.getPrimaryKey() + " , " + getDeviceTableColumnNames() + ") VALUES (" - + getPreparedInputString(deviceDAODefinition.getColumnNames().size() + 1) + ")"; + createDBqueryForAddDevice = + "INSERT INTO " + deviceDAODefinition.getDeviceTableName() + "(" + deviceDAODefinition.getPrimaryKey() + + " , " + getDeviceTableColumnNames() + ") VALUES (" + getPreparedInputString( + deviceDAODefinition.getColumnNames().size() + 1) + ")"; updateDBQueryForUpdateDevice = "UPDATE " + deviceDAODefinition.getDeviceTableName() + " SET " - + getDeviceTableColumnNamesForUpdateQuery() + " WHERE " + deviceDAODefinition.getPrimaryKey() - + " = ?"; + + getDeviceTableColumnNamesForUpdateQuery() + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?"; - deleteDBQueryToRemoveDevicd = "DELETE FROM " + deviceDAODefinition.getDeviceTableName() - + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?"; + deleteDBQueryToRemoveDevicd = + "DELETE FROM " + deviceDAODefinition.getDeviceTableName() + " WHERE " + deviceDAODefinition + .getPrimaryKey() + " = ?"; - selectDBQueryToGetAllDevice = "SELECT " + getDeviceTableColumnNames() + "," + deviceDAODefinition.getPrimaryKey() + - " FROM " + deviceDAODefinition.getDeviceTableName(); + selectDBQueryToGetAllDevice = + "SELECT " + getDeviceTableColumnNames() + "," + deviceDAODefinition.getPrimaryKey() + " FROM " + + deviceDAODefinition.getDeviceTableName(); } -} \ No newline at end of file +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java index 1ba7f30113e..461b9d9f720 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.wso2.carbon.device.mgt.extensions.device.type.template; import org.testng.Assert; @@ -72,8 +90,7 @@ public class HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest { @Test(description = "This test case tests the enrollment of newly added device type") public void testEnrollDevice() throws DeviceManagementException { String deviceId = "testdevice1"; - Device sampleDevice1 = new Device(deviceId, androidSenseDeviceType, "test", "testdevice", - null, null, null); + Device sampleDevice1 = new Device(deviceId, androidSenseDeviceType, "test", "testdevice", null, null, null); Assert.assertTrue(httpDeviceTypeManagerService.getDeviceManager().enrollDevice(sampleDevice1), "Enrollment of " + androidSenseDeviceType + " device failed"); Assert.assertTrue(httpDeviceTypeManagerService.getDeviceManager() @@ -83,10 +100,10 @@ public class HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest { @Test(description = "This test case tests the populate device management service method") public void testPopulateDeviceManagementService() { - DeviceManagementService deviceManagementService = deviceTypeGeneratorService.populateDeviceManagementService - (sampleDeviceType, deviceTypeMetaDefinition); - Assert.assertEquals(deviceManagementService.getType(), sampleDeviceType, "DeviceTypeGeneration for the " - + "sample device type failed"); + DeviceManagementService deviceManagementService = deviceTypeGeneratorService + .populateDeviceManagementService(sampleDeviceType, deviceTypeMetaDefinition); + Assert.assertEquals(deviceManagementService.getType(), sampleDeviceType, + "DeviceTypeGeneration for the " + "sample device type failed"); } /** @@ -113,8 +130,8 @@ public class HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest { .getPushNotificationProvider(); PushNotificationConfig pushNotificationConfig = new PushNotificationConfig(pushNotificationProvider.getType(), pushNotificationProvider.isScheduled(), null); - org.wso2.carbon.device.mgt.extensions.device.type.template.config.License license = androidSenseDeviceTypeConfiguration - .getLicense(); + org.wso2.carbon.device.mgt.extensions.device.type.template.config.License license = + androidSenseDeviceTypeConfiguration.getLicense(); License androidSenseLicense = new License(); androidSenseLicense.setText(license.getText()); androidSenseLicense.setLanguage(license.getLanguage()); @@ -138,4 +155,3 @@ public class HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest { deviceTypeMetaDefinition.setFeatures(features); } } - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java index 732110f0e43..0e6c37cd1b0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java @@ -151,7 +151,6 @@ public class Utils { deviceDAODefinition = new DeviceDAODefinition(deviceDefinitionTable); } } - } return deviceDAODefinition; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android_sense.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android_sense.xml index 096f0472a12..fbc58a11159 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android_sense.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android_sense.xml @@ -22,29 +22,14 @@ Add Keywords Send keywords to the device - - - - - Add Threshold Send Threshold to the device - - - - - Remove words Remove Threshold from the device - - - - - @@ -62,4 +47,4 @@ This is license text - \ No newline at end of file + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/arduino.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/arduino.xml index d5a44265720..eb12e9ccb33 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/arduino.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/arduino.xml @@ -40,4 +40,4 @@ This is license text - \ No newline at end of file + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/carbon.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/carbon.xml index f24ee57be23..31752cf9b44 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/carbon.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/carbon.xml @@ -1,7 +1,7 @@ - - - - - - - - false - - + + true - admin - - admin - admin - - everyone + admin + + admin + admin + + everyone false 500 - jdbc:h2:target/databasetest/CARBON_TEST - org.h2.Driver - 50 - 60000 - 5 + jdbc:h2:target/databasetest/CARBON_TEST + org.h2.Driver + 50 + 60000 + 5 org.wso2.carbon.user.core.tenant.JDBCTenantManager @@ -62,9 +62,9 @@ true + class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager"> true - + login diff --git a/pom.xml b/pom.xml index 7605ee88d8c..4163efbdffb 100644 --- a/pom.xml +++ b/pom.xml @@ -1538,6 +1538,24 @@ ${power.mock.version} test + + commons-dbcp.wso2 + commons-dbcp + ${commons.dbcp.version} + test + + + org.wso2.carbon.governance + org.wso2.carbon.governance.registry.extensions + ${carbon.governance.version} + test + + + org.slf4j + jcl-over-slf4j + + + @@ -1968,6 +1986,8 @@ 0.7.5.201505241946 1.0b3 1.7.0 + 1.4.0.wso2v1 +