From a2a46a3439702bebf22b75b34a7856ddea257aa8 Mon Sep 17 00:00:00 2001 From: charitha Date: Thu, 16 Nov 2017 21:10:28 +0530 Subject: [PATCH] Add siddhi extensions to reflect get methods in device management core service --- .../pom.xml | 23 +-- .../GetDevicesOfStatusFunctionExecutor.java | 132 ++++++++++++++ .../GetDevicesOfUserFunctionExecutor.java | 143 +++++++++++++++ .../HasDevicesOfStatusFunctionExecutor.java | 134 ++++++++++++++ .../HasDevicesOfUserFunctionExecutor.java | 147 +++++++++++++++ .../device/IsEnrolledFunctionExecutor.java | 122 +++++++++++++ .../device/IsInGroupFunctionExecutor.java} | 32 ++-- .../siddhi/device/utils/DeviceUtils.java} | 45 ++--- .../src/main/resources/device.siddhiext} | 9 +- .../device}/BaseDeviceManagementTest.java | 6 +- .../siddhi/device/ExtensionTestCase.java} | 168 ++++++++++++++---- .../device}/test/util/DataSourceConfig.java | 2 +- .../device}/test/util/SiddhiTestHelper.java | 2 +- .../device}/test/util/TestDataHolder.java | 4 +- .../util/TestDeviceManagementService.java | 2 +- .../device}/test/util/TestDeviceManager.java | 2 +- .../siddhi/device}/test/util/TestUtils.java | 2 +- .../resources/carbon-home/dbscripts/h2.sql | 0 .../repository/conf/axis2/axis2.xml | 0 .../repository/conf/axis2/axis2_client.xml | 0 .../repository/conf/axis2/tenant-axis2.xml | 0 .../carbon-home/repository/conf/carbon.xml | 0 .../repository/conf/cdm-config.xml | 0 .../conf/datasources/master-datasources.xml | 0 .../conf/etc/bundle-config/README.txt | 0 .../carboncontext-osgi-services.properties | 0 .../repository/conf/etc/config-validation.xml | 0 .../carbon-home/repository/conf/etc/jmx.xml | 0 .../repository/conf/etc/launch.ini | 0 .../conf/etc/logging-bridge.properties | 0 .../repository/conf/etc/mime.mappings | 0 .../repository/conf/etc/mime.types | 0 .../repository/conf/etc/osgi-debug.options | 0 .../repository/conf/log4j.properties | 0 .../carbon-home/repository/conf/registry.xml | 0 .../conf/security/authenticators.xml | 0 .../conf/tomcat/carbon/META-INF/context.xml | 0 .../conf/tomcat/carbon/WEB-INF/web.xml | 0 .../conf/tomcat/catalina-server.xml | 0 .../repository/conf/tomcat/tomcat-users.xml | 0 .../repository/conf/tomcat/web.xml | 0 .../carbon-home/repository/conf/user-mgt.xml | 0 .../config/datasource/data-source-config.xml | 0 .../src/test/resources/log4j.properties | 0 .../src/test/resources/sql/h2.sql | 0 .../src/test/resources/testng.xml | 4 +- .../user-test/user-mgt-registry-test.xml | 0 .../extensions/siddhi-extensions/pom.xml | 2 +- 48 files changed, 884 insertions(+), 97 deletions(-) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/pom.xml (89%) create mode 100644 components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/GetDevicesOfStatusFunctionExecutor.java create mode 100644 components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/GetDevicesOfUserFunctionExecutor.java create mode 100644 components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/HasDevicesOfStatusFunctionExecutor.java create mode 100644 components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/HasDevicesOfUserFunctionExecutor.java create mode 100644 components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/IsEnrolledFunctionExecutor.java rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/main/java/org/wso2/extension/siddhi/devicegroup/IsDeviceInGroupFunctionExecutor.java => org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/IsInGroupFunctionExecutor.java} (83%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/main/java/org/wso2/extension/siddhi/devicegroup/utils/DeviceGroupUtils.java => org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/utils/DeviceUtils.java} (54%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/main/resources/devicegroup.siddhiext => org.wso2.extension.siddhi.device/src/main/resources/device.siddhiext} (53%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup => org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device}/BaseDeviceManagementTest.java (96%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/CheckDeviceInGroupExtensionTestCase.java => org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/ExtensionTestCase.java} (50%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup => org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device}/test/util/DataSourceConfig.java (97%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup => org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device}/test/util/SiddhiTestHelper.java (95%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup => org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device}/test/util/TestDataHolder.java (97%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup => org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device}/test/util/TestDeviceManagementService.java (98%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup => org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device}/test/util/TestDeviceManager.java (98%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup => org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device}/test/util/TestUtils.java (98%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/dbscripts/h2.sql (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/axis2/axis2_client.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/axis2/tenant-axis2.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/carbon.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/cdm-config.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/datasources/master-datasources.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/etc/bundle-config/README.txt (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/etc/carboncontext-osgi-services.properties (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/etc/config-validation.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/etc/jmx.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/etc/launch.ini (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/etc/logging-bridge.properties (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/etc/mime.mappings (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/etc/mime.types (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/etc/osgi-debug.options (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/log4j.properties (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/registry.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/security/authenticators.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/tomcat/carbon/META-INF/context.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/tomcat/carbon/WEB-INF/web.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/tomcat/catalina-server.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/tomcat/tomcat-users.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/tomcat/web.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/carbon-home/repository/conf/user-mgt.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/config/datasource/data-source-config.xml (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/log4j.properties (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/sql/h2.sql (100%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/testng.xml (83%) rename components/extensions/siddhi-extensions/{org.wso2.extension.siddhi.devicegroup => org.wso2.extension.siddhi.device}/src/test/resources/user-test/user-mgt-registry-test.xml (100%) diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml similarity index 89% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/pom.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml index ba4de2247..996094ec1 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml @@ -25,9 +25,9 @@ 4.0.0 - org.wso2.extension.siddhi.devicegroup + org.wso2.extension.siddhi.device bundle - WSO2 Siddhi Execution Extension - Check device belongs to a group + WSO2 Siddhi Execution Extension - Device management Core functionality as Siddhi extension http://wso2.org @@ -51,6 +51,10 @@ log4j log4j + + org.json.wso2 + json + com.h2database.wso2 h2-database-engine @@ -91,16 +95,6 @@ commons-logging-api RELEASE - - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.appmgt.mdm.restconnector - 4.0.91-SNAPSHOT - - - asm - asm - RELEASE - asm asm @@ -127,10 +121,11 @@ ${project.artifactId} ${project.artifactId} - org.wso2.extension.siddhi.devicegroup, - org.wso2.extension.siddhi.devicegroup.* + org.wso2.extension.siddhi.device, + org.wso2.extension.siddhi.device.* + org.json;version="${orbit.version.json.range}", org.wso2.siddhi.core.*, org.wso2.siddhi.query.api.*, org.wso2.carbon.device.mgt.core.*, diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/GetDevicesOfStatusFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/GetDevicesOfStatusFunctionExecutor.java new file mode 100644 index 000000000..032021890 --- /dev/null +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/GetDevicesOfStatusFunctionExecutor.java @@ -0,0 +1,132 @@ +/* + * 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.extension.siddhi.device; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.EnrolmentInfo; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.extension.siddhi.device.utils.DeviceUtils; +import org.wso2.siddhi.core.config.ExecutionPlanContext; +import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException; +import org.wso2.siddhi.core.executor.ExpressionExecutor; +import org.wso2.siddhi.core.executor.function.FunctionExecutor; +import org.wso2.siddhi.query.api.definition.Attribute; +import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException; + +import java.util.List; + +/** + * getDevicesOfStatus(status [, deviceType]) + * Returns devices with specified status + * Accept Type(s): (STRING, STRING) + * Return Type(s): (STRING) + */ +public class GetDevicesOfStatusFunctionExecutor extends FunctionExecutor { + + private static Log log = LogFactory.getLog(GetDevicesOfStatusFunctionExecutor.class); + private Attribute.Type returnType = Attribute.Type.STRING; + + @Override + protected void init(ExpressionExecutor[] attributeExpressionExecutors, + ExecutionPlanContext executionPlanContext) { + if (attributeExpressionExecutors.length != 1 && attributeExpressionExecutors.length != 2) { + throw new ExecutionPlanValidationException( + "Invalid no of arguments passed to device:getDevicesOfStatus() function, required 2 but found " + + attributeExpressionExecutors.length); + } + if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the first argument (status) of device:getDevicesOfStatus() " + + "function, required " + Attribute.Type.STRING + " as status, but found " + + attributeExpressionExecutors[0].getReturnType().toString()); + } + if (attributeExpressionExecutors.length == 2 + && attributeExpressionExecutors[1].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the second argument (device type) of device:getDevicesOfStatus() " + + "function, required " + Attribute.Type.STRING + " as device type, but found " + + attributeExpressionExecutors[1].getReturnType().toString()); + } + } + + @Override + protected Object execute(Object[] data) { + if (data[0] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:getDevicesOfStatus() function. " + + "First argument cannot be null"); + } + if (data.length == 2 && data[1] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:getDevicesOfStatus() function. " + + "Second argument cannot be null"); + } + String status = (String) data[0]; + String deviceType = null; + if (data.length == 2) { + deviceType = (String) data[1]; + } + + JSONArray deviceIds = new JSONArray(); + try { + DeviceManagementProviderService deviceManagementProviderService = DeviceUtils.getDeviceManagementProviderService(); + List devices = deviceManagementProviderService.getDevicesByStatus(EnrolmentInfo.Status.valueOf(status), false); + for (Device device : devices) { + if (deviceType == null || deviceType.equalsIgnoreCase(device.getType())) { + deviceIds.put(device.getDeviceIdentifier()); + } + } + } catch (DeviceManagementException e) { + log.error("Error occurred while getting devices with status " + status, e); + } + return deviceIds.toString(); + } + + @Override + protected Object execute(Object data) { + return execute(new Object[]{data}); + } + + @Override + public void start() { + //Nothing to start + } + + @Override + public void stop() { + //Nothing to stop + } + + @Override + public Attribute.Type getReturnType() { + return returnType; + } + + @Override + public Object[] currentState() { + return null; //No need to maintain a state. + } + + @Override + public void restoreState(Object[] state) { + //Since there's no need to maintain a state, nothing needs to be done here. + } +} diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/GetDevicesOfUserFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/GetDevicesOfUserFunctionExecutor.java new file mode 100644 index 000000000..27a82530e --- /dev/null +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/GetDevicesOfUserFunctionExecutor.java @@ -0,0 +1,143 @@ +/* + * 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.extension.siddhi.device; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.extension.siddhi.device.utils.DeviceUtils; +import org.wso2.siddhi.core.config.ExecutionPlanContext; +import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException; +import org.wso2.siddhi.core.executor.ExpressionExecutor; +import org.wso2.siddhi.core.executor.function.FunctionExecutor; +import org.wso2.siddhi.query.api.definition.Attribute; +import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException; + +import java.util.List; + +/** + * getDevicesOfUser(user , deviceType [, status]) + * Returns list of ids of devices belongs to a user + * Accept Type(s): (STRING, STRING, STRING) + * Return Type(s): (STRING) + */ +public class GetDevicesOfUserFunctionExecutor extends FunctionExecutor { + + private static Log log = LogFactory.getLog(GetDevicesOfUserFunctionExecutor.class); + private Attribute.Type returnType = Attribute.Type.STRING; + + @Override + protected void init(ExpressionExecutor[] attributeExpressionExecutors, + ExecutionPlanContext executionPlanContext) { + if (attributeExpressionExecutors.length != 2 && attributeExpressionExecutors.length != 3) { + throw new ExecutionPlanValidationException( + "Invalid no of arguments passed to device:getDevicesOfUser() function, minimum 2, or 3 with " + + "optional. but found " + attributeExpressionExecutors.length); + } + if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the first argument (user) of device:getDevicesOfUser() " + + "function, required " + Attribute.Type.STRING + " as user, but found " + + attributeExpressionExecutors[0].getReturnType().toString()); + } + if (attributeExpressionExecutors[1].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the second argument (device type) of device:getDevicesOfUser() " + + "function, required " + Attribute.Type.STRING + " as device type, but found " + + attributeExpressionExecutors[1].getReturnType().toString()); + } + if (attributeExpressionExecutors.length == 3 + && attributeExpressionExecutors[2].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid optional parameter type found for the third argument (status) of " + + "device:getDevicesOfUser() function, required " + Attribute.Type.STRING + " as status, but found " + + attributeExpressionExecutors[2].getReturnType().toString()); + } + } + + @Override + protected Object execute(Object[] data) { + if (data[0] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:getDevicesOfUser() function. " + + "First argument cannot be null"); + } + if (data[1] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:getDevicesOfUser() function. " + + "Second argument cannot be null"); + } + if (data.length == 3 && data[2] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:getDevicesOfUser() function. " + + "Third argument cannot be null"); + } + String user = (String) data[0]; + String deviceType = (String) data[1]; + String status = null; + if (data.length == 3) { + status = (String) data[2]; + } + + JSONArray deviceIds = new JSONArray(); + try { + DeviceManagementProviderService deviceManagementProviderService = DeviceUtils.getDeviceManagementProviderService(); + List devices = deviceManagementProviderService.getDevicesOfUser(user, deviceType, false); + for (Device device : devices) { + if (status == null || status.equalsIgnoreCase(device.getEnrolmentInfo().getStatus().toString())) { + deviceIds.put(device.getDeviceIdentifier()); + } + } + } catch (DeviceManagementException e) { + log.error("Error occurred while getting " + deviceType + " devices of user " + user + + ", with status " + status, e); + } + return deviceIds.toString(); + } + + @Override + protected Object execute(Object data) { + return null; //Since the getDevicesOfUser function takes in 2 or 3 parameters, this method does not get called. Hence,not implemented. + } + + @Override + public void start() { + //Nothing to start + } + + @Override + public void stop() { + //Nothing to stop + } + + @Override + public Attribute.Type getReturnType() { + return returnType; + } + + @Override + public Object[] currentState() { + return null; //No need to maintain a state. + } + + @Override + public void restoreState(Object[] state) { + //Since there's no need to maintain a state, nothing needs to be done here. + } +} diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/HasDevicesOfStatusFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/HasDevicesOfStatusFunctionExecutor.java new file mode 100644 index 000000000..944394a1b --- /dev/null +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/HasDevicesOfStatusFunctionExecutor.java @@ -0,0 +1,134 @@ +/* + * 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.extension.siddhi.device; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.EnrolmentInfo; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.extension.siddhi.device.utils.DeviceUtils; +import org.wso2.siddhi.core.config.ExecutionPlanContext; +import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException; +import org.wso2.siddhi.core.executor.ExpressionExecutor; +import org.wso2.siddhi.core.executor.function.FunctionExecutor; +import org.wso2.siddhi.query.api.definition.Attribute; +import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException; + +import java.util.List; + +/** + * hasDevicesOfStatus(status [, deviceType]) + * Returns true if there are devices with specified status + * Accept Type(s): (STRING, STRING) + * Return Type(s): (BOOL) + */ +public class HasDevicesOfStatusFunctionExecutor extends FunctionExecutor { + + private static Log log = LogFactory.getLog(HasDevicesOfStatusFunctionExecutor.class); + private Attribute.Type returnType = Attribute.Type.BOOL; + + @Override + protected void init(ExpressionExecutor[] attributeExpressionExecutors, + ExecutionPlanContext executionPlanContext) { + if (attributeExpressionExecutors.length != 1 && attributeExpressionExecutors.length != 2) { + throw new ExecutionPlanValidationException( + "Invalid no of arguments passed to device:hasDevicesOfStatus() function, required 2 but found " + + attributeExpressionExecutors.length); + } + if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the first argument (status) of device:hasDevicesOfStatus() " + + "function, required " + Attribute.Type.STRING + " as status, but found " + + attributeExpressionExecutors[0].getReturnType().toString()); + } + if (attributeExpressionExecutors.length == 2 + && attributeExpressionExecutors[1].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the second argument (device type) of device:hasDevicesOfStatus() " + + "function, required " + Attribute.Type.STRING + " as device type, but found " + + attributeExpressionExecutors[1].getReturnType().toString()); + } + } + + @Override + protected Object execute(Object[] data) { + if (data[0] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:hasDevicesOfStatus() function. " + + "First argument cannot be null"); + } + if (data.length == 2 && data[1] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:hasDevicesOfStatus() function. " + + "Second argument cannot be null"); + } + String status = (String) data[0]; + String deviceType = null; + if (data.length == 2) { + deviceType = (String) data[1]; + } + try { + DeviceManagementProviderService deviceManagementProviderService = DeviceUtils.getDeviceManagementProviderService(); + List devices = deviceManagementProviderService.getDevicesByStatus(EnrolmentInfo.Status.valueOf(status), false); + if (deviceType == null) { + return !devices.isEmpty(); + } else { + for (Device device : devices) { + if (deviceType.equalsIgnoreCase(device.getType())) { + return true; + } + } + return false; + } + } catch (DeviceManagementException e) { + log.error("Error occurred while getting devices with status " + status, e); + } + return false; + } + + @Override + protected Object execute(Object data) { + return execute(new Object[]{data}); + } + + @Override + public void start() { + //Nothing to start + } + + @Override + public void stop() { + //Nothing to stop + } + + @Override + public Attribute.Type getReturnType() { + return returnType; + } + + @Override + public Object[] currentState() { + return null; //No need to maintain a state. + } + + @Override + public void restoreState(Object[] state) { + //Since there's no need to maintain a state, nothing needs to be done here. + } +} diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/HasDevicesOfUserFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/HasDevicesOfUserFunctionExecutor.java new file mode 100644 index 000000000..ffb72c7f6 --- /dev/null +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/HasDevicesOfUserFunctionExecutor.java @@ -0,0 +1,147 @@ +/* + * 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.extension.siddhi.device; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.extension.siddhi.device.utils.DeviceUtils; +import org.wso2.siddhi.core.config.ExecutionPlanContext; +import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException; +import org.wso2.siddhi.core.executor.ExpressionExecutor; +import org.wso2.siddhi.core.executor.function.FunctionExecutor; +import org.wso2.siddhi.query.api.definition.Attribute; +import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException; + +import java.util.List; + +/** + * hasDevicesOfUser(user , deviceType [, status]) + * Returns true if there are devices belonging to user + * Accept Type(s): (STRING, STRING, STRING) + * Return Type(s): (BOOL) + */ +public class HasDevicesOfUserFunctionExecutor extends FunctionExecutor { + + private static Log log = LogFactory.getLog(HasDevicesOfUserFunctionExecutor.class); + private Attribute.Type returnType = Attribute.Type.BOOL; + + @Override + protected void init(ExpressionExecutor[] attributeExpressionExecutors, + ExecutionPlanContext executionPlanContext) { + if (attributeExpressionExecutors.length != 2 && attributeExpressionExecutors.length != 3) { + throw new ExecutionPlanValidationException( + "Invalid no of arguments passed to device:getDevicesOfUser() function, minimum 2, or 3 with " + + "optional. but found " + attributeExpressionExecutors.length); + } + if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the first argument (user) of device:getDevicesOfUser() " + + "function, required " + Attribute.Type.STRING + " as user, but found " + + attributeExpressionExecutors[0].getReturnType().toString()); + } + if (attributeExpressionExecutors[1].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the second argument (device type) of device:getDevicesOfUser() " + + "function, required " + Attribute.Type.STRING + " as device type, but found " + + attributeExpressionExecutors[1].getReturnType().toString()); + } + if (attributeExpressionExecutors.length == 3 + && attributeExpressionExecutors[2].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid optional parameter type found for the third argument (status) of " + + "device:getDevicesOfUser() function, required " + Attribute.Type.STRING + " as status, but found " + + attributeExpressionExecutors[2].getReturnType().toString()); + } + } + + @Override + protected Object execute(Object[] data) { + if (data[0] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:getDevicesOfUser() function. " + + "First argument cannot be null"); + } + if (data[1] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:getDevicesOfUser() function. " + + "Second argument cannot be null"); + } + if (data.length == 3 && data[2] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:getDevicesOfUser() function. " + + "Third argument cannot be null"); + } + String user = (String) data[0]; + String deviceType = (String) data[1]; + String status = null; + if (data.length == 3) { + status = (String) data[2]; + } + + try { + DeviceManagementProviderService deviceManagementProviderService = DeviceUtils.getDeviceManagementProviderService(); + List devices = deviceManagementProviderService.getDevicesOfUser(user, deviceType, false); + if (status == null) { + return !devices.isEmpty(); + } else { + for (Device device : devices) { + if (status.equalsIgnoreCase(device.getEnrolmentInfo().getStatus().toString())) { + return true; + } + } + return false; + } + } catch (DeviceManagementException e) { + log.error("Error occurred while getting " + deviceType + " devices of user " + user + + ", with status " + status, e); + } + return false; + } + + @Override + protected Object execute(Object data) { + return null; //Since the getDevicesOfUser function takes in 2 or 3 parameters, this method does not get called. Hence,not implemented. + } + + @Override + public void start() { + //Nothing to start + } + + @Override + public void stop() { + //Nothing to stop + } + + @Override + public Attribute.Type getReturnType() { + return returnType; + } + + @Override + public Object[] currentState() { + return null; //No need to maintain a state. + } + + @Override + public void restoreState(Object[] state) { + //Since there's no need to maintain a state, nothing needs to be done here. + } +} diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/IsEnrolledFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/IsEnrolledFunctionExecutor.java new file mode 100644 index 000000000..f1893e33a --- /dev/null +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/IsEnrolledFunctionExecutor.java @@ -0,0 +1,122 @@ +/* + * 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.extension.siddhi.device; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; +import org.wso2.extension.siddhi.device.utils.DeviceUtils; +import org.wso2.siddhi.core.config.ExecutionPlanContext; +import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException; +import org.wso2.siddhi.core.executor.ExpressionExecutor; +import org.wso2.siddhi.core.executor.function.FunctionExecutor; +import org.wso2.siddhi.query.api.definition.Attribute; +import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException; + +/** + * isEnrolled(deviceId, deviceType) + * Returns true if device enrolled. + * Accept Type(s): (STRING, STRING) + * Return Type(s): (BOOL) + */ +public class IsEnrolledFunctionExecutor extends FunctionExecutor { + + private static Log log = LogFactory.getLog(IsEnrolledFunctionExecutor.class); + private Attribute.Type returnType = Attribute.Type.BOOL; + + @Override + protected void init(ExpressionExecutor[] attributeExpressionExecutors, + ExecutionPlanContext executionPlanContext) { + if (attributeExpressionExecutors.length != 2) { + throw new ExecutionPlanValidationException( + "Invalid no of arguments passed to device:isEnrolled() function, required 2, but found " + + attributeExpressionExecutors.length); + } + if (attributeExpressionExecutors[0].getReturnType()!= Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the first argument (deviceId) of device:isEnrolled() " + + "function, required " + Attribute.Type.STRING + ", but found " + + attributeExpressionExecutors[0].getReturnType().toString()); + } + if (attributeExpressionExecutors[1].getReturnType() != Attribute.Type.STRING) { + throw new ExecutionPlanValidationException( + "Invalid parameter type found for the second argument (deviceType) of device:isEnrolled() " + + "function, required " + Attribute.Type.STRING + ", but found " + + attributeExpressionExecutors[1].getReturnType().toString()); + } + } + + @Override + protected Object execute(Object[] data) { + if (data[0] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:isEnrolled() function. " + + "First argument cannot be null"); + } + if (data[1] == null) { + throw new ExecutionPlanRuntimeException("Invalid input given to device:isEnrolled() function. " + + "Second argument cannot be null"); + } + + String deviceId = (String) data[0]; + String deviceType = (String) data[1]; + + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(deviceId, deviceType); + try { + DeviceManagementProviderService deviceManagementService = DeviceUtils.getDeviceManagementProviderService(); + return deviceManagementService.isEnrolled(deviceIdentifier); + } catch (DeviceManagementException e) { + log.error("Error occurred while checking device is enrolled.", e); + } + return false; + } + + @Override + protected Object execute(Object data) { + return null; //Since the getDevicesOfUser function takes in 2 parameters, this method does not get called. Hence,not implemented. + } + + @Override + public void start() { + //Nothing to start + } + + @Override + public void stop() { + //Nothing to stop + } + + @Override + public Attribute.Type getReturnType() { + return returnType; + } + + @Override + public Object[] currentState() { + return null; //No need to maintain a state. + } + + @Override + public void restoreState(Object[] state) { + //Since there's no need to maintain a state, nothing needs to be done here. + } +} diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/main/java/org/wso2/extension/siddhi/devicegroup/IsDeviceInGroupFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/IsInGroupFunctionExecutor.java similarity index 83% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/main/java/org/wso2/extension/siddhi/devicegroup/IsDeviceInGroupFunctionExecutor.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/IsInGroupFunctionExecutor.java index 5072b6385..56b52ef95 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/main/java/org/wso2/extension/siddhi/devicegroup/IsDeviceInGroupFunctionExecutor.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/IsInGroupFunctionExecutor.java @@ -16,14 +16,14 @@ * under the License. */ -package org.wso2.extension.siddhi.devicegroup; +package org.wso2.extension.siddhi.device; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; -import org.wso2.extension.siddhi.devicegroup.utils.DeviceGroupUtils; +import org.wso2.extension.siddhi.device.utils.DeviceUtils; import org.wso2.siddhi.core.config.ExecutionPlanContext; import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException; import org.wso2.siddhi.core.executor.ExpressionExecutor; @@ -33,14 +33,14 @@ import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException; /** - * isDeviceInGroup(deviceId , groupId) + * isInGroup(groupId, deviceId, deviceType) * Returns true if device belongs to group, otherwise false. - * Accept Type(s): (STRING, INTEGER) + * Accept Type(s): (INTEGER, STRING, STRING) * Return Type(s): (BOOL) */ -public class IsDeviceInGroupFunctionExecutor extends FunctionExecutor { +public class IsInGroupFunctionExecutor extends FunctionExecutor { - private static Log log = LogFactory.getLog(IsDeviceInGroupFunctionExecutor.class); + private static Log log = LogFactory.getLog(IsInGroupFunctionExecutor.class); private Attribute.Type returnType = Attribute.Type.BOOL; @Override @@ -48,24 +48,24 @@ public class IsDeviceInGroupFunctionExecutor extends FunctionExecutor { ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 3) { throw new ExecutionPlanValidationException( - "Invalid no of arguments passed to group:isDeviceInGroup() function, required 3, but found " + "Invalid no of arguments passed to device:isInGroup() function, required 3, but found " + attributeExpressionExecutors.length); } if (attributeExpressionExecutors[0].getReturnType()!= Attribute.Type.INT) { throw new ExecutionPlanValidationException( - "Invalid parameter type found for the first argument (group id) of group:isDeviceInGroup() " + + "Invalid parameter type found for the first argument (group id) of device:isInGroup() " + "function, required " + Attribute.Type.INT + ", but found " + attributeExpressionExecutors[0].getReturnType().toString()); } if (attributeExpressionExecutors[1].getReturnType() != Attribute.Type.STRING) { throw new ExecutionPlanValidationException( - "Invalid parameter type found for the second argument (device id) of group:isDeviceInGroup() " + + "Invalid parameter type found for the second argument (device id) of device:isInGroup() " + "function, required " + Attribute.Type.STRING + ", but found " + attributeExpressionExecutors[1].getReturnType().toString()); } if (attributeExpressionExecutors[2].getReturnType() != Attribute.Type.STRING) { throw new ExecutionPlanValidationException( - "Invalid parameter type found for the third argument (device type) of group:isDeviceInGroup() " + + "Invalid parameter type found for the third argument (device type) of device:isInGroup() " + "function, required " + Attribute.Type.STRING + ", but found " + attributeExpressionExecutors[2].getReturnType().toString()); } @@ -74,15 +74,15 @@ public class IsDeviceInGroupFunctionExecutor extends FunctionExecutor { @Override protected Object execute(Object[] data) { if (data[0] == null) { - throw new ExecutionPlanRuntimeException("Invalid input given to group:isDeviceInGroup() function. " + + throw new ExecutionPlanRuntimeException("Invalid input given to device:isInGroup() function. " + "First argument cannot be null"); } if (data[1] == null) { - throw new ExecutionPlanRuntimeException("Invalid input given to group:isDeviceInGroup() function. " + + throw new ExecutionPlanRuntimeException("Invalid input given to device:isInGroup() function. " + "Second argument cannot be null"); } if (data[2] == null) { - throw new ExecutionPlanRuntimeException("Invalid input given to group:isDeviceInGroup() function. " + + throw new ExecutionPlanRuntimeException("Invalid input given to device:isInGroup() function. " + "Third argument cannot be null"); } Integer groupId = (Integer) data[0]; @@ -90,7 +90,7 @@ public class IsDeviceInGroupFunctionExecutor extends FunctionExecutor { String deviceType = (String) data[2]; DeviceIdentifier deviceIdentifier = new DeviceIdentifier(deviceId, deviceType); - GroupManagementProviderService groupManagementService = DeviceGroupUtils.getGroupManagementProviderService(); + GroupManagementProviderService groupManagementService = DeviceUtils.getGroupManagementProviderService(); try { return groupManagementService.isDeviceMappedToGroup(groupId, deviceIdentifier); } catch (GroupManagementException e) { @@ -101,7 +101,7 @@ public class IsDeviceInGroupFunctionExecutor extends FunctionExecutor { @Override protected Object execute(Object data) { - return null; //Since the getProperty function takes in 2 parameters, this method does not get called. Hence,not implemented. + return null; //Since the isInGroup function takes in 3 parameters, this method does not get called. Hence,not implemented. } @Override @@ -129,5 +129,3 @@ public class IsDeviceInGroupFunctionExecutor extends FunctionExecutor { //Since there's no need to maintain a state, nothing needs to be done here. } } - - diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/main/java/org/wso2/extension/siddhi/devicegroup/utils/DeviceGroupUtils.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/utils/DeviceUtils.java similarity index 54% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/main/java/org/wso2/extension/siddhi/devicegroup/utils/DeviceGroupUtils.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/utils/DeviceUtils.java index 700d5fa02..897e026c6 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/main/java/org/wso2/extension/siddhi/devicegroup/utils/DeviceGroupUtils.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/java/org/wso2/extension/siddhi/device/utils/DeviceUtils.java @@ -15,48 +15,53 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.extension.siddhi.devicegroup.utils; +package org.wso2.extension.siddhi.device.utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; /** * This class holds utility methods to retrieve data. */ -public class DeviceGroupUtils { +public class DeviceUtils { - private static Log log = LogFactory.getLog(DeviceGroupUtils.class); - private static GroupManagementProviderService groupManagementProviderServiceForTest; + private static Log log = LogFactory.getLog(DeviceUtils.class); + private static DeviceManagementProviderService deviceManagementProviderService; + private static GroupManagementProviderService groupManagementProviderService; - private DeviceGroupUtils(){ + private DeviceUtils(){ + } + public static DeviceManagementProviderService getDeviceManagementProviderService() { + if (deviceManagementProviderService != null) { + return deviceManagementProviderService; + } + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + deviceManagementProviderService = + (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null); + if (deviceManagementProviderService == null) { + String msg = "Device Management service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + return deviceManagementProviderService; } public static GroupManagementProviderService getGroupManagementProviderService() { - if (groupManagementProviderServiceForTest != null) { - return groupManagementProviderServiceForTest; + if (groupManagementProviderService != null) { + return groupManagementProviderService; } PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - GroupManagementProviderService groupManagementProviderService = + groupManagementProviderService = (GroupManagementProviderService) ctx.getOSGiService(GroupManagementProviderService.class, null); if (groupManagementProviderService == null) { - String msg = "GroupImpl Management service has not initialized."; + String msg = "Group Management service has not initialized."; log.error(msg); throw new IllegalStateException(msg); } return groupManagementProviderService; } - - /** - * This method is only to set groupManagementProviderService locally for testing as OSGi framework cannot start - * with testng to register the groupManagementProviderService. Hence setting groupManagementProviderService from - * CheckDeviceInGroupExtensionTestCase - * @param groupManagementProviderServiceForTest to be set. - */ - public static void setGroupManagementProviderServiceForTest( - GroupManagementProviderService groupManagementProviderServiceForTest) { - DeviceGroupUtils.groupManagementProviderServiceForTest = groupManagementProviderServiceForTest; - } } diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/main/resources/devicegroup.siddhiext b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/resources/device.siddhiext similarity index 53% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/main/resources/devicegroup.siddhiext rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/resources/device.siddhiext index 41eed5053..84dd50b95 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/main/resources/devicegroup.siddhiext +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/main/resources/device.siddhiext @@ -6,7 +6,7 @@ # in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# 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 @@ -16,4 +16,9 @@ # under the License. # -isDeviceInGroup=org.wso2.extension.siddhi.devicegroup.IsDeviceInGroupFunctionExecutor +isInGroup=org.wso2.extension.siddhi.device.IsInGroupFunctionExecutor +getDevicesOfUser=org.wso2.extension.siddhi.device.GetDevicesOfUserFunctionExecutor +hasDevicesOfUser=org.wso2.extension.siddhi.device.HasDevicesOfUserFunctionExecutor +getDevicesOfStatus=org.wso2.extension.siddhi.device.GetDevicesOfStatusFunctionExecutor +hasDevicesOfStatus=org.wso2.extension.siddhi.device.HasDevicesOfStatusFunctionExecutor +isEnrolled=org.wso2.extension.siddhi.device.IsEnrolledFunctionExecutor diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/BaseDeviceManagementTest.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/BaseDeviceManagementTest.java similarity index 96% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/BaseDeviceManagementTest.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/BaseDeviceManagementTest.java index 93aac646b..ce6130c06 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/BaseDeviceManagementTest.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/BaseDeviceManagementTest.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.extension.siddhi.devicegroup; +package org.wso2.extension.siddhi.device; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,8 +32,8 @@ import org.wso2.carbon.device.mgt.core.dao.GroupManagementDAOFactory; import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory; import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; -import org.wso2.extension.siddhi.devicegroup.test.util.DataSourceConfig; -import org.wso2.extension.siddhi.devicegroup.test.util.TestUtils; +import org.wso2.extension.siddhi.device.test.util.DataSourceConfig; +import org.wso2.extension.siddhi.device.test.util.TestUtils; import javax.sql.DataSource; import javax.xml.bind.JAXBContext; diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/CheckDeviceInGroupExtensionTestCase.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/ExtensionTestCase.java similarity index 50% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/CheckDeviceInGroupExtensionTestCase.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/ExtensionTestCase.java index adb76beb3..801b9e93a 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/CheckDeviceInGroupExtensionTestCase.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/ExtensionTestCase.java @@ -16,13 +16,12 @@ * under the License. */ -package org.wso2.extension.siddhi.devicegroup; +package org.wso2.extension.siddhi.device; import org.apache.log4j.Logger; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; @@ -47,11 +46,11 @@ import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import org.wso2.extension.siddhi.devicegroup.test.util.SiddhiTestHelper; -import org.wso2.extension.siddhi.devicegroup.test.util.TestDataHolder; -import org.wso2.extension.siddhi.devicegroup.test.util.TestDeviceManagementService; -import org.wso2.extension.siddhi.devicegroup.test.util.TestUtils; -import org.wso2.extension.siddhi.devicegroup.utils.DeviceGroupUtils; +import org.wso2.extension.siddhi.device.test.util.SiddhiTestHelper; +import org.wso2.extension.siddhi.device.test.util.TestDataHolder; +import org.wso2.extension.siddhi.device.test.util.TestDeviceManagementService; +import org.wso2.extension.siddhi.device.test.util.TestUtils; +import org.wso2.extension.siddhi.device.utils.DeviceUtils; import org.wso2.siddhi.core.ExecutionPlanRuntime; import org.wso2.siddhi.core.SiddhiManager; import org.wso2.siddhi.core.event.Event; @@ -60,39 +59,56 @@ import org.wso2.siddhi.core.stream.input.InputHandler; import org.wso2.siddhi.core.util.EventPrinter; import java.io.InputStream; +import java.lang.reflect.Field; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import static org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants.Permissions.DEFAULT_ADMIN_PERMISSIONS; import static org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants.Roles.DEFAULT_ADMIN_ROLE; -public class CheckDeviceInGroupExtensionTestCase extends BaseDeviceManagementTest { - private static final Logger log = Logger.getLogger(CheckDeviceInGroupExtensionTestCase.class); +public class ExtensionTestCase extends BaseDeviceManagementTest { + private static final Logger log = Logger.getLogger(ExtensionTestCase.class); private AtomicInteger count = new AtomicInteger(0); private volatile boolean eventArrived; private GroupManagementProviderService groupManagementProviderService; - private DeviceManagementProviderService deviceMgtService; + private DeviceManagementProviderService deviceManagementProviderService; private static String DEVICE_TYPE = "Test"; + private QueryCallback queryCallback = new QueryCallback() { + @Override + public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) { + EventPrinter.print(timeStamp, inEvents, removeEvents); + for (Event event : inEvents) { + count.incrementAndGet(); + eventArrived = true; + } + } + }; + @BeforeClass @Override public void init() throws Exception { log.info("Initializing"); - count.set(0); - eventArrived = false; groupManagementProviderService = new GroupManagementProviderServiceImpl(); - deviceMgtService = new DeviceManagementProviderServiceImpl(); - DeviceGroupUtils.setGroupManagementProviderServiceForTest(groupManagementProviderService); + deviceManagementProviderService = new DeviceManagementProviderServiceImpl(); DeviceManagementServiceComponent.notifyStartupListeners(); - DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceMgtService); + DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceManagementProviderService); DeviceManagementDataHolder.getInstance().setRegistryService(getRegistryService()); DeviceManagementDataHolder.getInstance().setDeviceAccessAuthorizationService(new DeviceAccessAuthorizationServiceImpl()); DeviceManagementDataHolder.getInstance().setGroupManagementProviderService(groupManagementProviderService); DeviceManagementDataHolder.getInstance().setDeviceTaskManagerService(null); - deviceMgtService.registerDeviceType( + deviceManagementProviderService.registerDeviceType( new TestDeviceManagementService(DEVICE_TYPE, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)); + + Field deviceManagementProviderServiceField = DeviceUtils.class.getDeclaredField("deviceManagementProviderService"); + deviceManagementProviderServiceField.setAccessible(true); + deviceManagementProviderServiceField.set(null, deviceManagementProviderService); + + Field groupManagementProviderServiceField = DeviceUtils.class.getDeclaredField("groupManagementProviderService"); + groupManagementProviderServiceField.setAccessible(true); + groupManagementProviderServiceField.set(null, groupManagementProviderService); } private RegistryService getRegistryService() throws RegistryException, UserStoreException, @@ -119,7 +135,7 @@ public class CheckDeviceInGroupExtensionTestCase extends BaseDeviceManagementTes public void enrollDevice() { Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE); try { - boolean enrollmentStatus = deviceMgtService.enrollDevice(device); + boolean enrollmentStatus = deviceManagementProviderService.enrollDevice(device); Assert.assertTrue(enrollmentStatus); } catch (DeviceManagementException e) { String msg = "Error Occurred while enrolling device"; @@ -140,25 +156,18 @@ public class CheckDeviceInGroupExtensionTestCase extends BaseDeviceManagementTes } @Test(dependsOnMethods = {"addDevices"}) - public void testIsDeviceInGroupExtension() throws InterruptedException, GroupManagementException { - log.info("IsDeviceInGroup TestCase"); + public void testIsInGroupExtension() throws InterruptedException, GroupManagementException { + log.info("IsInGroup TestCase"); SiddhiManager siddhiManager = new SiddhiManager(); + count.set(0); + eventArrived = false; + String inStreamDefinition = "define stream inputStream (groupId int, deviceId string, deviceType string);"; - String query = ("@info(name = 'query1') from inputStream[devicegroup:isDeviceInGroup(groupId, deviceId, deviceType) == true] " + + String query = ("@info(name = 'query1') from inputStream[device:isInGroup(groupId, deviceId, deviceType)] " + "select deviceId insert into outputStream;"); ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); - - executionPlanRuntime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) { - EventPrinter.print(timeStamp, inEvents, removeEvents); - for (Event event : inEvents) { - count.incrementAndGet(); - eventArrived = true; - } - } - }); + executionPlanRuntime.addCallback("query1", queryCallback); InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream"); executionPlanRuntime.start(); @@ -172,4 +181,101 @@ public class CheckDeviceInGroupExtensionTestCase extends BaseDeviceManagementTes Assert.assertEquals(1, count.get()); executionPlanRuntime.shutdown(); } + + @Test(dependsOnMethods = {"testIsInGroupExtension"}) + public void testGetDevicesOfUserFunctionExecutor() throws InterruptedException, GroupManagementException { + log.info("GetDevicesOfUser without status TestCase"); + SiddhiManager siddhiManager = new SiddhiManager(); + + count.set(0); + eventArrived = false; + + String inStreamDefinition = "define stream inputStream (user string, deviceType string);"; + String query = ("@info(name = 'query1') from inputStream[device:hasDevicesOfUser(user, deviceType)] " + + "select device:getDevicesOfUser(user, deviceType) as devices insert into outputStream;"); + ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); + executionPlanRuntime.addCallback("query1", queryCallback); + + InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream"); + executionPlanRuntime.start(); + Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE); + inputHandler.send(new Object[]{device.getEnrolmentInfo().getOwner(), device.getType()}); + SiddhiTestHelper.waitForEvents(100, 1, count, 10000); + Assert.assertTrue(eventArrived); + Assert.assertEquals(1, count.get()); + executionPlanRuntime.shutdown(); + } + + @Test(dependsOnMethods = {"testGetDevicesOfUserFunctionExecutor"}) + public void testGetDevicesOfUserWithStatusFunctionExecutor() throws InterruptedException, GroupManagementException { + log.info("GetDevicesOfUser with status TestCase"); + SiddhiManager siddhiManager = new SiddhiManager(); + + count.set(0); + eventArrived = false; + + String inStreamDefinition = "define stream inputStream (user string, deviceType string, status string);"; + String query = ("@info(name = 'query1') from inputStream[device:hasDevicesOfUser(user, deviceType, status)] " + + "select device:getDevicesOfUser(user, deviceType, status) as devices insert into outputStream;"); + ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); + executionPlanRuntime.addCallback("query1", queryCallback); + + InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream"); + executionPlanRuntime.start(); + Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE); + inputHandler.send(new Object[]{device.getEnrolmentInfo().getOwner(), device.getType(), + device.getEnrolmentInfo().getStatus().toString()}); + SiddhiTestHelper.waitForEvents(100, 1, count, 10000); + Assert.assertTrue(eventArrived); + Assert.assertEquals(1, count.get()); + executionPlanRuntime.shutdown(); + } + + @Test(dependsOnMethods = {"testGetDevicesOfUserWithStatusFunctionExecutor"}) + public void testGetDevicesOfStatusFunctionExecutor() throws InterruptedException, GroupManagementException { + log.info("GetDevicesOfStatus without deviceType TestCase"); + SiddhiManager siddhiManager = new SiddhiManager(); + + count.set(0); + eventArrived = false; + + String inStreamDefinition = "define stream inputStream (status string);"; + String query = ("@info(name = 'query1') from inputStream[device:hasDevicesOfStatus(status)] " + + "select device:getDevicesOfStatus(status) as devices insert into outputStream;"); + ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); + executionPlanRuntime.addCallback("query1", queryCallback); + + InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream"); + executionPlanRuntime.start(); + Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE); + inputHandler.send(new Object[]{device.getEnrolmentInfo().getStatus().toString()}); + SiddhiTestHelper.waitForEvents(100, 1, count, 10000); + Assert.assertTrue(eventArrived); + Assert.assertEquals(1, count.get()); + executionPlanRuntime.shutdown(); + } + + @Test(dependsOnMethods = {"testGetDevicesOfStatusFunctionExecutor"}) + public void testGetDevicesOfStatusWithTypeFunctionExecutor() throws InterruptedException, GroupManagementException { + log.info("GetDevicesOfStatus with deviceType TestCase"); + SiddhiManager siddhiManager = new SiddhiManager(); + + count.set(0); + eventArrived = false; + + String inStreamDefinition = "define stream inputStream (status string, deviceType string);"; + String query = ("@info(name = 'query1') from inputStream[device:hasDevicesOfStatus(status, deviceType)] " + + "select device:getDevicesOfStatus(status, deviceType) as devices insert into outputStream;"); + ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); + executionPlanRuntime.addCallback("query1", queryCallback); + + InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream"); + executionPlanRuntime.start(); + Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE); + inputHandler.send(new Object[]{device.getEnrolmentInfo().getStatus().toString(), device.getType()}); + SiddhiTestHelper.waitForEvents(100, 1, count, 10000); + Assert.assertTrue(eventArrived); + Assert.assertEquals(1, count.get()); + executionPlanRuntime.shutdown(); + } } diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/DataSourceConfig.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/DataSourceConfig.java similarity index 97% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/DataSourceConfig.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/DataSourceConfig.java index 74cc58aef..f787d9b22 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/DataSourceConfig.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/DataSourceConfig.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.extension.siddhi.devicegroup.test.util; +package org.wso2.extension.siddhi.device.test.util; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/SiddhiTestHelper.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/SiddhiTestHelper.java similarity index 95% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/SiddhiTestHelper.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/SiddhiTestHelper.java index 7b0801d57..820cbf154 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/SiddhiTestHelper.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/SiddhiTestHelper.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.extension.siddhi.devicegroup.test.util; +package org.wso2.extension.siddhi.device.test.util; import java.util.concurrent.atomic.AtomicInteger; diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestDataHolder.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDataHolder.java similarity index 97% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestDataHolder.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDataHolder.java index 67c2f774e..6c2fe832f 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestDataHolder.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDataHolder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.wso2.extension.siddhi.devicegroup.test.util; +package org.wso2.extension.siddhi.device.test.util; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; @@ -45,7 +45,7 @@ public class TestDataHolder { enrolmentInfo.setDateOfLastUpdate(new Date().getTime()); enrolmentInfo.setOwner(OWNER); enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); - enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED); + enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE); device.setEnrolmentInfo(enrolmentInfo); device.setDescription("Test Description"); device.setDeviceIdentifier(initialDeviceIdentifier); diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestDeviceManagementService.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManagementService.java similarity index 98% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestDeviceManagementService.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManagementService.java index 758facbb4..f1631b747 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestDeviceManagementService.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManagementService.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.extension.siddhi.devicegroup.test.util; +package org.wso2.extension.siddhi.device.test.util; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestDeviceManager.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManager.java similarity index 98% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestDeviceManager.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManager.java index eb6871ba8..7a152b9a3 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestDeviceManager.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.wso2.extension.siddhi.devicegroup.test.util; +package org.wso2.extension.siddhi.device.test.util; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestUtils.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestUtils.java similarity index 98% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestUtils.java rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestUtils.java index 29a46fe16..20ed04dae 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/java/org/wso2/extension/siddhi/devicegroup/test/util/TestUtils.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestUtils.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.extension.siddhi.devicegroup.test.util; +package org.wso2.extension.siddhi.device.test.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/dbscripts/h2.sql b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/dbscripts/h2.sql similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/dbscripts/h2.sql rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/dbscripts/h2.sql diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/axis2/axis2_client.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/axis2/axis2_client.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/axis2/axis2_client.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/axis2/axis2_client.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/axis2/tenant-axis2.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/axis2/tenant-axis2.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/axis2/tenant-axis2.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/axis2/tenant-axis2.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/carbon.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/carbon.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/carbon.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/carbon.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/cdm-config.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/cdm-config.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/cdm-config.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/datasources/master-datasources.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/datasources/master-datasources.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/datasources/master-datasources.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/datasources/master-datasources.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/bundle-config/README.txt b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/bundle-config/README.txt similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/bundle-config/README.txt rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/bundle-config/README.txt diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/carboncontext-osgi-services.properties b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/carboncontext-osgi-services.properties similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/carboncontext-osgi-services.properties rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/carboncontext-osgi-services.properties diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/config-validation.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/config-validation.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/config-validation.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/config-validation.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/jmx.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/jmx.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/jmx.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/jmx.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/launch.ini b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/launch.ini similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/launch.ini rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/launch.ini diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/logging-bridge.properties b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/logging-bridge.properties similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/logging-bridge.properties rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/logging-bridge.properties diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/mime.mappings b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/mime.mappings similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/mime.mappings rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/mime.mappings diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/mime.types b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/mime.types similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/mime.types rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/mime.types diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/osgi-debug.options b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/osgi-debug.options similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/etc/osgi-debug.options rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/etc/osgi-debug.options diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/log4j.properties b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/log4j.properties similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/log4j.properties rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/log4j.properties diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/registry.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/registry.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/registry.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/registry.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/security/authenticators.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/security/authenticators.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/security/authenticators.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/security/authenticators.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/carbon/META-INF/context.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/carbon/META-INF/context.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/carbon/META-INF/context.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/carbon/META-INF/context.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/carbon/WEB-INF/web.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/carbon/WEB-INF/web.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/carbon/WEB-INF/web.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/carbon/WEB-INF/web.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/catalina-server.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/catalina-server.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/catalina-server.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/catalina-server.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/tomcat-users.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/tomcat-users.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/tomcat-users.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/tomcat-users.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/web.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/web.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/tomcat/web.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/tomcat/web.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/user-mgt.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/user-mgt.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/carbon-home/repository/conf/user-mgt.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/carbon-home/repository/conf/user-mgt.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/config/datasource/data-source-config.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/config/datasource/data-source-config.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/config/datasource/data-source-config.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/config/datasource/data-source-config.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/log4j.properties b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/log4j.properties similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/log4j.properties rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/log4j.properties diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/sql/h2.sql b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/sql/h2.sql similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/sql/h2.sql rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/sql/h2.sql diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/testng.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/testng.xml similarity index 83% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/testng.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/testng.xml index 01419c74c..a2e39e52e 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/testng.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/testng.xml @@ -24,8 +24,8 @@ - - + + diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/user-test/user-mgt-registry-test.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/user-test/user-mgt-registry-test.xml similarity index 100% rename from components/extensions/siddhi-extensions/org.wso2.extension.siddhi.devicegroup/src/test/resources/user-test/user-mgt-registry-test.xml rename to components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/resources/user-test/user-mgt-registry-test.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index efa6a7777..c29d825b9 100644 --- a/components/extensions/siddhi-extensions/pom.xml +++ b/components/extensions/siddhi-extensions/pom.xml @@ -33,7 +33,7 @@ http://wso2.org - org.wso2.extension.siddhi.devicegroup + org.wso2.extension.siddhi.device org.wso2.extension.siddhi.execution.json org.wso2.gpl.siddhi.extension.geo.script