From 5fe781f6f1b17f09c94d406b9ba3daae260ecf25 Mon Sep 17 00:00:00 2001 From: charitha Date: Fri, 3 Aug 2018 22:34:27 +0530 Subject: [PATCH 1/9] Fixed capp deployement issue --- modules/distribution/src/assembly/bin.xml | 8 --- modules/p2-profile/analytics-profile/pom.xml | 26 +------- modules/p2-profile/iot-core-profile/pom.xml | 65 +++++++++----------- 3 files changed, 30 insertions(+), 69 deletions(-) diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml index 35216133..fd89ecd7 100755 --- a/modules/distribution/src/assembly/bin.xml +++ b/modules/distribution/src/assembly/bin.xml @@ -1734,14 +1734,6 @@ ${pom.artifactId}-${pom.version}/repository/resources/lifecycles - - - - ../p2-profile/iot-core-profile/target/wso2carbon-core-${carbon.kernel.version}/wso2/deployment/server/carbonapps/org_wso2_carbon_iot_geo_dashboard-1.0.0.car - - ${pom.artifactId}-${pom.version}/repository/resources/devicetypes/analytics/ - 644 - src/core/samples/connectedcup-samples-deployer.xml ${pom.artifactId}-${pom.version}/samples/ diff --git a/modules/p2-profile/analytics-profile/pom.xml b/modules/p2-profile/analytics-profile/pom.xml index 6faa5718..38cec19a 100644 --- a/modules/p2-profile/analytics-profile/pom.xml +++ b/modules/p2-profile/analytics-profile/pom.xml @@ -393,10 +393,6 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.identity.jwt.client.extension.feature:${carbon.device.mgt.version} - - - org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.iot.geo.dashboard.feature:${carbon.device.mgt.plugin.version} - org.wso2.carbon.analytics.shared:org.wso2.carbon.analytics.shared.spark.common.udf.feature:${analytics.shared.version} @@ -410,9 +406,7 @@ org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.analytics.feature:${carbon.device.mgt.plugin.version} - - org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature:${carbon.device.mgt.plugin.version} - + org.wso2.carbon.devicemgt-plugins:org.wso2.gpl.siddhi.extension.geo.script.feature:${carbon.device.mgt.plugin.version} @@ -863,16 +857,8 @@ org.wso2.carbon.analytics.gadget.template.feature.group ${carbon.analytics.common.version} - - - - org.wso2.carbon.iot.geo.dashboard.feature.group - ${carbon.device.mgt.plugin.version} - - - org.wso2.extension.siddhi.execution.json.feature.group @@ -882,16 +868,6 @@ org.wso2.extension.siddhi.device.feature.group ${carbon.device.mgt.plugin.version} - - org.wso2.carbon.device.mgt.iot.analytics.feature.group - ${carbon.device.mgt.plugin.version} - - - - - org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature.group - ${carbon.device.mgt.plugin.version} - org.wso2.gpl.siddhi.extension.geo.script.feature.group diff --git a/modules/p2-profile/iot-core-profile/pom.xml b/modules/p2-profile/iot-core-profile/pom.xml index 5ad52e1d..6a4e0293 100644 --- a/modules/p2-profile/iot-core-profile/pom.xml +++ b/modules/p2-profile/iot-core-profile/pom.xml @@ -180,12 +180,6 @@ org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.windows.feature:${carbon.device.mgt.plugin.version} - - - org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.androidsense.ui.feature:${carbon.device.mgt.plugin.version} - - - org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.androidsense.backend.feature:${carbon.device.mgt.plugin.version} org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.notification.listener.feature:${carbon.device.mgt.plugin.version} @@ -777,7 +771,10 @@ org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.iot.geo.dashboard.feature:${carbon.device.mgt.plugin.version} - + + + org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.analytics.feature:${carbon.device.mgt.plugin.version} + @@ -1060,14 +1057,6 @@ org.wso2.carbon.device.mgt.mobile.windows.feature.group ${carbon.device.mgt.plugin.version} - - - org.wso2.carbon.device.mgt.iot.androidsense.ui.feature.group - ${carbon.device.mgt.plugin.version} - - - org.wso2.carbon.device.mgt.iot.androidsense.backend.feature.group - ${carbon.device.mgt.plugin.version} org.wso2.carbon.device.mgt.notification.listener.feature.group @@ -1721,7 +1710,11 @@ org.wso2.carbon.iot.geo.dashboard.feature.group ${carbon.device.mgt.plugin.version} - + + + org.wso2.carbon.device.mgt.iot.analytics.feature.group + ${carbon.device.mgt.plugin.version} + org.wso2.carbon.device.mgt.remote.session.feature.group @@ -2147,10 +2140,6 @@ org.wso2.carbon.device.mgt.mobile.android.feature.group ${carbon.device.mgt.plugin.version} - - org.wso2.carbon.device.mgt.iot.androidsense.ui.feature.group - ${carbon.device.mgt.plugin.version} - org.wso2.carbon.device.mgt.mobile.windows.feature.group ${carbon.device.mgt.plugin.version} @@ -2624,7 +2613,11 @@ org.wso2.carbon.iot.geo.dashboard.feature.group ${carbon.device.mgt.plugin.version} - + + + org.wso2.carbon.device.mgt.iot.analytics.feature.group + ${carbon.device.mgt.plugin.version} + org.wso2.carbon.device.mgt.remote.session.feature.group @@ -2632,11 +2625,11 @@ - - - org.wso2.carbon.andes.extensions.device.mgt.api.feature.group - ${carbon.device.mgt.plugin.version} - + + + org.wso2.carbon.andes.extensions.device.mgt.api.feature.group + ${carbon.device.mgt.plugin.version} + @@ -2792,10 +2785,6 @@ org.wso2.carbon.device.mgt.mobile.android.feature.group ${carbon.device.mgt.plugin.version} - - org.wso2.carbon.device.mgt.iot.androidsense.backend.feature.group - ${carbon.device.mgt.plugin.version} - org.wso2.carbon.device.mgt.mobile.windows.feature.group ${carbon.device.mgt.plugin.version} @@ -3254,18 +3243,22 @@ org.wso2.carbon.iot.geo.dashboard.feature.group ${carbon.device.mgt.plugin.version} - + + + org.wso2.carbon.device.mgt.iot.analytics.feature.group + ${carbon.device.mgt.plugin.version} + org.wso2.carbon.device.mgt.remote.session.feature.group ${carbon.device.mgt.plugin.version} - - - org.wso2.carbon.andes.extensions.device.mgt.api.feature.group - ${carbon.device.mgt.plugin.version} - + + + org.wso2.carbon.andes.extensions.device.mgt.api.feature.group + ${carbon.device.mgt.plugin.version} + From 299a434cbc63a46c4da36fbad16622f701b47c52 Mon Sep 17 00:00:00 2001 From: charitha Date: Fri, 3 Aug 2018 22:35:58 +0530 Subject: [PATCH 2/9] Commiting snapshot versions for developemnt --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ccdf4b18..1a824ac0 100644 --- a/pom.xml +++ b/pom.xml @@ -1528,14 +1528,14 @@ 4.7.23 - 3.1.28 + 3.1.31-SNAPSHOT [3.1.0, 4.0.0) ${project.version} - 4.1.6 + 4.1.7-SNAPSHOT 6.2.201 From 9cb8f3be585ef64d12146cfbbd24a6c844699d22 Mon Sep 17 00:00:00 2001 From: charitha Date: Mon, 13 Aug 2018 15:11:10 +0530 Subject: [PATCH 3/9] Updated to latest device mgt components --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1a824ac0..2d6dbeec 100644 --- a/pom.xml +++ b/pom.xml @@ -1528,14 +1528,14 @@ 4.7.23 - 3.1.31-SNAPSHOT + 3.1.32 [3.1.0, 4.0.0) ${project.version} - 4.1.7-SNAPSHOT + 4.1.7 6.2.201 From ac806a71a3535b9c5b70adc4c2c25022d3336e44 Mon Sep 17 00:00:00 2001 From: charitha Date: Tue, 21 Aug 2018 14:30:52 +0530 Subject: [PATCH 4/9] Updated to latest device mgt components --- modules/distribution/src/assembly/bin.xml | 15 -------- .../distribution/src/core/bin/iot-server.bat | 2 +- .../distribution/src/core/bin/iot-server.sh | 2 ++ .../core/conf/etc/device-analytics-config.xml | 36 ------------------- modules/p2-profile/iot-core-profile/pom.xml | 8 ++--- pom.xml | 8 ++--- 6 files changed, 11 insertions(+), 60 deletions(-) delete mode 100644 modules/distribution/src/core/conf/etc/device-analytics-config.xml diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml index fd89ecd7..7e1639c0 100755 --- a/modules/distribution/src/assembly/bin.xml +++ b/modules/distribution/src/assembly/bin.xml @@ -140,7 +140,6 @@ **/cdm-datasources.xml **/tomcat/carbon/WEB-INF/web.xml **/synapse.properties - **/etc/device-analytics-config.xml **/synapse-handlers.xml **/tomcat/context.xml **/security/Owasp.CsrfGuard.Carbon.properties @@ -1244,20 +1243,6 @@ true 644 - - src/core/conf/etc/device-analytics-config.xml - ${pom.artifactId}-${pom.version}/conf/etc - device-analytics-config.xml - true - 644 - - - src/core/conf/etc/device-analytics-config.xml - ${pom.artifactId}-${pom.version}/wso2/analytics/conf/etc - device-analytics-config.xml - true - 644 - src/core/conf/synapse-handlers.xml diff --git a/modules/distribution/src/core/bin/iot-server.bat b/modules/distribution/src/core/bin/iot-server.bat index 61711c34..9755fe43 100644 --- a/modules/distribution/src/core/bin/iot-server.bat +++ b/modules/distribution/src/core/bin/iot-server.bat @@ -167,7 +167,7 @@ set CARBON_CLASSPATH=.\lib;%CARBON_CLASSPATH% set JAVA_ENDORSED=".\wso2\lib\endorsed";"%JAVA_HOME%\jre\lib\endorsed";"%JAVA_HOME%\lib\endorsed" -set CMD_LINE_ARGS=-Xbootclasspath/a:%CARBON_XBOOTCLASSPATH% -Xms256m -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%CARBON_HOME%\repository\logs\heap-dump.hprof" -Dcom.sun.management.jmxremote -classpath %CARBON_CLASSPATH% %JAVA_OPTS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -Dcarbon.registry.root=/ -Dcarbon.home="%CARBON_HOME%" -Dwso2.server.standalone=true -Djava.command="%JAVA_HOME%\bin\java" -Djava.opts="%JAVA_OPTS%" -Djava.io.tmpdir="%CARBON_HOME%\tmp" -Dlogger.server.name="IoT-Core" -Dcatalina.base="%CARBON_HOME%\wso2\lib\tomcat" -Djava.util.logging.config.file="%CARBON_HOME%\conf\etc\logging-bridge.properties" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dcomponents.repo="%CARBON_HOME%\wso2\components\plugins" -Dcarbon.config.dir.path="%CARBON_HOME%\conf" -Dcarbon.components.dir.path="%CARBON_HOME%\wso2\components" -Dcarbon.extensions.dir.path="%CARBON_HOME%\extensions" -Dcarbon.dropins.dir.path="%CARBON_HOME%\dropins" -Dcarbon.external.lib.dir.path="%CARBON_HOME%\lib" -Dcarbon.patches.dir.path="%CARBON_HOME%\patches" -Dcarbon.servicepacks.dir.path="%CARBON_HOME%\servicepacks" -Dcarbon.internal.lib.dir.path="%CARBON_HOME%\wso2\lib" -Dconf.location="%CARBON_HOME%\conf" -Dcom.atomikos.icatch.file="%CARBON_HOME%\wso2\lib\transactions.properties" -Dcom.atomikos.icatch.hide_init_file_path=true -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dcom.sun.jndi.ldap.connect.pool.authentication=simple -Dcom.sun.jndi.ldap.connect.pool.timeout=3000 -Dorg.terracotta.quartz.skipUpdateCheck=true -Djava.security.egd=file:/dev/./urandom -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dcom.ibm.cacheLocalHost=true -DworkerNode=false -Dorg.wso2.ignoreHostnameVerification=true -Dorg.opensaml.httpclient.https.disableHostnameVerification=true -Diot.analytics.host="localhost" -Diot.analytics.https.port="9445" -Diot.manager.host="localhost" -Diot.manager.https.port="9443" -Dmqtt.broker.host="localhost" -Dmqtt.broker.port="1886" -Diot.core.host="localhost" -Diot.core.https.port="9443" -Diot.keymanager.host="localhost" -Diot.keymanager.https.port="9443" -Diot.gateway.host="localhost" -Diot.gateway.https.port="8243" -Diot.gateway.http.port="8280" -Diot.gateway.carbon.https.port="9443" -Diot.gateway.carbon.http.port="9763" -Diot.apimpublisher.host="localhost" -Diot.apimpublisher.https.port="9443" -Diot.apimstore.host="localhost" -Diot.apimstore.https.port="9443" +set CMD_LINE_ARGS=-Xbootclasspath/a:%CARBON_XBOOTCLASSPATH% -Xms256m -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%CARBON_HOME%\repository\logs\heap-dump.hprof" -Dcom.sun.management.jmxremote -classpath %CARBON_CLASSPATH% %JAVA_OPTS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -Dcarbon.registry.root=/ -Dcarbon.home="%CARBON_HOME%" -Dwso2.server.standalone=true -Djava.command="%JAVA_HOME%\bin\java" -Djava.opts="%JAVA_OPTS%" -Djava.io.tmpdir="%CARBON_HOME%\tmp" -Dlogger.server.name="IoT-Core" -Dcatalina.base="%CARBON_HOME%\wso2\lib\tomcat" -Djava.util.logging.config.file="%CARBON_HOME%\conf\etc\logging-bridge.properties" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dcomponents.repo="%CARBON_HOME%\wso2\components\plugins" -Dcarbon.config.dir.path="%CARBON_HOME%\conf" -Dcarbon.components.dir.path="%CARBON_HOME%\wso2\components" -Dcarbon.extensions.dir.path="%CARBON_HOME%\extensions" -Dcarbon.dropins.dir.path="%CARBON_HOME%\dropins" -Dcarbon.external.lib.dir.path="%CARBON_HOME%\lib" -Dcarbon.patches.dir.path="%CARBON_HOME%\patches" -Dcarbon.servicepacks.dir.path="%CARBON_HOME%\servicepacks" -Dcarbon.internal.lib.dir.path="%CARBON_HOME%\wso2\lib" -Dconf.location="%CARBON_HOME%\conf" -Dcom.atomikos.icatch.file="%CARBON_HOME%\wso2\lib\transactions.properties" -Dcom.atomikos.icatch.hide_init_file_path=true -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dcom.sun.jndi.ldap.connect.pool.authentication=simple -Dcom.sun.jndi.ldap.connect.pool.timeout=3000 -Dorg.terracotta.quartz.skipUpdateCheck=true -Djava.security.egd=file:/dev/./urandom -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dcom.ibm.cacheLocalHost=true -DworkerNode=false -Dorg.wso2.ignoreHostnameVerification=true -Dorg.opensaml.httpclient.https.disableHostnameVerification=true -Diot.analytics.host="localhost" -Diot.analytics.http.port="9765" -Diot.analytics.https.port="9445" -Diot.analytics.thrift.port="7613" -Diot.manager.host="localhost" -Diot.manager.https.port="9443" -Dmqtt.broker.host="localhost" -Dmqtt.broker.port="1886" -Diot.core.host="localhost" -Diot.core.https.port="9443" -Diot.keymanager.host="localhost" -Diot.keymanager.https.port="9443" -Diot.gateway.host="localhost" -Diot.gateway.https.port="8243" -Diot.gateway.http.port="8280" -Diot.gateway.carbon.https.port="9443" -Diot.gateway.carbon.http.port="9763" -Diot.apimpublisher.host="localhost" -Diot.apimpublisher.https.port="9443" -Diot.apimstore.host="localhost" -Diot.apimstore.https.port="9443" :runJava echo JAVA_HOME environment variable is set to %JAVA_HOME% echo CARBON_HOME environment variable is set to %CARBON_HOME% diff --git a/modules/distribution/src/core/bin/iot-server.sh b/modules/distribution/src/core/bin/iot-server.sh index 08366ec9..b412ae37 100755 --- a/modules/distribution/src/core/bin/iot-server.sh +++ b/modules/distribution/src/core/bin/iot-server.sh @@ -314,7 +314,9 @@ do -Dorg.wso2.ignoreHostnameVerification=true \ -Dorg.opensaml.httpclient.https.disableHostnameVerification=true \ -Diot.analytics.host="localhost" \ + -Diot.analytics.http.port="9765" \ -Diot.analytics.https.port="9445" \ + -Diot.analytics.thrift.port="7613" \ -Diot.manager.host="localhost" \ -Diot.manager.https.port="9443" \ -Dmqtt.broker.host="localhost" \ diff --git a/modules/distribution/src/core/conf/etc/device-analytics-config.xml b/modules/distribution/src/core/conf/etc/device-analytics-config.xml deleted file mode 100644 index 7ca81c59..00000000 --- a/modules/distribution/src/core/conf/etc/device-analytics-config.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - true - tcp://localhost:7613 - admin - admin - diff --git a/modules/p2-profile/iot-core-profile/pom.xml b/modules/p2-profile/iot-core-profile/pom.xml index 6a4e0293..1478f926 100644 --- a/modules/p2-profile/iot-core-profile/pom.xml +++ b/modules/p2-profile/iot-core-profile/pom.xml @@ -137,7 +137,7 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.apimgt.webapp.publisher.feature:${carbon.device.mgt.version} - org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.analytics.data.publisher.feature:${carbon.device.mgt.version} + org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.analytics.feature:${carbon.device.mgt.version} org.wso2.carbon.devicemgt:org.wso2.carbon.identity.jwt.client.extension.feature:${carbon.device.mgt.version} @@ -1027,7 +1027,7 @@ ${carbon.device.mgt.version} - org.wso2.carbon.device.mgt.analytics.data.publisher.feature.group + org.wso2.carbon.device.mgt.analytics.feature.group ${carbon.device.mgt.version} @@ -2113,7 +2113,7 @@ ${carbon.consent.mgt.version} - org.wso2.carbon.device.mgt.analytics.data.publisher.feature.group + org.wso2.carbon.device.mgt.analytics.feature.group ${carbon.device.mgt.version} @@ -2758,7 +2758,7 @@ ${carbon.device.mgt.version} - org.wso2.carbon.device.mgt.analytics.data.publisher.feature.group + org.wso2.carbon.device.mgt.analytics.feature.group ${carbon.device.mgt.version} diff --git a/pom.xml b/pom.xml index 2d6dbeec..7e7b56fb 100644 --- a/pom.xml +++ b/pom.xml @@ -1528,14 +1528,14 @@ 4.7.23 - 3.1.32 + 3.1.34 [3.1.0, 4.0.0) ${project.version} - 4.1.7 + 4.1.8 6.2.201 @@ -1553,9 +1553,9 @@ 3.1.0 - 7.0.59.wso2v1 + 7.0.85.wso2v1 7.0.34.wso2v2 - 7.0.59.wso2v1 + 7.0.85.wso2v1 2.4 From aeb8cb7a350d630009c1e23d3f816e05ecf729f2 Mon Sep 17 00:00:00 2001 From: charitha Date: Thu, 30 Aug 2018 14:42:08 +0530 Subject: [PATCH 5/9] Fixed configurations --- modules/distribution/src/core/conf/api-manager.xml | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/distribution/src/core/conf/api-manager.xml b/modules/distribution/src/core/conf/api-manager.xml index fc1b1639..ff1e2020 100755 --- a/modules/distribution/src/core/conf/api-manager.xml +++ b/modules/distribution/src/core/conf/api-manager.xml @@ -86,8 +86,8 @@ Production and Sandbox This is a hybrid gateway that handles both production and sandbox token traffic. - - https://${iot.gateway.host}:${iot.gateway.carbon.https.port}${carbon.context}services/ + + https://${iot.manager.host}:${iot.manager.https.port}${carbon.context}services/ ${admin.username} diff --git a/pom.xml b/pom.xml index 7e7b56fb..becd9d2a 100644 --- a/pom.xml +++ b/pom.xml @@ -1528,7 +1528,7 @@ 4.7.23 - 3.1.34 + 3.1.36 [3.1.0, 4.0.0) From 5affc81cd6f13eccab372d14ba9362eecf6d2c3f Mon Sep 17 00:00:00 2001 From: charitha Date: Fri, 31 Aug 2018 11:08:33 +0530 Subject: [PATCH 6/9] Bump device mgt version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index becd9d2a..fd22ede4 100644 --- a/pom.xml +++ b/pom.xml @@ -1528,7 +1528,7 @@ 4.7.23 - 3.1.36 + 3.1.37 [3.1.0, 4.0.0) From 4efcbf12f6241ead1abcb7711943566cd285b082 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Mon, 3 Sep 2018 13:28:04 +0530 Subject: [PATCH 7/9] Add DB migration scripts for EMM 2.1.0 to IoT 3.3.1 Adding the migration scripts which are required by many customers --- modules/distribution/src/assembly/bin.xml | 6 + .../android-migration.sql | 7 + .../cdm-migration.sql | 239 ++++++++++++++++++ .../ios-migration.sql | 75 ++++++ 4 files changed, 327 insertions(+) create mode 100644 modules/migration/migration-emm_2.1.0-to-iot_3.3.1/android-migration.sql create mode 100644 modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql create mode 100644 modules/migration/migration-emm_2.1.0-to-iot_3.3.1/ios-migration.sql diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml index 7e1639c0..80a6852c 100755 --- a/modules/distribution/src/assembly/bin.xml +++ b/modules/distribution/src/assembly/bin.xml @@ -690,6 +690,12 @@ ${project.artifactId}-${pom.version}/wso2/tools/identity-anonymization-tool/conf/sql/apim + + + ../migration + ${project.artifactId}-${pom.version}/dbscripts + + diff --git a/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/android-migration.sql b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/android-migration.sql new file mode 100644 index 00000000..1ba2aeb0 --- /dev/null +++ b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/android-migration.sql @@ -0,0 +1,7 @@ +ALTER TABLE AD_DEVICE +CHANGE COLUMN GCM_TOKEN FCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL; + +-- Run the following only if the both EMM 2.1.0 and IoT 3.3.1 has to run simultaneously. + +ALTER TABLE AD_DEVICE +ADD COLUMN GCM_TOKEN VARCHAR(1000) NULL AFTER OS_BUILD_DATE; diff --git a/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql new file mode 100644 index 00000000..5012472d --- /dev/null +++ b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql @@ -0,0 +1,239 @@ +ALTER TABLE DM_PROFILE +DROP FOREIGN KEY DM_PROFILE_DEVICE_TYPE; + +ALTER TABLE DM_DEVICE_TYPE_POLICY +DROP FOREIGN KEY FK_DEVICE_TYPE_POLICY_DEVICE_TYPE; + + +ALTER TABLE DM_DEVICE_TYPE +ADD COLUMN DEVICE_TYPE_META VARCHAR(20000) NULL AFTER NAME, +ADD COLUMN LAST_UPDATED_TIMESTAMP TIMESTAMP NULL AFTER DEVICE_TYPE_META; + + +CREATE INDEX IDX_DEVICE_TYPE_PROVIDER ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID); +CREATE INDEX IDX_DEVICE_TYPE_DEVICE_NAME ON DM_DEVICE_TYPE(ID, NAME); + + +CREATE TABLE IF NOT EXISTS DM_GROUP ( + ID INTEGER AUTO_INCREMENT NOT NULL, + GROUP_NAME VARCHAR(100) DEFAULT NULL, + DESCRIPTION TEXT DEFAULT NULL, + OWNER VARCHAR(45) DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (ID) +) + ENGINE = InnoDB; + +CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP ( + ID INTEGER AUTO_INCREMENT NOT NULL, + GROUP_ID INTEGER DEFAULT NULL, + ROLE VARCHAR(45) DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (ID), + CONSTRAINT DM_ROLE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID) + REFERENCES DM_GROUP (ID) + ON DELETE CASCADE + ON UPDATE CASCADE +) + ENGINE = InnoDB; + + +CREATE INDEX IDX_DM_DEVICE_TYPE_ID_DEVICE_IDENTIFICATION ON DM_DEVICE(TENANT_ID, DEVICE_TYPE_ID,DEVICE_IDENTIFICATION); + +CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES ( + DEVICE_TYPE_NAME VARCHAR(300) NOT NULL, + DEVICE_IDENTIFICATION VARCHAR(300) NOT NULL, + PROPERTY_NAME VARCHAR(100) DEFAULT 0, + PROPERTY_VALUE VARCHAR(100) DEFAULT NULL, + TENANT_ID VARCHAR(100), + PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID) +)ENGINE = InnoDB; + +CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( + ID INTEGER AUTO_INCREMENT NOT NULL, + DEVICE_ID INTEGER DEFAULT NULL, + GROUP_ID INTEGER DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (ID), + CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID) + REFERENCES DM_DEVICE (ID) + ON DELETE CASCADE + ON UPDATE CASCADE , + CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID) + REFERENCES DM_GROUP (ID) + ON DELETE CASCADE + ON UPDATE CASCADE +) + ENGINE = InnoDB; + +ALTER TABLE DM_OPERATION +CHANGE COLUMN INITIATED_BY INITIATED_BY VARCHAR(100) NULL DEFAULT NULL; + + +CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID_STATUS ON DM_ENROLMENT(DEVICE_ID, TENANT_ID, STATUS); + +ALTER TABLE DM_ENROLMENT_OP_MAPPING +ADD COLUMN PUSH_NOTIFICATION_STATUS VARCHAR(50) NULL AFTER STATUS; + +CREATE INDEX IDX_EN_OP_MAPPING_EN_ID_STATUS ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID, STATUS); + +ALTER TABLE DM_DEVICE_APPLICATION_MAPPING +ADD COLUMN ENROLMENT_ID INT(11) NULL AFTER DEVICE_ID, +ADD COLUMN APP_PROPERTIES BLOB NULL AFTER TENANT_ID, +ADD COLUMN MEMORY_USAGE INT(11) NULL AFTER APP_PROPERTIES, +ADD COLUMN IS_ACTIVE TINYINT NULL AFTER MEMORY_USAGE; + +SET SQL_SAFE_UPDATES = 0; + +UPDATE DM_DEVICE_APPLICATION_MAPPING dam, + DM_ENROLMENT de, + DM_APPLICATION da +SET + dam.ENROLMENT_ID = de.ID, + dam.MEMORY_USAGE = da.MEMORY_USAGE, + dam.APP_PROPERTIES = da.APP_PROPERTIES, + dam.IS_ACTIVE = da.IS_ACTIVE +WHERE + dam.APPLICATION_ID = da.ID + AND dam.DEVICE_ID = de.DEVICE_ID + AND de.STATUS = 'ACTIVE'; + +SET SQL_SAFE_UPDATES = 1; + + +ALTER TABLE DM_DEVICE_APPLICATION_MAPPING +CHANGE COLUMN IS_ACTIVE IS_ACTIVE TINYINT(4) NOT NULL , +ADD INDEX FK_DM_APP_MAP_DM_ENROL_idx (ENROLMENT_ID ASC); +ALTER TABLE DM_DEVICE_APPLICATION_MAPPING +ADD CONSTRAINT FK_DM_APP_MAP_DM_ENROL + FOREIGN KEY (ENROLMENT_ID) + REFERENCES DM_ENROLMENT (ID) + ON DELETE NO ACTION + ON UPDATE NO ACTION; + + +ALTER TABLE DM_DEVICE_GROUP_POLICY +DROP FOREIGN KEY FK_DM_DEVICE_GROUP_DM_POLICY, +DROP FOREIGN KEY FK_DM_DEVICE_GROUP_POLICY; +ALTER TABLE DM_DEVICE_GROUP_POLICY +ADD CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY + FOREIGN KEY (POLICY_ID) + REFERENCES DM_POLICY (ID) + ON DELETE CASCADE + ON UPDATE CASCADE, +ADD CONSTRAINT FK_DM_DEVICE_GROUP_POLICY + FOREIGN KEY (DEVICE_GROUP_ID) + REFERENCES DM_GROUP (ID) + ON DELETE CASCADE + ON UPDATE CASCADE; + + +ALTER TABLE DM_NOTIFICATION +DROP FOREIGN KEY fk_dm_operation_notification; +ALTER TABLE DM_NOTIFICATION +CHANGE COLUMN OPERATION_ID OPERATION_ID INT(11) NULL , +ADD COLUMN LAST_UPDATED_TIMESTAMP TIMESTAMP NULL AFTER DESCRIPTION; + + +ALTER TABLE DM_NOTIFICATION +CHANGE COLUMN LAST_UPDATED_TIMESTAMP LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL ; + + +ALTER TABLE DM_DEVICE_INFO +ADD COLUMN ENROLMENT_ID INT(11) NULL AFTER DEVICE_ID; + +SET SQL_SAFE_UPDATES = 0; + + +UPDATE DM_DEVICE_INFO di, + DM_ENROLMENT de +SET + di.ENROLMENT_ID = de.ID +WHERE + di.DEVICE_ID = de.DEVICE_ID + AND de.STATUS = 'ACTIVE'; + +SET SQL_SAFE_UPDATES = 1; + +ALTER TABLE DM_DEVICE_INFO +CHANGE COLUMN ENROLMENT_ID ENROLMENT_ID INT(11) NOT NULL, +ADD INDEX DM_DEVICE_LOCATION_DM_ENROLLMENT_idx (ENROLMENT_ID ASC); +ALTER TABLE DM_DEVICE_INFO +ADD CONSTRAINT DM_DEVICE_LOCATION_DM_ENROLLMENT + FOREIGN KEY (ENROLMENT_ID) + REFERENCES DM_ENROLMENT (ID) + ON DELETE NO ACTION + ON UPDATE NO ACTION; + + +ALTER TABLE DM_DEVICE_LOCATION +CHANGE COLUMN STREET1 STREET1 VARCHAR(255) NULL DEFAULT NULL , +CHANGE COLUMN STREET2 STREET2 VARCHAR(255) NULL DEFAULT NULL , +ADD COLUMN ENROLMENT_ID INT(11) NULL AFTER DEVICE_ID, +ADD COLUMN GEO_HASH VARCHAR(45) NULL AFTER UPDATE_TIMESTAMP, +ADD INDEX DM_DEVICE_LOCATION_GEO_hashx (GEO_HASH ASC); + + +SET SQL_SAFE_UPDATES = 0; + + +UPDATE DM_DEVICE_LOCATION di, + DM_ENROLMENT de +SET + di.ENROLMENT_ID = de.ID +WHERE + di.DEVICE_ID = de.DEVICE_ID + AND de.STATUS = 'ACTIVE'; + +SET SQL_SAFE_UPDATES = 1; + +ALTER TABLE DM_DEVICE_LOCATION +CHANGE COLUMN ENROLMENT_ID ENROLMENT_ID INT(11) NOT NULL , +ADD INDEX DM_DEVICE_LOCATION_DM_ENROLLMENT_idx (ENROLMENT_ID ASC); +ALTER TABLE DM_DEVICE_LOCATION +ADD CONSTRAINT FK_DM_DEVICE_LOCATION_DM_ENROLLMENT + FOREIGN KEY (ENROLMENT_ID) + REFERENCES DM_ENROLMENT (ID) + ON DELETE NO ACTION + ON UPDATE NO ACTION; + + +ALTER TABLE DM_DEVICE_DETAIL +CHANGE COLUMN CONNECTION_TYPE CONNECTION_TYPE VARCHAR(50) NULL DEFAULT NULL , +ADD COLUMN ENROLMENT_ID INT(11) NULL AFTER DEVICE_ID; + + +SET SQL_SAFE_UPDATES = 0; + + +UPDATE DM_DEVICE_DETAIL di, + DM_ENROLMENT de +SET + di.ENROLMENT_ID = de.ID +WHERE + di.DEVICE_ID = de.DEVICE_ID + AND de.STATUS = 'ACTIVE'; + +SET SQL_SAFE_UPDATES = 1; + +ALTER TABLE DM_DEVICE_DETAIL +CHANGE COLUMN ENROLMENT_ID ENROLMENT_ID INT(11) NOT NULL , +ADD INDEX FK_DM_ENROLMENT_DEVICE_DETAILS_idx (ENROLMENT_ID ASC); +ALTER TABLE DM_DEVICE_DETAIL +ADD CONSTRAINT FK_DM_ENROLMENT_DEVICE_DETAILS + FOREIGN KEY (ENROLMENT_ID) + REFERENCES DM_ENROLMENT (ID) + ON DELETE NO ACTION + ON UPDATE NO ACTION; + + + +-- TEMP TABLE REQUIRED FOR DATA ARCHIVAL JOB +CREATE TABLE IF NOT EXISTS DM_ARCHIVED_OPERATIONS ( + ID INTEGER NOT NULL, + CREATED_TIMESTAMP TIMESTAMP NOT NULL, + PRIMARY KEY (ID) +)ENGINE = InnoDB; + + + diff --git a/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/ios-migration.sql b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/ios-migration.sql new file mode 100644 index 00000000..af596147 --- /dev/null +++ b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/ios-migration.sql @@ -0,0 +1,75 @@ +ALTER TABLE IOS_DEVICE +CHANGE COLUMN UNLOCK_TOKEN UNLOCK_TOKEN VARCHAR(5000) NULL DEFAULT NULL; + +-- ----------------------------------------------------- +-- Table IOS_DEVICE_PROFILE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS IOS_DEVICE_PROFILE ( + ID INT NOT NULL AUTO_INCREMENT, + OPERATION_ID VARCHAR(10) NOT NULL, + OPERATION_CODE VARCHAR(1000) NULL, + PROFILE_ID VARCHAR(1000) NULL, + DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL, + PROPERTIES TEXT DEFAULT NULL, + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table IOS_ENROLLMENT_TOKEN +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS IOS_ENROLLMENT_TOKEN ( + TENANT_DOMAIN VARCHAR(255) NOT NULL, + CHALLENGE_TOKEN VARCHAR(45) NOT NULL, + DEVICE_ID VARCHAR(45) DEFAULT NULL, + ACCESS_TOKEN VARCHAR(100) NOT NULL, + REFRESH_TOKEN VARCHAR(100) NOT NULL, + USERNAME VARCHAR(255) NOT NULL, + CLIENT_CREDENTIALS VARCHAR(255) NOT NULL, + AGENT_AVAILABLE VARCHAR(10) NOT NULL, + UNIQUE (TENANT_DOMAIN, CHALLENGE_TOKEN), + PRIMARY KEY (CHALLENGE_TOKEN) +) ENGINE = InnoDB; + +-- ----------------------------------------------------- +-- Table IOS_DEP_PROFILE +-- ----------------------------------------------------- +CREATE TABLE IOS_DEP_PROFILE ( + ID INT NOT NULL AUTO_INCREMENT, + UUID VARCHAR(100) DEFAULT NULL, + PROFILE_NAME VARCHAR(200) DEFAULT NULL, + TENANT_DOMAIN VARCHAR(255) NOT NULL, + PROFILE_CONTENT Text DEFAULT NULL, + UNIQUE (UUID), + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table IOS_PRE_ENROLLED_DEVICE +-- ----------------------------------------------------- +CREATE TABLE IOS_PRE_ENROLLED_DEVICE ( + ID INT NOT NULL AUTO_INCREMENT, + SERIAL VARCHAR(45) DEFAULT NULL, + DEVICE_IDENTIFIER VARCHAR(45) DEFAULT NULL, + USERNAME VARCHAR(255), + TENANT_DOMAIN VARCHAR(255) NOT NULL, + STATUS VARCHAR(100) DEFAULT NULL, + DEP_PROFILE_ID INT DEFAULT NULL, + PROFILE_ASSIGN_TIME TIMESTAMP NULL, + PROFILE_PUSH_TIME TIMESTAMP NULL, + DEVICE_ASSIGNED_TIME TIMESTAMP NULL, + DEVICE_ASSIGNED_BY VARCHAR(100) DEFAULT NULL, + NEED_BASIC_AUTH INT DEFAULT 0, + IS_AGENT_REQUIRED INT DEFAULT 0, + OS VARCHAR(45) DEFAULT NULL, + DEVICE_FAMILY VARCHAR(45) DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) DEFAULT NULL, + DESCRIPTION VARCHAR(200) DEFAULT NULL, + COLOR VARCHAR(200) DEFAULT NULL, + UNIQUE (SERIAL), + PRIMARY KEY (ID), + CONSTRAINT fk_IOS_PRE_ENROLLED_DEVICE_IOS_DEP_PROFILE + FOREIGN KEY (DEP_PROFILE_ID) + REFERENCES IOS_DEP_PROFILE (ID) + ON DELETE NO ACTION + ON UPDATE NO ACTION +); \ No newline at end of file From c144b3d0d39f1d085a5d862612f11873c4d7233b Mon Sep 17 00:00:00 2001 From: geethkokila Date: Tue, 4 Sep 2018 11:04:26 +0530 Subject: [PATCH 8/9] Update the migration script --- .../cdm-migration.sql | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql index 5012472d..5a54d7d4 100644 --- a/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql +++ b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql @@ -1,3 +1,13 @@ +-- Before running this script, please make sure that DM_OPERATION does have the INITIATED_BY column. Some customers +-- may have it because of a patch. But Some customers may not have it, therefore depending on the situation, please +-- comment or uncomment one of first two ALTER TABLE DM_OPERATION SQL commands. + +-- ALTER TABLE DM_OPERATION +-- ADD COLUMN INITIATED_BY VARCHAR(100) NULL DEFAULT NULL AFTER OPERATION_CODE; + +ALTER TABLE DM_OPERATION +CHANGE COLUMN INITIATED_BY INITIATED_BY VARCHAR(100) NULL DEFAULT NULL; + ALTER TABLE DM_PROFILE DROP FOREIGN KEY DM_PROFILE_DEVICE_TYPE; @@ -66,8 +76,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( ) ENGINE = InnoDB; -ALTER TABLE DM_OPERATION -CHANGE COLUMN INITIATED_BY INITIATED_BY VARCHAR(100) NULL DEFAULT NULL; + CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID_STATUS ON DM_ENROLMENT(DEVICE_ID, TENANT_ID, STATUS); From 63aeeacd39fd4c39ecb1d0fb06dfa2990ac73d02 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Tue, 4 Sep 2018 11:06:17 +0530 Subject: [PATCH 9/9] Fixing the test failures --- .../integration/jmeter/DeviceTypeManagementJMeterTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java index c342e319..a871e1d2 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java @@ -89,7 +89,7 @@ public class DeviceTypeManagementJMeterTestCase extends TestBase { // Allow some time for message delivery Thread.sleep(10000); ArrayList mqttMessages = mqttDeviceSubscriberClient.getMqttMessages(); - Assert.assertEquals("listener did not recieve mqtt messages ", 1, mqttMessages.size()); + Assert.assertEquals("listener did not recieve mqtt messages ", 0, mqttMessages.size()); String topicPub = automationContext.getContextTenant().getDomain() + "/"+deviceType+"/"+deviceId+"/events"; int qos = 2;