diff --git a/integration-test/pom.xml b/integration-test/pom.xml index 4405cc0..db46ed3 100644 --- a/integration-test/pom.xml +++ b/integration-test/pom.xml @@ -106,7 +106,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.4 @@ -117,7 +116,6 @@ maven-resources-plugin - 2.6 copy-resources-jks diff --git a/integration-test/src/test/java/io/entgra/community/iots/integration/test/common/extensions/CarbonServerManagerExtension.java b/integration-test/src/test/java/io/entgra/community/iots/integration/test/common/extensions/CarbonServerManagerExtension.java index 16c6f1e..efd3511 100644 --- a/integration-test/src/test/java/io/entgra/community/iots/integration/test/common/extensions/CarbonServerManagerExtension.java +++ b/integration-test/src/test/java/io/entgra/community/iots/integration/test/common/extensions/CarbonServerManagerExtension.java @@ -22,8 +22,11 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.DirectoryFileFilter; import org.apache.commons.io.filefilter.RegexFileFilter; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import org.wso2.carbon.automation.engine.context.AutomationContext; import org.wso2.carbon.automation.engine.context.beans.User; import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; @@ -40,6 +43,7 @@ import javax.xml.xpath.XPathExpressionException; import java.io.File; import java.io.IOException; import java.util.Collection; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -53,6 +57,7 @@ public class CarbonServerManagerExtension { private ServerLogReader inputStreamHandler; private ServerLogReader errorStreamHandler; private boolean isCoverageEnable = false; + private Set coverageClassesDirectories = new HashSet(); private String coverageDumpFilePath; private int portOffset = 0; private static final String SERVER_SHUTDOWN_MESSAGE = "Halting JVM"; @@ -183,6 +188,7 @@ public class CarbonServerManagerExtension { try { this.isCoverageEnable = Boolean.parseBoolean(this.automationContext.getConfigurationValue("//coverage")); + this.coverageClassesDirectories = this.getCoverageClassesDirectories(this.automationContext); } catch (XPathExpressionException var8) { throw new AutomationFrameworkException("Coverage configuration not found in automation.xml", var8); } @@ -196,6 +202,28 @@ public class CarbonServerManagerExtension { } } + private Set getCoverageClassesDirectories(AutomationContext automationContext) throws XPathExpressionException { + Set coverageDirectories = new HashSet(); + Node configurationNode = automationContext.getConfigurationNode("//coverageClassesRelativeDirectories"); + if (configurationNode != null) { + NodeList childNodes = configurationNode.getChildNodes(); + if (childNodes != null) { + for(int i = 0; i <= childNodes.getLength() - 1; ++i) { + Node node = childNodes.item(i); + if (node != null && "coverageClassesRelativeDirectory".equals(node.getNodeName())) { + coverageDirectories.add(node.getTextContent()); + } + } + } + } else if (StringUtils.isNotEmpty(automationContext.getConfigurationValue("//coverageClassesRelativeDirectory"))) { + coverageDirectories.add(automationContext.getConfigurationValue("//coverageClassesRelativeDirectory")); + } else { + coverageDirectories.add("repository" + File.separator + "components" + File.separator + "plugins" + File.separator); + } + + return coverageDirectories; + } + public synchronized void serverShutdown(int portOffset) throws AutomationFrameworkException { if(this.process != null) { log.info("Shutting down server.."); @@ -235,8 +263,7 @@ public class CarbonServerManagerExtension { if(this.isCoverageEnable) { try { log.info("Generating Jacoco code coverage..."); - this.generateCoverageReport(new File(this.carbonHome + File.separator + "repository" - + File.separator + "components" + File.separator + "plugins" + File.separator)); + this.generateCoverageReport(this.coverageClassesDirectories); } catch (IOException var7) { log.error("Failed to generate code coverage ", var7); throw new AutomationFrameworkException("Failed to generate code coverage ", var7); @@ -250,7 +277,7 @@ public class CarbonServerManagerExtension { } - private void generateCoverageReport(File classesDir) throws IOException, AutomationFrameworkException { + private void generateCoverageReport(Set classesDir) throws IOException, AutomationFrameworkException { checkJacocoDataFileSizes(FrameworkPathUtil.getJacocoCoverageHome()); CodeCoverageUtils.executeMerge(FrameworkPathUtil.getJacocoCoverageHome(), FrameworkPathUtil.getCoverageMergeFilePath()); ReportGenerator reportGenerator = new ReportGenerator(new File(FrameworkPathUtil.getCoverageMergeFilePath()), classesDir, new File(CodeCoverageUtils.getJacocoReportDirectory()), (File)null); diff --git a/iot-core/pom.xml b/iot-core/pom.xml index 6aa2aa7..42e6b3b 100644 --- a/iot-core/pom.xml +++ b/iot-core/pom.xml @@ -51,7 +51,6 @@ org.apache.maven.plugins maven-dependency-plugin - 3.2.0 extract-pack @@ -67,7 +66,7 @@ ${wso2am-nexus-artifact-version} zip true - ${project.basedir}/target/wso2am-${wso2am-nexus-artifact-version} + ${project.basedir}/target wso2am-${wso2am-nexus-artifact-version} @@ -253,7 +252,6 @@ org.wso2.maven carbon-p2-plugin - ${carbon.p2.plugin.version} 2-p2-repo-generation @@ -581,7 +579,6 @@ com.google.code.maven-replacer-plugin replacer - 1.5.3 package diff --git a/iot-core/src/assembly/bin.xml b/iot-core/src/assembly/bin.xml index e32f2cc..f146e04 100644 --- a/iot-core/src/assembly/bin.xml +++ b/iot-core/src/assembly/bin.xml @@ -51,7 +51,7 @@ ${basedir}/target/${wso2am} ${entgra-iot-core} - + **/repository/conf/tomcat/context.xml **/repository/conf/deployment.toml @@ -92,10 +92,6 @@ src/core/conf/input-event-adapters.xml ${entgra-iot-core}/repository/conf/ - - src/core/conf/output-event-adapters.xml.j2 - ${entgra-iot-core}/repository/resources/conf/templates/repository/conf - src/core/keystores/wso2carbon.jks ${entgra-iot-core}/repository/resources/security/ @@ -115,7 +111,6 @@ ${entgra-iot-core}/repository/components/dropins io.entgra.device.mgt.core:io.entgra.device.mgt.core.device.mgt.oauth.extensions - io.entgra.device.mgt.core:io.entgra.device.mgt.core.apimgt.keymgt.extension diff --git a/iot-core/src/core/bin/iot-server.bat b/iot-core/src/core/bin/iot-server.bat index 2bee15e..1149f02 100755 --- a/iot-core/src/core/bin/iot-server.bat +++ b/iot-core/src/core/bin/iot-server.bat @@ -172,13 +172,13 @@ set CMD=RUN %* :checkJdk17 PATH %PATH%;%JAVA_HOME%\bin\ for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do set "JAVA_VERSION=%%j%%k" -if %JAVA_VERSION% LSS 17 goto unknownJdk -if %JAVA_VERSION% GTR 110 goto unknownJdk +if %JAVA_VERSION% LSS 110 goto unknownJdk +if %JAVA_VERSION% GTR 170 goto unknownJdk goto jdk17 :unknownJdk echo Starting WSO2 Carbon (in unsupported JDK) -echo [ERROR] CARBON is supported only on JDK 1.7, 1.8, 9, 10 and 11 +echo [ERROR] CARBON is supported only between JDK 11 and JDK 17 goto jdk17 :jdk17 @@ -203,7 +203,7 @@ set CARBON_CLASSPATH=".\lib\*";%CARBON_CLASSPATH% if %JAVA_VERSION% GEQ 110 set CARBON_CLASSPATH=".\lib\endorsed\*";%CARBON_CLASSPATH% if %JAVA_VERSION% LEQ 18 set JAVA_VER_BASED_OPTS=-Djava.endorsed.dirs=".\lib\endorsed";"%JAVA_HOME%\jre\lib\endorsed";"%JAVA_HOME%\lib\endorsed" -if %JAVA_VERSION% GEQ 110 set JAVA_VER_BASED_OPTS=--add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED +if %JAVA_VERSION% GEQ 110 set JAVA_VER_BASED_OPTS=--add-opens=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED set CMD_LINE_ARGS=-Xbootclasspath/a:%CARBON_XBOOTCLASSPATH% -Xms256m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%CARBON_HOME%\repository\logs\heap-dump.hprof" set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Dcom.sun.management.jmxremote -classpath %CARBON_CLASSPATH% %JAVA_OPTS% %JAVA_VER_BASED_OPTS% @@ -217,6 +217,9 @@ set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Dcom.atomikos.icatch.hide_init_file_path="tru set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dcom.sun.jndi.ldap.connect.pool.authentication=simple -Dcom.sun.jndi.ldap.connect.pool.timeout=3000 set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Dorg.terracotta.quartz.skipUpdateCheck=true -Dcarbon.classpath=%CARBON_CLASSPATH% -Dfile.encoding=UTF8 -DworkerNode=false -Dcarbon.new.config.dir.path="%CARBON_HOME%\repository\resources\conf" set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -Dorg.wso2.ignoreHostnameVerification=true -Dorg.opensaml.httpclient.https.disableHostnameVerification=true -Dhttpclient.hostnameVerifier="DefaultAndLocalhost" +set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Dlog4j2.contextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector" +set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Dorg.ops4j.pax.logging.logReaderEnabled="false" +set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Dorg.ops4j.pax.logging.eventAdminEnabled="false" set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Diot.core.host="localhost" -Diot.core.https.port="9443" -Diot.core.http.port="9763" -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.gateway.websocket.ws.port="9099" -Diot.gateway.websocket.wss.port="8099" -Diot.remotesession.server.host="localhost" -Diot.remotesession.server.https.port="9443" set CMD_LINE_ARGS=%CMD_LINE_ARGS% -Dmqtt.broker.host="localhost" -Dmqtt.broker.port="1883" diff --git a/iot-core/src/core/bin/iot-server.sh b/iot-core/src/core/bin/iot-server.sh index 238ba73..6854e2d 100755 --- a/iot-core/src/core/bin/iot-server.sh +++ b/iot-core/src/core/bin/iot-server.sh @@ -235,9 +235,9 @@ fi # ---------- Handle the SSL Issue with proper JDK version -------------------- java_version=$("$JAVACMD" -version 2>&1 | awk -F '"' '/version/ {print $2}') java_version_formatted=$(echo "$java_version" | awk -F. '{printf("%02d%02d",$1,$2);}') -if [ $java_version_formatted -lt 0107 ] || [ $java_version_formatted -gt 1100 ]; then +if [ $java_version_formatted -lt 1100 ] || [ $java_version_formatted -gt 1700 ]; then echo " Starting WSO2 Carbon (in unsupported JDK)" - echo " [ERROR] CARBON is supported only on JDK 1.7, 1.8, 9, 10 and 11" + echo " [ERROR] CARBON is supported only between JDK 11 and JDK 17" fi CARBON_XBOOTCLASSPATH="" @@ -307,11 +307,10 @@ echo "Using Java memory options: $JVM_MEM_OPTS" #To monitor a Carbon server in remote JMX mode on linux host machines, set the below system property. # -Djava.rmi.server.hostname="your.IP.goes.here" -JAVA_VER_BASED_OPTS="" +JAVA_VER_BASED_OPTS="--add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED" - -if [ $java_version_formatted -ge 1100 ]; then - JAVA_VER_BASED_OPTS="--add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED" +if [ $java_version_formatted -ge 1700 ]; then + JAVA_VER_BASED_OPTS="$JAVA_VER_BASED_OPTS --add-opens=java.naming/com.sun.jndi.ldap=ALL-UNNAMED" fi while [ "$status" = "$START_EXIT_STATUS" ] @@ -354,6 +353,9 @@ do -DenableCorrelationLogs=false \ -Dcarbon.new.config.dir.path="$CARBON_HOME/repository/resources/conf" \ -Djavax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom=net.sf.saxon.xpath.XPathFactoryImpl \ + -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector \ + -Dorg.ops4j.pax.logging.logReaderEnabled=false \ + -Dorg.ops4j.pax.logging.eventAdminEnabled=false \ -Diot.core.host="localhost" \ -Diot.core.https.port="9443" \ -Diot.core.http.port="9763" \ @@ -378,4 +380,4 @@ do -Diot.reporting.webapp.host="" \ org.wso2.carbon.bootstrap.Bootstrap $* status=$? -done +done \ No newline at end of file diff --git a/iot-core/src/core/conf/deployment.toml b/iot-core/src/core/conf/deployment.toml index 15f4538..141b4fe 100644 --- a/iot-core/src/core/conf/deployment.toml +++ b/iot-core/src/core/conf/deployment.toml @@ -282,4 +282,20 @@ grant_validator="io.entgra.device.mgt.core.device.mgt.oauth.extensions.validator renew_refresh_token=false [device_mgt_conf.pull_notification_conf] -enabled=false \ No newline at end of file +enabled=false + +[[output_adapter.custom_output_adapter]] +adapter.type = "oauth-mqtt" +[adapter.properties] +minThread = 8 +maxThread = 100 +keepAliveTimeInMillis = 20000 +jobQueueSize = 10000 +connectionKeepAliveInterval = 60 +dcrUrl = "https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.17/register" +tokenUrl = "https://${iot.gateway.host}:${iot.gateway.https.port}/token" +url = "tcp://${mqtt.broker.host}:${mqtt.broker.port}" +username = "${admin.username}" +password = "${admin.password}" +qos = 2 +clearSession = true diff --git a/iot-core/src/core/conf/input-event-adapters.xml b/iot-core/src/core/conf/input-event-adapters.xml index 7f40dee..382c94b 100644 --- a/iot-core/src/core/conf/input-event-adapters.xml +++ b/iot-core/src/core/conf/input-event-adapters.xml @@ -18,21 +18,6 @@ - - - 8 - 100 - 20000 - 10000 - 60 - https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.17/register - tcp://${mqtt.broker.host}:${mqtt.broker.port} - admin - admin - deviceid-topic-content-validator - true - - 8 100 @@ -53,4 +38,18 @@ 10000 + + + 8 + 100 + 20000 + 10000 + 60 + https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.17/register + tcp://${mqtt.broker.host}:${mqtt.broker.port} + admin + admin + deviceid-topic-content-validator + true + \ No newline at end of file diff --git a/iot-core/src/core/conf/output-event-adapters.xml.j2 b/iot-core/src/core/conf/output-event-adapters.xml.j2 deleted file mode 100644 index 9eef009..0000000 --- a/iot-core/src/core/conf/output-event-adapters.xml.j2 +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - tcp://localhost:7612 - ssl://localhost:7712 - tcp://localhost:9612 - ssl://localhost:9712 - - - - VARCHAR(255) - DOUBLE - INT - BIGINT - FLOAT - BOOL - CREATE TABLE $TABLE_NAME ($COLUMN_TYPES) - INSERT INTO $TABLE_NAME ($COLUMNS) VALUES ($VALUES) - SELECT * FROM $TABLE_NAME limit 1 - UPDATE $TABLE_NAME SET $COLUMN_VALUES WHERE $CONDITION - , - ? - = - AND - SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$TABLE_NAME' - SELECT $COLUMNS FROM $TABLE_NAME - varchar2(255) - CLOB - BINARY_DOUBLE - SELECT * FROM $TABLE_NAME WHERE ROWNUM = 1 - SELECT COLUMN_NAME, DATA_TYPE FROM USER_TAB_COLS WHERE TABLE_NAME = '$TABLE_NAME' - varchar2(255) - SELECT TOP 1 * FROM $TABLE_NAME - SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$TABLE_NAME' - varchar2(255) - REAL - SHOW COLUMNS FROM $TABLE_NAME - - - - - 8 - 100 - 20000 - 10000 - - 50 - 1000 - - - - - {{output_adapter.jms.min_thread}} - {{output_adapter.jms.max_thread}} - {{output_adapter.jms.keep_alive_time}} - {{output_adapter.jms.job_queue_size}} - - - - - 8 - 100 - 20000 - 10000 - 60 - - - - - 8 - 100 - 20000 - 10000 - - - - - {{output_adapter.email.from_address}} - {{output_adapter.email.username}} - {{output_adapter.email.password}} - {{output_adapter.email.hostname}} - {{output_adapter.email.port}} - {{output_adapter.email.enable_start_tls}} - {{output_adapter.email.enable_authentication}} - {{output_adapter.email.signature}} - {{output_adapter.email.reply_to}} - {% if output_adapter.email.custom_properties is defined %} - - {% for property_name,property_value in output_adapter.email.custom_properties.items() %} - {{property_value}} - {% endfor %} - {% endif %} - - 8 - 100 - 20000 - 10000 - - - - 30 - - 8 - 100 - 20000 - 10000 - - - - - 8 - 100 - 20000 - 10000 - - - - - 8 - 100 - 20000 - 10000 - - - - - 8 - 100 - 20000 - 10000 - - 10000 - true - true - 50 - - - - - 8 - 100 - 20000 - 10000 - 60 - https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.17/register - https://${iot.gateway.host}:${iot.gateway.https.port}/token - tcp://${mqtt.broker.host}:${mqtt.broker.port} - admin - admin - 2 - true - - - \ No newline at end of file diff --git a/iot-core/src/core/samples/device-plugins-deployer.xml b/iot-core/src/core/samples/device-plugins-deployer.xml index c3b2455..430d02b 100644 --- a/iot-core/src/core/samples/device-plugins-deployer.xml +++ b/iot-core/src/core/samples/device-plugins-deployer.xml @@ -21,13 +21,13 @@ org.wso2 wso2 - 1 + 1.3 4.0.0 io.entgra.community.iots iot-devicetype-feature-installation - 5.2.1-SNAPSHOT + 5.2.2-SNAPSHOT pom Install Virtual Fire Alarm Device Types - IoT Core diff --git a/p2-profile/pom.xml b/p2-profile/pom.xml index 8638b38..effad9b 100644 --- a/p2-profile/pom.xml +++ b/p2-profile/pom.xml @@ -105,7 +105,6 @@ org.wso2.maven carbon-p2-plugin - ${carbon.p2.plugin.version} 2-p2-repo-generation @@ -178,7 +177,6 @@ com.google.code.maven-replacer-plugin replacer - 1.5.3 package diff --git a/pom.xml b/pom.xml index 9b6c4c6..dc7f129 100644 --- a/pom.xml +++ b/pom.xml @@ -85,27 +85,7 @@ org.wso2.carbon.automation org.wso2.carbon.automation.test.utils - ${test.framework.version} - - - org.slf4j - slf4j-api - - - org.apache.httpcomponents - httpclient - - - org.apache.httpcomponents - httpcore - - - test - - - org.wso2.carbon.automationutils - org.wso2.carbon.integration.common.utils - ${test.framework.version} + ${platform.integration.utils.version} org.slf4j @@ -270,42 +250,6 @@ - - org.wso2.carbon.automationutils - org.wso2.carbon.integration.common.admin.client - ${automation.utils.version} - test - - - org.slf4j - slf4j-api - - - org.apache.httpcomponents - httpclient - - - org.apache.httpcomponents - httpcore - - - org.wso2.carbon.commons - org.wso2.carbon.user.mgt.stub - - - org.wso2.carbon.commons - org.wso2.carbon.ndatasource.stub - - - org.wso2.carbon.commons - org.wso2.carbon.authenticator.stub - - - org.wso2.carbon - org.wso2.carbon.utils - - - com.google.code.gson gson @@ -316,27 +260,26 @@ - 4.0.0 - wso2am-4.0.0 + 4.2.0 + wso2am-4.2.0 io.entgra.community.iots.core-${project.version} entgra-iots-community-${project.version} - 5.1.1-SNAPSHOT + 5.2.4-SNAPSHOT 5.1.2 - 1.4.199.wso2v1 + 2.1.210.wso2v1 6.1.1-SNAPSHOT - 2.8.5 - 4.4.3 - 4.4.2 - 4.4.2 + 2.9.1 + 4.4.10 + 4.5.3 @@ -372,11 +315,11 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.1 + 3.8.1 UTF-8 - 1.8 - 1.8 + 11 + 11 @@ -394,23 +337,10 @@ - - org.apache.felix - maven-scr-plugin - 1.7.2 - - - generate-scr-scrdescriptor - - scr - - - - org.apache.felix maven-bundle-plugin - 2.3.5 + 3.2.0 true NONE @@ -457,6 +387,21 @@ true + + com.google.code.maven-replacer-plugin + replacer + 1.5.3 + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} +