From 5117bbd6cd9492397259670ec396aeb9010a3249 Mon Sep 17 00:00:00 2001 From: Sabrina Abecasis <105439827+sabecasismulesoft@users.noreply.github.com> Date: Tue, 5 Dec 2023 22:58:40 -0300 Subject: [PATCH 1/7] W-14600313 - Check activemq version before proceeding to set the URL properties --- .../ActiveMQConnectionFactoryProvider.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java b/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java index b6d82463..dda2f25a 100644 --- a/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java +++ b/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java @@ -132,13 +132,37 @@ private String setPropertiesInURL(String brokerURL, String factoryClass, if (isSslFactoryClass(factoryClass)) { URI brokerURI = createURI(brokerURL); Map map = (brokerURI.getQuery() != null) ? URISupport.parseQuery(brokerURI.getQuery()) : new HashMap<>(); - map.put(VERIFY_HOSTNAME, String.valueOf(factoryConfiguration.getVerifyHostName())); + if (isVerifyHostnameValidVersion(getActiveMqClientVersion(factoryClass))) { + map.put(VERIFY_HOSTNAME, String.valueOf(factoryConfiguration.getVerifyHostName())); + } brokerURI = URISupport.createRemainingURI(brokerURI, map); return brokerURI.toString(); } return brokerURL; } + private String getActiveMqClientVersion(String factoryClass) { + String version = null; + try { + version = Class.forName(factoryClass).getPackage().getImplementationVersion(); + } catch (ClassNotFoundException e) { + LOGGER.debug(e.getMessage()); + return null; + } + return version; + } + + private boolean isVerifyHostnameValidVersion(String activemqClientVersion) { + boolean isVerifyHostnameVersion = false; + if (activemqClientVersion != null) { + String minorVersion = + activemqClientVersion.substring(activemqClientVersion.indexOf(".") + 1, activemqClientVersion.lastIndexOf(".")); + String patchVersion = activemqClientVersion.substring(activemqClientVersion.lastIndexOf(".") + 1); + isVerifyHostnameVersion = Integer.parseInt(minorVersion) >= 15 && Integer.parseInt(patchVersion) >= 6; + } + return isVerifyHostnameVersion; + } + private boolean isSslFactoryClass(String factoryClass) { return factoryClass == ACTIVEMQ_XA_SSL_CONNECTION_FACTORY_CLASS || factoryClass == ACTIVEMQ_SSL_CONNECTION_FACTORY_CLASS; From 4a75dcde5d4b379b98fd65150b2f9295ff4ce4a4 Mon Sep 17 00:00:00 2001 From: Sabrina Abecasis <105439827+sabecasismulesoft@users.noreply.github.com> Date: Tue, 5 Dec 2023 23:02:40 -0300 Subject: [PATCH 2/7] refactored code --- .../provider/activemq/ActiveMQConnectionFactoryProvider.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java b/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java index dda2f25a..48d56dec 100644 --- a/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java +++ b/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java @@ -147,7 +147,6 @@ private String getActiveMqClientVersion(String factoryClass) { version = Class.forName(factoryClass).getPackage().getImplementationVersion(); } catch (ClassNotFoundException e) { LOGGER.debug(e.getMessage()); - return null; } return version; } From 1d6c0e9315399462fc51c543ec40d95d4a004401 Mon Sep 17 00:00:00 2001 From: Sabrina Abecasis <105439827+sabecasismulesoft@users.noreply.github.com> Date: Mon, 11 Dec 2023 16:13:42 -0300 Subject: [PATCH 3/7] changing ports and url to fix tests --- pom.xml | 298 ++++++++++++----------- src/test/munit/activemq-config.xml | 2 +- src/test/munit/xa/activemq-xa-config.xml | 6 +- src/test/resources/activemq.properties | 3 + 4 files changed, 158 insertions(+), 151 deletions(-) create mode 100644 src/test/resources/activemq.properties diff --git a/pom.xml b/pom.xml index b80fdef4..dd4559ec 100644 --- a/pom.xml +++ b/pom.xml @@ -133,7 +133,6 @@ provided - org.apache.activemq @@ -269,30 +268,30 @@ - - org.codehaus.mojo - build-helper-maven-plugin - ${maven.helper.plugin.version} - - - reserve-network-port - generate-test-resources - - reserve-network-port - - - - activemq.listener.port - activemq.ssl.listener.port - activemq.web_console.port - connection.lost.port - connection.broken.port - toxiproxy.port - - - - - + + + + + + + + + + + + + + + + + + + + + + + + org.apache.maven.plugins @@ -408,128 +407,128 @@ - - - docker - - true - - - - - io.fabric8 - docker-maven-plugin - ${docker.maven.plugin.version} - - - - mule-activemq-ssl - activemq - - ${project.basedir}/src/test/docker/tls - - - - - nofile - 10240 - 10240 - - - - ${activemq.listener.port}:61616 - ${activemq.ssl.listener.port}:61617 - ${activemq.web_console.port}:8161 - - - true - - - ActiveMQ Jolokia REST API available - - - - - - shopify/toxiproxy - toxiproxy - - - ${toxiproxy.port}:8474 - ${connection.lost.port}:${connection.lost.port} - ${connection.broken.port}:${connection.broken.port} - - - activemq - - - - - true - - - - org.slf4j - slf4j-api - 2.0.7 - - - org.slf4j - jcl-over-slf4j - 2.0.7 - - - - - start - pre-integration-test - - build - start - - - true - true - - - - stop - clean - - stop - remove - - - - - - - - - docker-windows - - - windows - - - - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - true - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -553,6 +552,11 @@ Mule Repository https://repository.mulesoft.org/nexus/content/repositories/public/ + + ext-releases + Mule External Libraries Repository + https://repository-master.mulesoft.org/nexus/content/repositories/ext-releases + diff --git a/src/test/munit/activemq-config.xml b/src/test/munit/activemq-config.xml index c9ecba09..1cad1871 100644 --- a/src/test/munit/activemq-config.xml +++ b/src/test/munit/activemq-config.xml @@ -6,7 +6,7 @@ http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd"> - + diff --git a/src/test/munit/xa/activemq-xa-config.xml b/src/test/munit/xa/activemq-xa-config.xml index 406ccac5..3d143773 100644 --- a/src/test/munit/xa/activemq-xa-config.xml +++ b/src/test/munit/xa/activemq-xa-config.xml @@ -27,7 +27,7 @@ http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/ - + @@ -39,7 +39,7 @@ http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/ - + @@ -52,7 +52,7 @@ http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/ - + diff --git a/src/test/resources/activemq.properties b/src/test/resources/activemq.properties new file mode 100644 index 00000000..00545bc1 --- /dev/null +++ b/src/test/resources/activemq.properties @@ -0,0 +1,3 @@ +activemq.host=54.204.209.199 +activemq.web_console.port=8161 +activemq.listener.port=61616 From ce795f5f1a92eba224d34e795f5a517fd7cf7f35 Mon Sep 17 00:00:00 2001 From: Sabrina Abecasis <105439827+sabecasismulesoft@users.noreply.github.com> Date: Tue, 12 Dec 2023 07:35:22 -0300 Subject: [PATCH 4/7] reverted some changes --- .../ActiveMQConnectionFactoryProvider.java | 27 ++----------------- src/test/munit/common/common-flows.xml | 4 +-- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java b/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java index 48d56dec..16a84fb8 100644 --- a/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java +++ b/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java @@ -128,40 +128,17 @@ private void applyVendorSpecificConnectionFactoryProperties(ConnectionFactory co private String setPropertiesInURL(String brokerURL, String factoryClass, ActiveMQConnectionFactoryConfiguration factoryConfiguration) - throws URISyntaxException { + throws URISyntaxException { if (isSslFactoryClass(factoryClass)) { URI brokerURI = createURI(brokerURL); Map map = (brokerURI.getQuery() != null) ? URISupport.parseQuery(brokerURI.getQuery()) : new HashMap<>(); - if (isVerifyHostnameValidVersion(getActiveMqClientVersion(factoryClass))) { - map.put(VERIFY_HOSTNAME, String.valueOf(factoryConfiguration.getVerifyHostName())); - } + map.put(VERIFY_HOSTNAME, String.valueOf(factoryConfiguration.getVerifyHostName())); brokerURI = URISupport.createRemainingURI(brokerURI, map); return brokerURI.toString(); } return brokerURL; } - private String getActiveMqClientVersion(String factoryClass) { - String version = null; - try { - version = Class.forName(factoryClass).getPackage().getImplementationVersion(); - } catch (ClassNotFoundException e) { - LOGGER.debug(e.getMessage()); - } - return version; - } - - private boolean isVerifyHostnameValidVersion(String activemqClientVersion) { - boolean isVerifyHostnameVersion = false; - if (activemqClientVersion != null) { - String minorVersion = - activemqClientVersion.substring(activemqClientVersion.indexOf(".") + 1, activemqClientVersion.lastIndexOf(".")); - String patchVersion = activemqClientVersion.substring(activemqClientVersion.lastIndexOf(".") + 1); - isVerifyHostnameVersion = Integer.parseInt(minorVersion) >= 15 && Integer.parseInt(patchVersion) >= 6; - } - return isVerifyHostnameVersion; - } - private boolean isSslFactoryClass(String factoryClass) { return factoryClass == ACTIVEMQ_XA_SSL_CONNECTION_FACTORY_CLASS || factoryClass == ACTIVEMQ_SSL_CONNECTION_FACTORY_CLASS; diff --git a/src/test/munit/common/common-flows.xml b/src/test/munit/common/common-flows.xml index 75ab33ad..b05d3f93 100644 --- a/src/test/munit/common/common-flows.xml +++ b/src/test/munit/common/common-flows.xml @@ -7,9 +7,9 @@ http://www.mulesoft.org/schema/mule/munit-tools http://www.mulesoft.org/schema/mule/munit-tools/current/mule-munit-tools.xsd http://www.mulesoft.org/schema/mule/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> - + - + From d8257b3a296b170c8b8cd1c9cceb0aeeea019659 Mon Sep 17 00:00:00 2001 From: Sabrina Abecasis <105439827+sabecasismulesoft@users.noreply.github.com> Date: Tue, 12 Dec 2023 08:15:12 -0300 Subject: [PATCH 5/7] added changes to fix pipeline --- src/test/munit/reconnection/reconnection-config.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/munit/reconnection/reconnection-config.xml b/src/test/munit/reconnection/reconnection-config.xml index d0a7f90f..14401bae 100644 --- a/src/test/munit/reconnection/reconnection-config.xml +++ b/src/test/munit/reconnection/reconnection-config.xml @@ -7,6 +7,7 @@ http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd http://www.mulesoft.org/schema/mule/ee/bti http://www.mulesoft.org/schema/mule/ee/bti/current/mule-bti-ee.xsd"> + From 07db0f494cec6e07af42973d201442c3b2ac0315 Mon Sep 17 00:00:00 2001 From: Sabrina Abecasis <105439827+sabecasismulesoft@users.noreply.github.com> Date: Tue, 12 Dec 2023 08:18:04 -0300 Subject: [PATCH 6/7] applied format --- .../provider/activemq/ActiveMQConnectionFactoryProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java b/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java index 16a84fb8..b6d82463 100644 --- a/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java +++ b/src/main/java/org/mule/extensions/jms/internal/connection/provider/activemq/ActiveMQConnectionFactoryProvider.java @@ -128,7 +128,7 @@ private void applyVendorSpecificConnectionFactoryProperties(ConnectionFactory co private String setPropertiesInURL(String brokerURL, String factoryClass, ActiveMQConnectionFactoryConfiguration factoryConfiguration) - throws URISyntaxException { + throws URISyntaxException { if (isSslFactoryClass(factoryClass)) { URI brokerURI = createURI(brokerURL); Map map = (brokerURI.getQuery() != null) ? URISupport.parseQuery(brokerURI.getQuery()) : new HashMap<>(); From bf26a9f3899e7ba80b026984cf2d1b7ecc18ad82 Mon Sep 17 00:00:00 2001 From: Sabrina Abecasis <105439827+sabecasismulesoft@users.noreply.github.com> Date: Tue, 12 Dec 2023 09:15:55 -0300 Subject: [PATCH 7/7] changed config for tests --- pom.xml | 44 +++++++++---------- .../reconnection/reconnection-config.xml | 1 - 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index dd4559ec..6ea7615a 100644 --- a/pom.xml +++ b/pom.xml @@ -268,30 +268,30 @@ - - - - - - - - - - - - - + + org.codehaus.mojo + build-helper-maven-plugin + ${maven.helper.plugin.version} + + + reserve-network-port + generate-test-resources + + reserve-network-port + + + - + activemq.ssl.listener.port - - - - - - - - + connection.lost.port + connection.broken.port + toxiproxy.port + + + + + org.apache.maven.plugins diff --git a/src/test/munit/reconnection/reconnection-config.xml b/src/test/munit/reconnection/reconnection-config.xml index 14401bae..d0a7f90f 100644 --- a/src/test/munit/reconnection/reconnection-config.xml +++ b/src/test/munit/reconnection/reconnection-config.xml @@ -7,7 +7,6 @@ http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd http://www.mulesoft.org/schema/mule/ee/bti http://www.mulesoft.org/schema/mule/ee/bti/current/mule-bti-ee.xsd"> -