Refactoring

revert-70aa11f8
megala21 7 years ago
parent 6637c63c6b
commit eff3efb72c

@ -85,25 +85,17 @@
<dependency>
<groupId>commons-dbcp.wso2</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4.0.wso2v1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-pool.wso2</groupId>
<artifactId>commons-pool</artifactId>
<version>1.5.6.wso2v1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.registry.extensions</artifactId>
<version>4.7.8</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon.registry</groupId>

@ -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();
}
}

@ -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);
}
}

@ -151,7 +151,6 @@ public class Utils {
deviceDAODefinition = new DeviceDAODefinition(deviceDefinitionTable);
}
}
}
return deviceDAODefinition;
}

@ -22,29 +22,14 @@
<Feature code="keywords">
<Name>Add Keywords</Name>
<Description>Send keywords to the device</Description>
<!--<Operation context="/android_sense/device/{deviceId}/words" method="POST">-->
<!--<QueryParameters>-->
<!--<Parameter>keywords</Parameter>-->
<!--</QueryParameters>-->
<!--</Operation>-->
</Feature>
<Feature code="threshold">
<Name>Add Threshold</Name>
<Description>Send Threshold to the device</Description>
<!--<Operation context="/android_sense/device/{deviceId}/words/threshold" method="POST">-->
<!--<QueryParameters>-->
<!--<Parameter>threshold</Parameter>-->
<!--</QueryParameters>-->
<!--</Operation>-->
</Feature>
<Feature code="remove_words">
<Name>Remove words</Name>
<Description>Remove Threshold from the device</Description>
<!--<Operation context="/android_sense/device/{deviceId}/words" method="DELETE">-->
<!--<QueryParameters>-->
<!--<Parameter>words</Parameter>-->
<!--</QueryParameters>-->
<!--</Operation>-->
</Feature>
</Features>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2005-2017 WSO2 Inc. (http://wso2.com)
~ Copyright 2017 WSO2 Inc. (http://wso2.com)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2005-2017 WSO2 Inc. (http://wso2.com)
~ Copyright 2017 WSO2 Inc. (http://wso2.com)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@ -37,62 +37,6 @@
<minIdle>5</minIdle>
</dbConfig>
<!--<handler class="org.wso2.carbon.registry.extensions.handlers.SynapseRepositoryHandler">
<filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
<property name="mediaType">application/vnd.apache.synapse</property>
</filter>
</handler>
<handler class="org.wso2.carbon.registry.extensions.handlers.SynapseRepositoryHandler">
<filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
<property name="mediaType">application/vnd.apache.esb</property>
</filter>
</handler>
<handler class="org.wso2.carbon.registry.extensions.handlers.Axis2RepositoryHandler">
<filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
<property name="mediaType">application/vnd.apache.axis2</property>
</filter>
</handler>
<handler class="org.wso2.carbon.registry.extensions.handlers.Axis2RepositoryHandler">
<filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
<property name="mediaType">application/vnd.apache.wsas</property>
</filter>
</handler>
<handler class="org.wso2.carbon.registry.extensions.handlers.WSDLMediaTypeHandler">
<filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
<property name="mediaType">application/wsdl+xml</property>
</filter>
</handler>
<handler class="org.wso2.carbon.registry.extensions.handlers.XSDMediaTypeHandler">
<filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
<property name="mediaType">application/x-xsd+xml</property>
</filter>
</handler> -->
<!--remoteInstance url="https://localhost:9443/registry">
<id>instanceid</id>
<username>username</username>
<password>password</password>
</remoteInstance-->
<!--remoteInstance url="https://localhost:9443/registry">
<id>instanceid</id>
<dbConfig>wso2registry</dbConfig>
<readOnly>false</readOnly>
<enableCache>true</enableCache>
<registryRoot>/</registryRoot>
</remoteInstance-->
<!--mount path="/_system/config" overwrite="true|false|virtual">
<instanceId>instanceid</instanceId>
<targetPath>/_system/nodes</targetPath>
</mount-->
<versionResourcesOnChange>false</versionResourcesOnChange>
<!-- NOTE: You can edit the options under "StaticConfiguration" only before the

@ -1,5 +1,5 @@
<!--
~ Copyright (c) 2005-2011, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ 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

@ -1538,6 +1538,24 @@
<version>${power.mock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-dbcp.wso2</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commons.dbcp.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.registry.extensions</artifactId>
<version>${carbon.governance.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
@ -1968,6 +1986,8 @@
<jacoco.ant.verision>0.7.5.201505241946</jacoco.ant.verision>
<ant.contrib.version>1.0b3</ant.contrib.version>
<power.mock.version>1.7.0</power.mock.version>
<commons.dbcp.version>1.4.0.wso2v1</commons.dbcp.version>
</properties>
</project>

Loading…
Cancel
Save