You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zh...@apache.org on 2022/11/02 08:41:35 UTC
[camel-quarkus] branch main updated: Adding a test for custom ConnectionFactory without quarkus.artemis.url (#4228)
This is an automated email from the ASF dual-hosted git repository.
zhfeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new ffb13f065c Adding a test for custom ConnectionFactory without quarkus.artemis.url (#4228)
ffb13f065c is described below
commit ffb13f065c66f45f4a30a09a2f6a546c5ea3a8f0
Author: Zheng Feng <zh...@gmail.com>
AuthorDate: Wed Nov 2 16:41:30 2022 +0800
Adding a test for custom ConnectionFactory without quarkus.artemis.url (#4228)
* Upgrade quarkus-artemis to 2.0.0
* Fix #2857 adding a test for custom ConnectionFactory without quarkus.artemis.url
---
integration-tests/jms-artemis-client/pom.xml | 5 +++
.../jms/artemis/it/CustomConnectionFactory.java | 36 ++++++++++++++++++
.../src/main/resources/application.properties | 13 ++-----
.../jms/artemis/it/CustomArtemisTestResource.java | 26 +++++++++++++
.../jms/artemis/it/JmsArtemisCustomTest.java | 28 ++++++++++++++
.../jms/artemis/it/JmsArtemisDisable.java | 33 ++++++++++++++++
.../src/test/resources/broker-custom.xml | 44 ++++++++++++++++++++++
.../jta/src/main/resources/application.properties | 2 +-
.../src/main/resources/application.properties | 12 +-----
.../src/main/resources/application.properties | 12 +-----
pom.xml | 2 +-
11 files changed, 181 insertions(+), 32 deletions(-)
diff --git a/integration-tests/jms-artemis-client/pom.xml b/integration-tests/jms-artemis-client/pom.xml
index e3850ea1c0..1931d046c8 100644
--- a/integration-tests/jms-artemis-client/pom.xml
+++ b/integration-tests/jms-artemis-client/pom.xml
@@ -65,6 +65,11 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>io.quarkiverse.artemis</groupId>
+ <artifactId>quarkus-test-artemis</artifactId>
+ <scope>test</scope>
+ </dependency>
<!-- Inherit base messaging tests -->
<dependency>
diff --git a/integration-tests/jms-artemis-client/src/main/java/org/apache/camel/quarkus/component/jms/artemis/it/CustomConnectionFactory.java b/integration-tests/jms-artemis-client/src/main/java/org/apache/camel/quarkus/component/jms/artemis/it/CustomConnectionFactory.java
new file mode 100644
index 0000000000..d3ae62b64f
--- /dev/null
+++ b/integration-tests/jms-artemis-client/src/main/java/org/apache/camel/quarkus/component/jms/artemis/it/CustomConnectionFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.apache.camel.quarkus.component.jms.artemis.it;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+import javax.jms.ConnectionFactory;
+
+import io.quarkus.arc.properties.UnlessBuildProperty;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.eclipse.microprofile.config.ConfigProvider;
+
+@Dependent
+public class CustomConnectionFactory {
+ @Produces
+ @UnlessBuildProperty(name = "quarkus.artemis.enabled", stringValue = "true")
+ ConnectionFactory createConnectionFactory() {
+ String url = ConfigProvider.getConfig().getValue("artemis.custom.url", String.class);
+ ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(url);
+ return cf;
+ }
+}
diff --git a/integration-tests/jta/src/main/resources/application.properties b/integration-tests/jms-artemis-client/src/main/resources/application.properties
similarity index 77%
copy from integration-tests/jta/src/main/resources/application.properties
copy to integration-tests/jms-artemis-client/src/main/resources/application.properties
index 878d6e22e2..fe7754fc47 100644
--- a/integration-tests/jta/src/main/resources/application.properties
+++ b/integration-tests/jms-artemis-client/src/main/resources/application.properties
@@ -14,14 +14,7 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-
#
-# Quarkus :: DS
-#
-quarkus.datasource.camel-ds.jdbc.url=jdbc:h2:tcp://localhost/mem:test
-quarkus.datasource.camel-ds.db-kind=h2
-quarkus.datasource.camel-ds.jdbc.max-size=8
-quarkus.datasource.camel-ds.jdbc.transactions=xa
-
-# Quarkus :: Artemis
-quarkus.artemis.xa.enabled=true
+# Overridden to false via @TestProfile(JmsArtemisDisable.class) for some tests
+# When false, we produce a custom ConnectionFactory via CustomConnectionFactory producer bean
+quarkus.artemis.enabled=true
diff --git a/integration-tests/jms-artemis-client/src/test/java/org/apache/camel/quarkus/component/jms/artemis/it/CustomArtemisTestResource.java b/integration-tests/jms-artemis-client/src/test/java/org/apache/camel/quarkus/component/jms/artemis/it/CustomArtemisTestResource.java
new file mode 100644
index 0000000000..44f170bd06
--- /dev/null
+++ b/integration-tests/jms-artemis-client/src/test/java/org/apache/camel/quarkus/component/jms/artemis/it/CustomArtemisTestResource.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.apache.camel.quarkus.component.jms.artemis.it;
+
+import io.quarkus.artemis.test.ArtemisTestResource;
+
+public class CustomArtemisTestResource extends ArtemisTestResource {
+ public CustomArtemisTestResource() {
+ super("artemis", "custom");
+ }
+
+}
diff --git a/integration-tests/jms-artemis-client/src/test/java/org/apache/camel/quarkus/component/jms/artemis/it/JmsArtemisCustomTest.java b/integration-tests/jms-artemis-client/src/test/java/org/apache/camel/quarkus/component/jms/artemis/it/JmsArtemisCustomTest.java
new file mode 100644
index 0000000000..45759b60c4
--- /dev/null
+++ b/integration-tests/jms-artemis-client/src/test/java/org/apache/camel/quarkus/component/jms/artemis/it/JmsArtemisCustomTest.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.apache.camel.quarkus.component.jms.artemis.it;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
+import org.apache.camel.quarkus.messaging.jms.AbstractJmsMessagingTest;
+
+@QuarkusTest
+@TestProfile(JmsArtemisDisable.class)
+@QuarkusTestResource(CustomArtemisTestResource.class)
+public class JmsArtemisCustomTest extends AbstractJmsMessagingTest {
+}
diff --git a/integration-tests/jms-artemis-client/src/test/java/org/apache/camel/quarkus/component/jms/artemis/it/JmsArtemisDisable.java b/integration-tests/jms-artemis-client/src/test/java/org/apache/camel/quarkus/component/jms/artemis/it/JmsArtemisDisable.java
new file mode 100644
index 0000000000..dd7524a04a
--- /dev/null
+++ b/integration-tests/jms-artemis-client/src/test/java/org/apache/camel/quarkus/component/jms/artemis/it/JmsArtemisDisable.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.apache.camel.quarkus.component.jms.artemis.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+
+public class JmsArtemisDisable implements QuarkusTestProfile {
+ @Override
+ public Map<String, String> getConfigOverrides() {
+ Map<String, String> props = new HashMap<>();
+ props.put("quarkus.artemis.enabled", "false");
+ return props;
+ }
+
+}
diff --git a/integration-tests/jms-artemis-client/src/test/resources/broker-custom.xml b/integration-tests/jms-artemis-client/src/test/resources/broker-custom.xml
new file mode 100644
index 0000000000..c968d52ab0
--- /dev/null
+++ b/integration-tests/jms-artemis-client/src/test/resources/broker-custom.xml
@@ -0,0 +1,44 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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.
+
+-->
+<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
+ <core xmlns="urn:activemq:core">
+ <paging-directory>./target/artemis/default/paging</paging-directory>
+ <bindings-directory>./target/artemis/default/bindings</bindings-directory>
+ <journal-directory>./target/artemis/default/journal</journal-directory>
+ <large-messages-directory>./target/artemis/default/large-messages</large-messages-directory>
+
+ <connectors>
+ <connector name="activemq">tcp://localhost:61616</connector>
+ </connectors>
+ <acceptors>
+ <acceptor name="activemq">tcp://localhost:61616</acceptor>
+ </acceptors>
+
+ <max-disk-usage>-1</max-disk-usage>
+ <security-enabled>false</security-enabled>
+
+ <addresses>
+ <address name="test-jms-default">
+ <anycast>
+ <queue name="test-jms-default"/>
+ </anycast>
+ </address>
+ </addresses>
+ </core>
+</configuration>
diff --git a/integration-tests/jta/src/main/resources/application.properties b/integration-tests/jta/src/main/resources/application.properties
index 878d6e22e2..d1747d84cc 100644
--- a/integration-tests/jta/src/main/resources/application.properties
+++ b/integration-tests/jta/src/main/resources/application.properties
@@ -24,4 +24,4 @@ quarkus.datasource.camel-ds.jdbc.max-size=8
quarkus.datasource.camel-ds.jdbc.transactions=xa
# Quarkus :: Artemis
-quarkus.artemis.xa.enabled=true
+quarkus.artemis.xa-enabled=true
diff --git a/integration-tests/jta/src/main/resources/application.properties b/integration-tests/sjms-artemis-client/src/main/resources/application.properties
similarity index 77%
copy from integration-tests/jta/src/main/resources/application.properties
copy to integration-tests/sjms-artemis-client/src/main/resources/application.properties
index 878d6e22e2..62c187bd7d 100644
--- a/integration-tests/jta/src/main/resources/application.properties
+++ b/integration-tests/sjms-artemis-client/src/main/resources/application.properties
@@ -14,14 +14,6 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-
#
-# Quarkus :: DS
-#
-quarkus.datasource.camel-ds.jdbc.url=jdbc:h2:tcp://localhost/mem:test
-quarkus.datasource.camel-ds.db-kind=h2
-quarkus.datasource.camel-ds.jdbc.max-size=8
-quarkus.datasource.camel-ds.jdbc.transactions=xa
-
-# Quarkus :: Artemis
-quarkus.artemis.xa.enabled=true
+# Let Quarkus Artemis extension produce the ConnectionFactory
+quarkus.artemis.enabled=true
diff --git a/integration-tests/jta/src/main/resources/application.properties b/integration-tests/sjms2-artemis-client/src/main/resources/application.properties
similarity index 77%
copy from integration-tests/jta/src/main/resources/application.properties
copy to integration-tests/sjms2-artemis-client/src/main/resources/application.properties
index 878d6e22e2..62c187bd7d 100644
--- a/integration-tests/jta/src/main/resources/application.properties
+++ b/integration-tests/sjms2-artemis-client/src/main/resources/application.properties
@@ -14,14 +14,6 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-
#
-# Quarkus :: DS
-#
-quarkus.datasource.camel-ds.jdbc.url=jdbc:h2:tcp://localhost/mem:test
-quarkus.datasource.camel-ds.db-kind=h2
-quarkus.datasource.camel-ds.jdbc.max-size=8
-quarkus.datasource.camel-ds.jdbc.transactions=xa
-
-# Quarkus :: Artemis
-quarkus.artemis.xa.enabled=true
+# Let Quarkus Artemis extension produce the ConnectionFactory
+quarkus.artemis.enabled=true
diff --git a/pom.xml b/pom.xml
index efdeadad74..50a5953acd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
<debezium.version>1.9.6.Final</debezium.version><!-- May go back to Camel's ${debezium-version} when they are in sync https://repo1.maven.org/maven2/io/debezium/debezium-bom/ -->
<optaplanner.version>8.29.0.Final</optaplanner.version><!-- May go back to Camel's ${optaplanner-version} when they are in sync https://repo1.maven.org/maven2/org/optaplanner/optaplanner-quarkus/ -->
<quarkiverse-amazonservices.version>1.3.1</quarkiverse-amazonservices.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/amazonservices/quarkus-amazon-services-parent/ -->
- <quarkiverse-artemis.version>1.2.0</quarkiverse-artemis.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/artemis/quarkus-artemis-parent/ -->
+ <quarkiverse-artemis.version>2.0.0</quarkiverse-artemis.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/artemis/quarkus-artemis-parent/ -->
<quarkiverse-cxf.version>1.5.5</quarkiverse-cxf.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/cxf/quarkus-cxf-parent/ -->
<quarkiverse-freemarker.version>0.3.0</quarkiverse-freemarker.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/freemarker/quarkus-freemarker-parent/ -->
<quarkiverse-jackson-jq.version>1.1.0</quarkiverse-jackson-jq.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/jackson-jq/quarkus-jackson-jq-parent/ -->