You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2021/02/15 08:09:23 UTC

[camel] branch master updated (f3b688c -> b9cf7e2)

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from f3b688c  CAMEL-16193 - Use SecureRandom instead of Random - Camel-FTP
     new 01f6159  Enable TIA for failsafe plugin too
     new 5386cc0  Fix failing pulsar unit test
     new 2f5e601  Fix invalid profile id (for maven 4)
     new 33024ec  Reset print service after tests
     new 5c97f39  [CAMEL-16156] Improve the usage of org.apache.camel.jmx.disabled
     new cc7ec04  Correctly fix printer tests
     new b5cf64c  Raise the overall timeout for pulsar tests
     new 4fdef29  Merge remote-tracking branch 'origin/master'
     new f3f5844  Add missing header
     new 30d8594  Remove jms remoting test
     new b9cf7e2  Merge remote-tracking branch 'origin/master'

The 11 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 components/camel-cdi/pom.xml                       |  2 +-
 .../camel/component/jms/remoting/Calculator.java   | 22 ------
 .../apache/camel/component/jms/remoting/ISay.java  | 26 -------
 .../camel/component/jms/remoting/SayService.java   | 43 ------------
 components/camel-jmx/pom.xml                       |  2 +-
 components/camel-kubernetes/pom.xml                |  2 +-
 .../camel/component/printer/PrinterProducer.java   |  2 +-
 .../camel/component/printer/PrinterPrintTest.java  | 69 ++++++++++--------
 components/camel-pulsar/pom.xml                    | 15 ++++
 .../pulsar/PulsarConsumerAcknowledgementTest.java  | 73 ++++++++++---------
 .../pulsar/PulsarConsumerDeadLetterPolicyTest.java | 19 +++--
 ...omponentCamelContextSchedulerIsolationTest.java | 20 +-----
 components/camel-soap/pom.xml                      |  2 +-
 .../org/apache/camel/spring/SpringTestSupport.java |  7 +-
 .../apache/camel/spring/SpringCamelContext.java    | 54 ++-------------
 .../apache/camel/test/junit5/CamelTestSupport.java |  5 +-
 .../spring/junit5/CamelAnnotationsHandler.java     | 50 +++++--------
 .../camel/test/spring/CamelAnnotationsHandler.java | 50 +++++--------
 .../apache/camel/test/junit4/CamelTestSupport.java |  5 +-
 core/camel-core-engine/pom.xml                     |  2 +-
 .../org/apache/camel/impl/DefaultCamelContext.java | 81 ++++++++++++++++++++++
 core/camel-management-api/pom.xml                  |  2 +-
 core/camel-management/pom.xml                      |  2 +-
 parent/pom.xml                                     |  9 ++-
 tests/camel-itest/pom.xml                          |  2 +-
 .../pom.xml                                        |  2 +-
 .../src/it/simple-xml-dto-v3/pom.xml               |  2 +-
 .../src/it/simple-xml-dto/pom.xml                  |  2 +-
 .../src/it/simple-xml-v3/pom.xml                   |  2 +-
 .../src/it/simple-xml/pom.xml                      |  2 +-
 .../src/it/simple-xml-dto/pom.xml                  |  2 +-
 .../src/it/simple-xml/pom.xml                      |  2 +-
 32 files changed, 260 insertions(+), 320 deletions(-)
 delete mode 100644 components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/Calculator.java
 delete mode 100644 components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/ISay.java
 delete mode 100644 components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/SayService.java


[camel] 08/11: Merge remote-tracking branch 'origin/master'

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 4fdef29db470ee60560269400228fcd4a317bc39
Merge: b5cf64c 38e211d
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Feb 12 14:02:57 2021 +0100

    Merge remote-tracking branch 'origin/master'

 .../camel/spring/spi/CamelBeanPostProcessor.java   | 207 +++++++++++++++++++++
 .../ROOT/pages/camel-3x-upgrade-guide-3_9.adoc     |   5 +
 2 files changed, 212 insertions(+)


[camel] 10/11: Remove jms remoting test

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 30d8594e8afe4f5cc2a515a305a54585482de759
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Feb 12 15:23:19 2021 +0100

    Remove jms remoting test
---
 .../camel/component/jms/remoting/Calculator.java   | 22 ----------
 .../apache/camel/component/jms/remoting/ISay.java  | 26 -----------
 .../component/jms/remoting/JmsRemotingTest.java    | 38 ----------------
 .../camel/component/jms/remoting/SayService.java   | 43 ------------------
 .../apache/camel/component/jms/remoting/spring.xml | 51 ----------------------
 5 files changed, 180 deletions(-)

diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/Calculator.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/Calculator.java
deleted file mode 100644
index 772220e..0000000
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/Calculator.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.component.jms.remoting;
-
-public interface Calculator {
-
-    int add(int op1, int op2);
-}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/ISay.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/ISay.java
deleted file mode 100644
index 2a0a047..0000000
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/ISay.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.component.jms.remoting;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-public interface ISay extends Remote {
-
-    String say(String name) throws RemoteException;
-
-}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/JmsRemotingTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/JmsRemotingTest.java
deleted file mode 100644
index 3866645..0000000
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/JmsRemotingTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.component.jms.remoting;
-
-import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
-import org.junit.jupiter.api.Test;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-public class JmsRemotingTest extends CamelSpringTestSupport {
-
-    @Override
-    protected ClassPathXmlApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/remoting/spring.xml");
-    }
-
-    @Test
-    public void testRemoting() throws Exception {
-        ISay proxy = applicationContext.getBean("sayProxy", ISay.class);
-        String rc = proxy.say("Camel");
-        assertEquals("Hello Camel", rc);
-    }
-}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/SayService.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/SayService.java
deleted file mode 100644
index 717cf7c..0000000
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/SayService.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.component.jms.remoting;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SayService implements ISay {
-
-    private static final Logger LOG = LoggerFactory.getLogger(SayService.class);
-    private String message = "Hello";
-
-    public SayService() {
-    }
-
-    @Override
-    public String say(String name) {
-        LOG.info("Invoking say() method with {}", name);
-        return message + " " + name;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    public void setMessage(String message) {
-        this.message = message;
-    }
-}
diff --git a/components/camel-jms/src/test/resources/org/apache/camel/component/jms/remoting/spring.xml b/components/camel-jms/src/test/resources/org/apache/camel/component/jms/remoting/spring.xml
deleted file mode 100644
index 940617a..0000000
--- a/components/camel-jms/src/test/resources/org/apache/camel/component/jms/remoting/spring.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:camel="http://camel.apache.org/schema/spring"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-    ">
-
-  <bean id="sayService" class="org.apache.camel.component.jms.remoting.SayService"/>
-
-  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-      <jmxAgent id="agent" disabled="true"/>
-    <!-- create the client proxy -->
-    <proxy id="sayProxy" serviceUrl="activemq:test.serviceQueue"
-           serviceInterface="org.apache.camel.component.jms.remoting.ISay"/>
-
-    <!-- export the service -->
-    <export id="say" uri="activemq:test.serviceQueue" serviceRef="sayService" method="say"
-            serviceInterface="org.apache.camel.component.jms.remoting.ISay"/>
-  </camelContext>
-
-  <!-- configure the ActiveMQ component -->
-  <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
-    <property name="connectionFactory">
-      <bean class="org.apache.activemq.spring.ActiveMQConnectionFactory">
-        <property name="brokerURL" value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/>
-        <property name="trustAllPackages" value="true"/>
-      </bean>
-    </property>
-  </bean>
-
-</beans>


[camel] 09/11: Add missing header

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f3f584418a61cdb320ebc1addc9c04aace09a9d3
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Feb 12 14:04:05 2021 +0100

    Add missing header
---
 .../apache/camel/spring/spi/CamelBeanPostProcessor.java  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/CamelBeanPostProcessor.java b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/CamelBeanPostProcessor.java
index ddbff8f..a8792f4 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/CamelBeanPostProcessor.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/CamelBeanPostProcessor.java
@@ -1,3 +1,19 @@
+/*
+ * 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.spring.spi;
 
 import java.util.LinkedHashSet;


[camel] 04/11: Reset print service after tests

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 33024ec8bd324254d010395bb79ff5874da50a44
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Feb 11 14:05:43 2021 +0100

    Reset print service after tests
---
 .../camel/component/printer/PrinterPrintTest.java  | 43 +++++++++++-----------
 1 file changed, 21 insertions(+), 22 deletions(-)

diff --git a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
index 9b30f6b..cc3b349 100644
--- a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
+++ b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
@@ -40,6 +40,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.camel.util.IOHelper;
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
@@ -47,6 +48,7 @@ import org.junit.jupiter.api.Test;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
@@ -60,6 +62,11 @@ public class PrinterPrintTest extends CamelTestSupport {
         setupJavaPrint();
     }
 
+    @AfterEach
+    public void tearDown() {
+        sun.awt.AppContext.getAppContext().put(PrintServiceLookup.class.getDeclaredClasses()[0], null);
+    }
+
     @Override
     public boolean isUseRouteBuilder() {
         return false;
@@ -137,9 +144,8 @@ public class PrinterPrintTest extends CamelTestSupport {
     @Test
     @Disabled
     public void testSendingFileToPrinter() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
+        assumeTrue(isAwtHeadless());
+
         context.addRoutes(new RouteBuilder() {
             public void configure() {
                 from("direct:start").to(
@@ -154,9 +160,8 @@ public class PrinterPrintTest extends CamelTestSupport {
     @Test
     @Disabled
     public void testSendingGIFToPrinter() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
+        assumeTrue(isAwtHeadless());
+
         context.addRoutes(new RouteBuilder() {
             public void configure() {
                 from("direct:start").to(
@@ -171,9 +176,8 @@ public class PrinterPrintTest extends CamelTestSupport {
     @Test
     @Disabled
     public void testSendingJPEGToPrinter() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
+        assumeTrue(isAwtHeadless());
+
         context.addRoutes(new RouteBuilder() {
             public void configure() {
                 from("direct:start").to("lpr://localhost/default?copies=2&flavor=DocFlavor.INPUT_STREAM"
@@ -188,9 +192,8 @@ public class PrinterPrintTest extends CamelTestSupport {
     @Test
     @Disabled
     public void testSendingJPEGToPrinterWithLandscapePageOrientation() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
+        assumeTrue(isAwtHeadless());
+
         context.addRoutes(new RouteBuilder() {
             public void configure() {
                 from("direct:start").to("lpr://localhost/default?flavor=DocFlavor.INPUT_STREAM"
@@ -209,9 +212,8 @@ public class PrinterPrintTest extends CamelTestSupport {
     @Test
     @Disabled
     public void testDefaultPrinterConfiguration() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
+        assumeTrue(isAwtHeadless());
+
         context.addRoutes(new RouteBuilder() {
             public void configure() {
                 from("direct:start").to("lpr://localhost/default?sendToPrinter=false");
@@ -281,10 +283,9 @@ public class PrinterPrintTest extends CamelTestSupport {
 
     @Test
     public void printerNameTest() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
-        // setup javax.print 
+        assumeTrue(isAwtHeadless());
+
+        // setup javax.print
         PrintService ps1 = mock(PrintService.class);
         when(ps1.getName()).thenReturn("MyPrinter\\\\remote\\printer1");
         when(ps1.isDocFlavorSupported(any(DocFlavor.class))).thenReturn(Boolean.TRUE);
@@ -340,9 +341,7 @@ public class PrinterPrintTest extends CamelTestSupport {
 
     @Test
     public void setJobName() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
+        assumeTrue(isAwtHeadless());
 
         getMockEndpoint("mock:output").setExpectedMessageCount(1);
         context.addRoutes(new RouteBuilder() {


[camel] 06/11: Correctly fix printer tests

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit cc7ec0414f12ae5d68d7752b183034140cd85a4b
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Feb 12 11:33:50 2021 +0100

    Correctly fix printer tests
---
 .../camel/component/printer/PrinterProducer.java   |  2 +-
 .../camel/component/printer/PrinterPrintTest.java  | 28 ++++++++++++++++------
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java b/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java
index 2bb08dc..dcc78bf 100644
--- a/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java
+++ b/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java
@@ -157,7 +157,7 @@ public class PrinterProducer extends DefaultProducer {
             // align slashes so we match / or \
             printerName = printerName.toLowerCase(Locale.US);
             printerName = printerName.replace('\\', '/');
-            if (printer.endsWith(printerName)) {
+            if (printer.endsWith(printerName) || printerName.endsWith(printer)) {
                 position = i;
                 break;
             }
diff --git a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
index cc3b349..87c5afe 100644
--- a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
+++ b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.printer;
 
 import java.io.FileInputStream;
 import java.io.InputStream;
+import java.lang.reflect.Method;
 import java.util.Map;
 
 import javax.print.Doc;
@@ -58,13 +59,13 @@ import static org.mockito.Mockito.when;
 public class PrinterPrintTest extends CamelTestSupport {
 
     @BeforeEach
-    public void setup() {
+    public void setup() throws Exception {
         setupJavaPrint();
     }
 
     @AfterEach
     public void tearDown() {
-        sun.awt.AppContext.getAppContext().put(PrintServiceLookup.class.getDeclaredClasses()[0], null);
+        restoreJavaPrint();
     }
 
     @Override
@@ -224,10 +225,7 @@ public class PrinterPrintTest extends CamelTestSupport {
 
     @Test
     public void moreThanOneLprEndpoint() throws Exception {
-
-        if (isAwtHeadless()) {
-            return;
-        }
+        assumeTrue(isAwtHeadless());
 
         int numberOfPrintservicesBefore = PrintServiceLookup.lookupPrintServices(null, null).length;
 
@@ -402,7 +400,18 @@ public class PrinterPrintTest extends CamelTestSupport {
         assertEquals("reverse-landscape", attribute.toString());
     }
 
-    protected void setupJavaPrint() {
+    Class<?> printServiceLookupServicesClass = PrintServiceLookup.class.getDeclaredClasses()[0];
+    Object printServiceLookup;
+
+    protected void setupJavaPrint() throws Exception {
+        // save the current print services
+        printServiceLookup = sun.awt.AppContext.getAppContext().get(printServiceLookupServicesClass);
+        // setup a new empty list of printer services
+        sun.awt.AppContext.getAppContext().put(printServiceLookupServicesClass, null);
+        Method method = PrintServiceLookup.class.getDeclaredMethod("initListOfLookupServices");
+        method.setAccessible(true);
+        method.invoke(null);
+
         // "install" another default printer
         PrintService psDefault = mock(PrintService.class);
         when(psDefault.getName()).thenReturn("DefaultPrinter");
@@ -421,4 +430,9 @@ public class PrinterPrintTest extends CamelTestSupport {
         PrintServiceLookup.registerServiceProvider(psLookup);
     }
 
+    protected void restoreJavaPrint() {
+        // restore print services
+        sun.awt.AppContext.getAppContext().put(printServiceLookupServicesClass, printServiceLookup);
+    }
+
 }


[camel] 02/11: Fix failing pulsar unit test

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 5386cc0fa39d3930250480636374563f993c7c21
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Feb 5 09:16:20 2021 +0100

    Fix failing pulsar unit test
---
 .../pulsar/PulsarConsumerAcknowledgementTest.java  | 73 ++++++++++++----------
 .../pulsar/PulsarConsumerDeadLetterPolicyTest.java | 19 +++---
 2 files changed, 53 insertions(+), 39 deletions(-)

diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerAcknowledgementTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerAcknowledgementTest.java
index 3019e8c..f0c3eb5 100644
--- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerAcknowledgementTest.java
+++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerAcknowledgementTest.java
@@ -18,9 +18,9 @@ package org.apache.camel.component.pulsar;
 
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.EndpointInject;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.pulsar.utils.AutoConfiguration;
@@ -43,27 +43,22 @@ import org.junit.jupiter.api.extension.RegisterExtension;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.camel.test.junit5.TestSupport.body;
-
 public class PulsarConsumerAcknowledgementTest extends CamelTestSupport {
 
     @RegisterExtension
     static PulsarService service = PulsarServiceFactory.createService();
 
     private static final Logger LOGGER = LoggerFactory.getLogger(PulsarConsumerAcknowledgementTest.class);
-    private static final String TOPIC_URI = "persistent://public/default/camel-topic-1";
+    private static final String TOPIC_URI = "persistent://public/default/camel-topic-";
 
-    @EndpointInject("pulsar:" + TOPIC_URI + "?numberOfConsumers=1&subscriptionType=Exclusive"
-                    + "&subscriptionName=camel-subscription&consumerQueueSize=1&consumerName=camel-consumer"
-                    + "&allowManualAcknowledgement=true" + "&ackTimeoutMillis=1000"
-                    + "&negativeAckRedeliveryDelayMicros=100000")
     private Endpoint from;
 
-    @EndpointInject("mock:result")
     private MockEndpoint to;
 
     private Producer<String> producer;
 
+    private static int topicId = 0;
+
     public String getPulsarBrokerUrl() {
         return service.getPulsarBrokerUrl();
     }
@@ -77,16 +72,25 @@ public class PulsarConsumerAcknowledgementTest extends CamelTestSupport {
         context.removeRoute("myRoute");
         String producerName = this.getClass().getSimpleName() + TestUtils.randomWithRange(1, 100);
 
-        producer = givenPulsarClient().newProducer(Schema.STRING).producerName(producerName).topic(TOPIC_URI).create();
+        String topicUri = PulsarConsumerAcknowledgementTest.TOPIC_URI + ++topicId;
+        producer = givenPulsarClient().newProducer(Schema.STRING).producerName(producerName).topic(topicUri).create();
+
+        from = context.getEndpoint("pulsar:" + topicUri + "?numberOfConsumers=1&subscriptionType=Exclusive"
+                                   + "&subscriptionName=camel-subscription&consumerQueueSize=1&consumerName=camel-consumer"
+                                   + "&allowManualAcknowledgement=true" + "&ackTimeoutMillis=1000"
+                                   + "&negativeAckRedeliveryDelayMicros=100000");
+        to = context.getEndpoint("mock:result", MockEndpoint.class);
     }
 
     @AfterEach
-    public void tearDownProducer() {
+    public void tearDownProducer() throws Exception {
+        from.close();
         try {
             producer.close();
         } catch (PulsarClientException e) {
             LOGGER.warn("Failed to close client: {}", e.getMessage(), e);
         }
+        context.removeRoute("myRoute");
     }
 
     @Override
@@ -115,12 +119,13 @@ public class PulsarConsumerAcknowledgementTest extends CamelTestSupport {
 
     @Test
     public void testAcknowledge() throws Exception {
-        to.expectsNoDuplicates(body());
+        to.expectedMessageCount(1);
+        to.expectedBodiesReceived("testAcknowledge: Hello World!");
 
         context.addRoutes(new RouteBuilder() {
             @Override
             public void configure() {
-                from(from).routeId("myRoute").to(to).process(exchange -> {
+                from(from).routeId("testAcknowledge:myRoute").to(to).process(exchange -> {
                     LOGGER.info("Processing message {}", exchange.getIn().getBody());
 
                     PulsarMessageReceipt receipt
@@ -130,19 +135,20 @@ public class PulsarConsumerAcknowledgementTest extends CamelTestSupport {
             }
         });
 
-        producer.send("Hello World!");
+        producer.send("testAcknowledge: Hello World!");
 
         MockEndpoint.assertIsSatisfied(10, TimeUnit.SECONDS, to);
     }
 
     @Test
     public void testAcknowledgeAsync() throws Exception {
-        to.expectsNoDuplicates(body());
+        to.expectedMessageCount(1);
+        to.expectedBodiesReceived("testAcknowledgeAsync: Hello World!");
 
         context.addRoutes(new RouteBuilder() {
             @Override
             public void configure() {
-                from(from).routeId("myRoute").to(to).process(exchange -> {
+                from(from).routeId("testAcknowledgeAsync:myRoute").to(to).process(exchange -> {
                     LOGGER.info("Processing message {}", exchange.getIn().getBody());
 
                     PulsarMessageReceipt receipt
@@ -157,51 +163,54 @@ public class PulsarConsumerAcknowledgementTest extends CamelTestSupport {
             }
         });
 
-        producer.send("Hello World!");
+        producer.send("testAcknowledgeAsync: Hello World!");
 
         MockEndpoint.assertIsSatisfied(10, TimeUnit.SECONDS, to);
     }
 
     @Test
     public void testAcknowledgeCumulative() throws Exception {
-        to.expectsNoDuplicates(body());
+        to.expectedMessageCount(2);
+        to.expectedBodiesReceived("testAcknowledgeCumulative: Hello World!", "testAcknowledgeCumulative: Hello World Again!");
 
         context.addRoutes(new RouteBuilder() {
             @Override
             public void configure() {
-                from(from).routeId("myRoute").to(to).process(exchange -> {
+                from(from).routeId("testAcknowledgeCumulative:myRoute").to(to).process(exchange -> {
                     LOGGER.info("Processing message {}", exchange.getIn().getBody());
 
                     PulsarMessageReceipt receipt
                             = (PulsarMessageReceipt) exchange.getIn().getHeader(PulsarMessageHeaders.MESSAGE_RECEIPT);
                     // Ack the second message. The first will also be acked.
-                    if (exchange.getIn().getBody().equals("Hello World Again!")) {
+                    if (exchange.getIn().getBody().equals("testAcknowledgeCumulative: Hello World Again!")) {
                         receipt.acknowledgeCumulative();
                     }
                 });
             }
         });
 
-        producer.send("Hello World!");
-        producer.send("Hello World Again!");
+        producer.send("testAcknowledgeCumulative: Hello World!");
+        producer.send("testAcknowledgeCumulative: Hello World Again!");
 
         MockEndpoint.assertIsSatisfied(10, TimeUnit.SECONDS, to);
     }
 
     @Test
     public void testAcknowledgeCumulativeAsync() throws Exception {
-        to.expectsNoDuplicates(body());
+        to.expectedMessageCount(2);
+        to.expectedBodiesReceived("testAcknowledgeCumulativeAsync: Hello World!",
+                "testAcknowledgeCumulativeAsync: Hello World Again!");
 
         context.addRoutes(new RouteBuilder() {
             @Override
             public void configure() {
-                from(from).routeId("myRoute").to(to).process(exchange -> {
+                from(from).routeId("testAcknowledgeCumulativeAsync:myRoute").to(to).process(exchange -> {
                     LOGGER.info("Processing message {}", exchange.getIn().getBody());
 
                     PulsarMessageReceipt receipt
                             = (PulsarMessageReceipt) exchange.getIn().getHeader(PulsarMessageHeaders.MESSAGE_RECEIPT);
                     // Ack the second message. The first will also be acked.
-                    if (exchange.getIn().getBody().equals("Hello World Again!")) {
+                    if (exchange.getIn().getBody().equals("testAcknowledgeCumulativeAsync: Hello World Again!")) {
                         try {
                             CompletableFuture<Void> f = receipt.acknowledgeCumulativeAsync();
                             f.get();
@@ -213,8 +222,8 @@ public class PulsarConsumerAcknowledgementTest extends CamelTestSupport {
             }
         });
 
-        producer.send("Hello World!");
-        producer.send("Hello World Again!");
+        producer.send("testAcknowledgeCumulativeAsync: Hello World!");
+        producer.send("testAcknowledgeCumulativeAsync: Hello World Again!");
 
         MockEndpoint.assertIsSatisfied(10, TimeUnit.SECONDS, to);
     }
@@ -222,16 +231,16 @@ public class PulsarConsumerAcknowledgementTest extends CamelTestSupport {
     @Test
     public void testNegativeAcknowledge() throws Exception {
         to.expectedMessageCount(2);
-        to.expectedBodiesReceived("Hello World!", "Hello World!");
+        to.expectedBodiesReceived("testNegativeAcknowledge: Hello World!", "testNegativeAcknowledge: Hello World!");
 
+        AtomicBoolean processed = new AtomicBoolean();
         context.addRoutes(new RouteBuilder() {
             @Override
             public void configure() {
-                from(from).routeId("myRoute").to(to).process(exchange -> {
+                from(from).routeId("testNegativeAcknowledge:myRoute").to(to).process(exchange -> {
                     LOGGER.info("Processing message {}", exchange.getIn().getBody());
 
-                    if (!Boolean.parseBoolean(exchange.getProperty("processedOnce", String.class))) {
-                        exchange.setProperty("processedOnce", "true");
+                    if (processed.compareAndSet(false, true)) {
                         PulsarMessageReceipt receipt = (PulsarMessageReceipt) exchange.getIn()
                                 .getHeader(PulsarMessageHeaders.MESSAGE_RECEIPT);
                         receipt.negativeAcknowledge();
@@ -244,7 +253,7 @@ public class PulsarConsumerAcknowledgementTest extends CamelTestSupport {
             }
         });
 
-        producer.newMessage().value("Hello World!").property("processedOnce", "false").send();
+        producer.newMessage().value("testNegativeAcknowledge: Hello World!").send();
 
         MockEndpoint.assertIsSatisfied(10, TimeUnit.SECONDS, to);
     }
diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerDeadLetterPolicyTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerDeadLetterPolicyTest.java
index a5a7ad7..31dd28c 100644
--- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerDeadLetterPolicyTest.java
+++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerDeadLetterPolicyTest.java
@@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
 
 public class PulsarConsumerDeadLetterPolicyTest extends PulsarTestSupport {
     private static final Logger LOGGER = LoggerFactory.getLogger(PulsarConsumerDeadLetterPolicyTest.class);
-    private static final String TOPIC_URI = "persistent://public/default/camel-topic";
+    private static final String TOPIC_URI = "persistent://public/default/camel-topic-";
 
     @EndpointInject("mock:result")
     private MockEndpoint to;
@@ -51,6 +51,10 @@ public class PulsarConsumerDeadLetterPolicyTest extends PulsarTestSupport {
 
     private Producer<String> producer;
 
+    private static int topicId = 0;
+
+    private String topicUri;
+
     @Override
     protected Registry createCamelRegistry() throws Exception {
         Registry registry = new SimpleRegistry();
@@ -81,7 +85,8 @@ public class PulsarConsumerDeadLetterPolicyTest extends PulsarTestSupport {
         }
         String producerName = this.getClass().getSimpleName() + TestUtils.randomWithRange(1, 100);
 
-        producer = givenPulsarClient().newProducer(Schema.STRING).producerName(producerName).topic(TOPIC_URI).create();
+        topicUri = PulsarConsumerDeadLetterPolicyTest.TOPIC_URI + ++topicId;
+        producer = givenPulsarClient().newProducer(Schema.STRING).producerName(producerName).topic(topicUri).create();
     }
 
     @AfterEach
@@ -97,7 +102,7 @@ public class PulsarConsumerDeadLetterPolicyTest extends PulsarTestSupport {
     public void givenNoMaxRedeliverCountAndDeadLetterTopicverifyValuesAreNull() throws Exception {
         PulsarComponent component = context.getComponent("pulsar", PulsarComponent.class);
 
-        PulsarEndpoint endpoint = (PulsarEndpoint) component.createEndpoint("pulsar:" + TOPIC_URI);
+        PulsarEndpoint endpoint = (PulsarEndpoint) component.createEndpoint("pulsar:" + topicUri);
 
         assertNull(endpoint.getPulsarConfiguration().getMaxRedeliverCount());
         assertNull(endpoint.getPulsarConfiguration().getDeadLetterTopic());
@@ -109,9 +114,9 @@ public class PulsarConsumerDeadLetterPolicyTest extends PulsarTestSupport {
         PulsarComponent component = context.getComponent("pulsar", PulsarComponent.class);
 
         PulsarEndpoint from = (PulsarEndpoint) component
-                .createEndpoint("pulsar:" + TOPIC_URI
+                .createEndpoint("pulsar:" + topicUri
                                 + "?maxRedeliverCount=5&subscriptionType=Shared&allowManualAcknowledgement=true&ackTimeoutMillis=1000");
-        PulsarEndpoint deadLetterFrom = (PulsarEndpoint) component.createEndpoint("pulsar:" + TOPIC_URI + "-subs-DLQ");
+        PulsarEndpoint deadLetterFrom = (PulsarEndpoint) component.createEndpoint("pulsar:" + topicUri + "-subs-DLQ");
 
         to.expectedMessageCount(5);
         deadLetter.expectedMessageCount(1);
@@ -134,7 +139,7 @@ public class PulsarConsumerDeadLetterPolicyTest extends PulsarTestSupport {
         PulsarComponent component = context.getComponent("pulsar", PulsarComponent.class);
 
         PulsarEndpoint from = (PulsarEndpoint) component
-                .createEndpoint("pulsar:" + TOPIC_URI
+                .createEndpoint("pulsar:" + topicUri
                                 + "?maxRedeliverCount=5&deadLetterTopic=customTopic&subscriptionType=Shared&allowManualAcknowledgement=true&ackTimeoutMillis=1000");
         PulsarEndpoint deadLetterFrom
                 = (PulsarEndpoint) component.createEndpoint("pulsar:persistent://public/default/customTopic");
@@ -159,7 +164,7 @@ public class PulsarConsumerDeadLetterPolicyTest extends PulsarTestSupport {
         PulsarComponent component = context.getComponent("pulsar", PulsarComponent.class);
 
         PulsarEndpoint from = (PulsarEndpoint) component
-                .createEndpoint("pulsar:" + TOPIC_URI
+                .createEndpoint("pulsar:" + topicUri
                                 + "?maxRedeliverCount=5&deadLetterTopic=customTopic&subscriptionType=Shared&allowManualAcknowledgement=true&ackTimeoutMillis=1000");
         PulsarEndpoint deadLetterFrom
                 = (PulsarEndpoint) component.createEndpoint("pulsar:persistent://public/default/customTopic");


[camel] 07/11: Raise the overall timeout for pulsar tests

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b5cf64cc9e0b354b7e63bad999a0f42ec1a10ae0
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Feb 12 12:49:04 2021 +0100

    Raise the overall timeout for pulsar tests
---
 components/camel-pulsar/pom.xml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/components/camel-pulsar/pom.xml b/components/camel-pulsar/pom.xml
index c95956a..de45ca6 100644
--- a/components/camel-pulsar/pom.xml
+++ b/components/camel-pulsar/pom.xml
@@ -90,6 +90,21 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <childDelegation>false</childDelegation>
+                    <useFile>true</useFile>
+                    <forkCount>1</forkCount>
+                    <reuseForks>true</reuseForks>
+                    <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
     <profiles>
         <profile>
             <id>pulsar-skip-tests</id>


[camel] 05/11: [CAMEL-16156] Improve the usage of org.apache.camel.jmx.disabled

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 5c97f39a2fc8bbea4b212f60f9f6578d44cc8b9b
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Feb 12 08:29:41 2021 +0100

    [CAMEL-16156] Improve the usage of org.apache.camel.jmx.disabled
    
    Avoid using global system properties and use a thread local instead.  Move all the code for disableJmx/noStart/excludeRoutes to DefaultCamelContext
---
 ...omponentCamelContextSchedulerIsolationTest.java | 20 +-----
 .../org/apache/camel/spring/SpringTestSupport.java |  7 +-
 .../apache/camel/spring/SpringCamelContext.java    | 54 ++-------------
 .../apache/camel/test/junit5/CamelTestSupport.java |  5 +-
 .../spring/junit5/CamelAnnotationsHandler.java     | 50 +++++--------
 .../camel/test/spring/CamelAnnotationsHandler.java | 50 +++++--------
 .../apache/camel/test/junit4/CamelTestSupport.java |  5 +-
 .../org/apache/camel/impl/DefaultCamelContext.java | 81 ++++++++++++++++++++++
 8 files changed, 127 insertions(+), 145 deletions(-)

diff --git a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzComponentCamelContextSchedulerIsolationTest.java b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzComponentCamelContextSchedulerIsolationTest.java
index e3ebc5b..97b38e2 100644
--- a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzComponentCamelContextSchedulerIsolationTest.java
+++ b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzComponentCamelContextSchedulerIsolationTest.java
@@ -17,7 +17,6 @@
 package org.apache.camel.component.quartz;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.api.management.JmxSystemPropertyKeys;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Test;
@@ -31,18 +30,17 @@ public class QuartzComponentCamelContextSchedulerIsolationTest {
 
     @AfterAll
     public static void afterTests() {
-        System.clearProperty(JmxSystemPropertyKeys.DISABLED);
     }
 
     @Test
     public void testSchedulerIsolationUnmanaged() throws Exception {
-        disableJMX();
+        DefaultCamelContext.setDisableJmx(true);
         testSchedulerIsolation();
     }
 
     @Test
     public void testSchedulerIsolationManaged() throws Exception {
-        enableJMX();
+        DefaultCamelContext.setDisableJmx(false);
         testSchedulerIsolation();
     }
 
@@ -78,18 +76,4 @@ public class QuartzComponentCamelContextSchedulerIsolationTest {
         return getQuartzComponent(context).getScheduler();
     }
 
-    /**
-     * Disables the JMX agent.
-     */
-    private void disableJMX() {
-        System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
-    }
-
-    /**
-     * Enables the JMX agent.
-     */
-    private void enableJMX() {
-        System.setProperty(JmxSystemPropertyKeys.DISABLED, "false");
-    }
-
 }
diff --git a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/SpringTestSupport.java b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/SpringTestSupport.java
index 6f20929..0eb9e42 100644
--- a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/SpringTestSupport.java
+++ b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/SpringTestSupport.java
@@ -25,7 +25,7 @@ import java.util.StringJoiner;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
-import org.apache.camel.api.management.JmxSystemPropertyKeys;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.engine.DefaultPackageScanClassResolver;
 import org.apache.camel.impl.scan.AssignableToPackageScanFilter;
 import org.apache.camel.impl.scan.InvertingPackageScanFilter;
@@ -49,14 +49,14 @@ public abstract class SpringTestSupport extends ContextTestSupport {
     public void setUp() throws Exception {
         // we want SpringTestSupport to startup faster and not use JMX by default and should stop seda quicker
         System.setProperty("CamelSedaPollTimeout", "10");
-        System.setProperty(JmxSystemPropertyKeys.DISABLED, Boolean.toString(!useJmx()));
+        DefaultCamelContext.setDisableJmx(!useJmx());
         Class<?>[] excluded = excludeRoutes();
         if (excluded != null && excluded.length > 0) {
             StringJoiner excludedRoutes = new StringJoiner(",");
             for (Class<?> clazz : excluded) {
                 excludedRoutes.add(clazz.getName());
             }
-            System.setProperty(SpringCamelContext.EXCLUDE_ROUTES, excludedRoutes.toString());
+            DefaultCamelContext.setExcludeRoutes(excludedRoutes.toString());
         }
 
         applicationContext = createApplicationContext();
@@ -69,6 +69,7 @@ public abstract class SpringTestSupport extends ContextTestSupport {
     public void tearDown() throws Exception {
         super.tearDown();
         IOHelper.close(applicationContext);
+        DefaultCamelContext.clearOptions();
     }
 
     private static class ExcludingPackageScanClassResolver extends DefaultPackageScanClassResolver {
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
index 938f801..b7f4510 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
@@ -16,25 +16,19 @@
  */
 package org.apache.camel.spring;
 
-import java.util.HashSet;
 import java.util.Optional;
-import java.util.Set;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.api.management.JmxSystemPropertyKeys;
 import org.apache.camel.component.event.EventComponent;
 import org.apache.camel.component.event.EventEndpoint;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.scan.AssignableToPackageScanFilter;
-import org.apache.camel.impl.scan.InvertingPackageScanFilter;
 import org.apache.camel.spi.BeanProcessorFactory;
 import org.apache.camel.spi.BeanRepository;
 import org.apache.camel.spi.Injector;
 import org.apache.camel.spi.ModelJAXBContextFactory;
-import org.apache.camel.spi.PackageScanClassResolver;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.spring.spi.ApplicationContextBeanRepository;
 import org.apache.camel.spring.spi.SpringInjector;
@@ -42,8 +36,6 @@ import org.apache.camel.spring.spi.SpringManagementMBeanAssembler;
 import org.apache.camel.support.DefaultRegistry;
 import org.apache.camel.support.ProcessorEndpoint;
 import org.apache.camel.support.ResolverHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.StopWatch;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeansException;
@@ -72,16 +64,12 @@ public class SpringCamelContext extends DefaultCamelContext
     public static final String EXCLUDE_ROUTES = "CamelTestSpringExcludeRoutes";
 
     private static final Logger LOG = LoggerFactory.getLogger(SpringCamelContext.class);
-    private static final ThreadLocal<Boolean> NO_START = new ThreadLocal<>();
     private ApplicationContext applicationContext;
     private EventComponent eventComponent;
     private boolean shutdownEager = true;
 
     public SpringCamelContext() {
         super(false);
-        if (Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
-            disableJMX();
-        }
         setManagementMBeanAssembler(new SpringManagementMBeanAssembler(this));
     }
 
@@ -90,14 +78,6 @@ public class SpringCamelContext extends DefaultCamelContext
         setApplicationContext(applicationContext);
     }
 
-    public static void setNoStart(boolean b) {
-        if (b) {
-            NO_START.set(true);
-        } else {
-            NO_START.set(null);
-        }
-    }
-
     /**
      * @deprecated its better to create and boot Spring the standard Spring way and to get hold of CamelContext using
      *             the Spring API.
@@ -123,23 +103,10 @@ public class SpringCamelContext extends DefaultCamelContext
 
     @Override
     public void start() {
-        // for example from unit testing we want to start Camel later (manually)
-        if (Boolean.TRUE.equals(NO_START.get())) {
-            LOG.trace("Ignoring start() as NO_START is false");
-            return;
-        }
-
-        if (!isStarted() && !isStarting()) {
-            try {
-                StopWatch watch = new StopWatch();
-                super.start();
-                LOG.debug("start() took {} millis", watch.taken());
-            } catch (Exception e) {
-                throw wrapRuntimeCamelException(e);
-            }
-        } else {
-            // ignore as Camel is already started
-            LOG.trace("Ignoring start() as Camel is already started");
+        try {
+            super.start();
+        } catch (Exception e) {
+            throw wrapRuntimeCamelException(e);
         }
     }
 
@@ -329,17 +296,4 @@ public class SpringCamelContext extends DefaultCamelContext
         return !isStopping() && !isStopped();
     }
 
-    protected PackageScanClassResolver createPackageScanClassResolver() {
-        PackageScanClassResolver resolver = super.createPackageScanClassResolver();
-        String excluded = System.getProperty(EXCLUDE_ROUTES);
-        if (ObjectHelper.isNotEmpty(excluded)) {
-            Set<Class<?>> excludedClasses = new HashSet<>();
-            for (String str : excluded.split(",")) {
-                excludedClasses.add(getClassResolver().resolveClass(str));
-            }
-            resolver.addFilter(new InvertingPackageScanFilter(new AssignableToPackageScanFilter(excludedClasses)));
-        }
-        return resolver;
-    }
-
 }
diff --git a/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java b/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java
index 16604ab..258ecb2 100644
--- a/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java
+++ b/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java
@@ -40,7 +40,6 @@ import org.apache.camel.RoutesBuilder;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.Service;
 import org.apache.camel.ServiceStatus;
-import org.apache.camel.api.management.JmxSystemPropertyKeys;
 import org.apache.camel.api.management.ManagedCamelContext;
 import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
 import org.apache.camel.builder.AdviceWith;
@@ -983,14 +982,14 @@ public abstract class CamelTestSupport
      * Disables the JMX agent. Must be called before the {@link #setUp()} method.
      */
     protected void disableJMX() {
-        System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
+        DefaultCamelContext.setDisableJmx(true);
     }
 
     /**
      * Enables the JMX agent. Must be called before the {@link #setUp()} method.
      */
     protected void enableJMX() {
-        System.setProperty(JmxSystemPropertyKeys.DISABLED, "false");
+        DefaultCamelContext.setDisableJmx(false);
     }
 
     /**
diff --git a/components/camel-test-spring-junit5/src/main/java/org/apache/camel/test/spring/junit5/CamelAnnotationsHandler.java b/components/camel-test-spring-junit5/src/main/java/org/apache/camel/test/spring/junit5/CamelAnnotationsHandler.java
index e0a8583..f11f331 100644
--- a/components/camel-test-spring-junit5/src/main/java/org/apache/camel/test/spring/junit5/CamelAnnotationsHandler.java
+++ b/components/camel-test-spring-junit5/src/main/java/org/apache/camel/test/spring/junit5/CamelAnnotationsHandler.java
@@ -27,10 +27,10 @@ import java.util.concurrent.TimeUnit;
 import java.util.function.Function;
 
 import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.api.management.JmxSystemPropertyKeys;
 import org.apache.camel.api.management.ManagedCamelContext;
 import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
 import org.apache.camel.component.mock.InterceptSendToMockEndpointStrategy;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.debugger.DefaultDebugger;
 import org.apache.camel.spi.Breakpoint;
 import org.apache.camel.spi.Debugger;
@@ -57,20 +57,7 @@ public final class CamelAnnotationsHandler {
      * @param testClass the test class being executed
      */
     public static void cleanup(Class<?> testClass) {
-        SpringCamelContext.setNoStart(false);
-
-        if (CamelSpringTestHelper.getOriginalJmxDisabled() == null) {
-            System.clearProperty(JmxSystemPropertyKeys.DISABLED);
-        } else {
-            System.setProperty(JmxSystemPropertyKeys.DISABLED,
-                    CamelSpringTestHelper.getOriginalJmxDisabled());
-        }
-        if (CamelSpringTestHelper.getOriginalExcludeRoutes() == null) {
-            System.clearProperty(SpringCamelContext.EXCLUDE_ROUTES);
-        } else {
-            System.setProperty(SpringCamelContext.EXCLUDE_ROUTES,
-                    CamelSpringTestHelper.getOriginalExcludeRoutes());
-        }
+        DefaultCamelContext.clearOptions();
     }
 
     /**
@@ -80,25 +67,22 @@ public final class CamelAnnotationsHandler {
      * @param testClass the test class being executed
      */
     public static void handleExcludeRoutes(ConfigurableApplicationContext context, Class<?> testClass) {
-        CamelSpringTestHelper.setOriginalExcludeRoutesValue(System.getProperty(SpringCamelContext.EXCLUDE_ROUTES));
+        String key = SpringCamelContext.EXCLUDE_ROUTES;
+        String exists = System.getProperty(key);
+        if (exists != null) {
+            LOGGER.warn("The JVM property " + key + " is set, but not supported anymore.");
+        }
 
         if (testClass.isAnnotationPresent(ExcludeRoutes.class)) {
-            Class[] routes = testClass.getAnnotation(ExcludeRoutes.class).value();
+            Class<?>[] routes = testClass.getAnnotation(ExcludeRoutes.class).value();
             // need to setup this as a JVM system property
             StringJoiner routesBuilder = new StringJoiner(",");
-            for (Class clazz : routes) {
+            for (Class<?> clazz : routes) {
                 routesBuilder.add(clazz.getName());
             }
-            String key = SpringCamelContext.EXCLUDE_ROUTES;
             String value = routesBuilder.toString();
-
-            String exists = System.getProperty(key);
-            if (exists != null) {
-                LOGGER.warn("Cannot use @ExcludeRoutes as JVM property " + key + " has already been set.");
-            } else {
-                LOGGER.info("@ExcludeRoutes annotation found. Setting up JVM property {}={}", key, value);
-                System.setProperty(key, value);
-            }
+            LOGGER.info("@ExcludeRoutes annotation found. Setting up JVM property {}={}", key, value);
+            DefaultCamelContext.setExcludeRoutes(value);
         }
     }
 
@@ -109,29 +93,27 @@ public final class CamelAnnotationsHandler {
      * @param testClass the test class being executed
      */
     public static void handleDisableJmx(ConfigurableApplicationContext context, Class<?> testClass) {
-        CamelSpringTestHelper.setOriginalJmxDisabledValue(System.getProperty(JmxSystemPropertyKeys.DISABLED));
-
         if (testClass.isAnnotationPresent(DisableJmx.class)) {
             if (testClass.getAnnotation(DisableJmx.class).value()) {
                 LOGGER.info("Disabling Camel JMX globally as DisableJmx annotation was found and disableJmx is set to true.");
-                System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
+                DefaultCamelContext.setDisableJmx(true);
             } else {
                 LOGGER.info("Enabling Camel JMX as DisableJmx annotation was found and disableJmx is set to false.");
-                System.clearProperty(JmxSystemPropertyKeys.DISABLED);
+                DefaultCamelContext.setDisableJmx(false);
             }
         } else if (!testClass.isAnnotationPresent(EnableRouteCoverage.class)) {
             // route coverage need JMX so do not disable it by default
             LOGGER.info(
                     "Disabling Camel JMX globally for tests by default.  Use the DisableJMX annotation to override the default setting.");
-            System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
+            DefaultCamelContext.setDisableJmx(true);
         } else {
             LOGGER.info("Enabling Camel JMX as EnableRouteCoverage is used.");
-            System.setProperty(JmxSystemPropertyKeys.DISABLED, "false");
+            DefaultCamelContext.setDisableJmx(false);
         }
     }
 
     /**
-     * Handles disabling of JMX on Camel contexts based on {@link DisableJmx}.
+     * Handles disabling of JMX on Camel contexts based on {@link EnableRouteCoverage}.
      *
      * @param context   the initialized Spring context
      * @param testClass the test class being executed
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java
index 246da12..9be399b 100644
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java
+++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java
@@ -27,10 +27,10 @@ import java.util.concurrent.TimeUnit;
 import java.util.function.Function;
 
 import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.api.management.JmxSystemPropertyKeys;
 import org.apache.camel.api.management.ManagedCamelContext;
 import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
 import org.apache.camel.component.mock.InterceptSendToMockEndpointStrategy;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.debugger.DefaultDebugger;
 import org.apache.camel.spi.Breakpoint;
 import org.apache.camel.spi.Debugger;
@@ -57,20 +57,7 @@ public final class CamelAnnotationsHandler {
      * @param testClass the test class being executed
      */
     public static void cleanup(Class<?> testClass) {
-        SpringCamelContext.setNoStart(false);
-
-        if (CamelSpringTestHelper.getOriginalJmxDisabled() == null) {
-            System.clearProperty(JmxSystemPropertyKeys.DISABLED);
-        } else {
-            System.setProperty(JmxSystemPropertyKeys.DISABLED,
-                    CamelSpringTestHelper.getOriginalJmxDisabled());
-        }
-        if (CamelSpringTestHelper.getOriginalExcludeRoutes() == null) {
-            System.clearProperty(SpringCamelContext.EXCLUDE_ROUTES);
-        } else {
-            System.setProperty(SpringCamelContext.EXCLUDE_ROUTES,
-                    CamelSpringTestHelper.getOriginalExcludeRoutes());
-        }
+        DefaultCamelContext.clearOptions();
     }
 
     /**
@@ -80,25 +67,22 @@ public final class CamelAnnotationsHandler {
      * @param testClass the test class being executed
      */
     public static void handleExcludeRoutes(ConfigurableApplicationContext context, Class<?> testClass) {
-        CamelSpringTestHelper.setOriginalExcludeRoutesValue(System.getProperty(SpringCamelContext.EXCLUDE_ROUTES));
+        String key = SpringCamelContext.EXCLUDE_ROUTES;
+        String exists = System.getProperty(key);
+        if (exists != null) {
+            LOGGER.warn("The JVM property " + key + " is set, but not supported anymore.");
+        }
 
         if (testClass.isAnnotationPresent(ExcludeRoutes.class)) {
-            Class[] routes = testClass.getAnnotation(ExcludeRoutes.class).value();
+            Class<?>[] routes = testClass.getAnnotation(ExcludeRoutes.class).value();
             // need to setup this as a JVM system property
             StringJoiner routesBuilder = new StringJoiner(",");
-            for (Class clazz : routes) {
+            for (Class<?> clazz : routes) {
                 routesBuilder.add(clazz.getName());
             }
-            String key = SpringCamelContext.EXCLUDE_ROUTES;
             String value = routesBuilder.toString();
-
-            String exists = System.getProperty(key);
-            if (exists != null) {
-                LOGGER.warn("Cannot use @ExcludeRoutes as JVM property " + key + " has already been set.");
-            } else {
-                LOGGER.info("@ExcludeRoutes annotation found. Setting up JVM property {}={}", key, value);
-                System.setProperty(key, value);
-            }
+            LOGGER.info("@ExcludeRoutes annotation found. Setting up JVM property {}={}", key, value);
+            DefaultCamelContext.setExcludeRoutes(value);
         }
     }
 
@@ -109,29 +93,27 @@ public final class CamelAnnotationsHandler {
      * @param testClass the test class being executed
      */
     public static void handleDisableJmx(ConfigurableApplicationContext context, Class<?> testClass) {
-        CamelSpringTestHelper.setOriginalJmxDisabledValue(System.getProperty(JmxSystemPropertyKeys.DISABLED));
-
         if (testClass.isAnnotationPresent(DisableJmx.class)) {
             if (testClass.getAnnotation(DisableJmx.class).value()) {
                 LOGGER.info("Disabling Camel JMX globally as DisableJmx annotation was found and disableJmx is set to true.");
-                System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
+                DefaultCamelContext.setDisableJmx(true);
             } else {
                 LOGGER.info("Enabling Camel JMX as DisableJmx annotation was found and disableJmx is set to false.");
-                System.clearProperty(JmxSystemPropertyKeys.DISABLED);
+                DefaultCamelContext.setDisableJmx(false);
             }
         } else if (!testClass.isAnnotationPresent(EnableRouteCoverage.class)) {
             // route coverage need JMX so do not disable it by default
             LOGGER.info(
                     "Disabling Camel JMX globally for tests by default.  Use the DisableJMX annotation to override the default setting.");
-            System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
+            DefaultCamelContext.setDisableJmx(true);
         } else {
             LOGGER.info("Enabling Camel JMX as EnableRouteCoverage is used.");
-            System.setProperty(JmxSystemPropertyKeys.DISABLED, "false");
+            DefaultCamelContext.setDisableJmx(false);
         }
     }
 
     /**
-     * Handles disabling of JMX on Camel contexts based on {@link DisableJmx}.
+     * Handles disabling of JMX on Camel contexts based on {@link EnableRouteCoverage}.
      *
      * @param context   the initialized Spring context
      * @param testClass the test class being executed
diff --git a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
index c462024..0f462de 100644
--- a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
+++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
@@ -60,7 +60,6 @@ import org.apache.camel.RoutesBuilder;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.Service;
 import org.apache.camel.ServiceStatus;
-import org.apache.camel.api.management.JmxSystemPropertyKeys;
 import org.apache.camel.api.management.ManagedCamelContext;
 import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
 import org.apache.camel.api.management.mbean.ManagedProcessorMBean;
@@ -1094,14 +1093,14 @@ public abstract class CamelTestSupport extends TestSupport {
      * Disables the JMX agent. Must be called before the {@link #setUp()} method.
      */
     protected void disableJMX() {
-        System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
+        DefaultCamelContext.setDisableJmx(true);
     }
 
     /**
      * Enables the JMX agent. Must be called before the {@link #setUp()} method.
      */
     protected void enableJMX() {
-        System.setProperty(JmxSystemPropertyKeys.DISABLED, "false");
+        DefaultCamelContext.setDisableJmx(false);
     }
 
     /**
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 9916e9f..d44192c 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -17,9 +17,11 @@
 package org.apache.camel.impl;
 
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 import java.util.function.Function;
 
 import org.apache.camel.CamelContext;
@@ -31,6 +33,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.StartupStep;
 import org.apache.camel.ValueHolder;
+import org.apache.camel.api.management.JmxSystemPropertyKeys;
 import org.apache.camel.builder.AdviceWith;
 import org.apache.camel.builder.AdviceWithRouteBuilder;
 import org.apache.camel.impl.engine.DefaultExecutorServiceManager;
@@ -38,6 +41,8 @@ import org.apache.camel.impl.engine.RouteService;
 import org.apache.camel.impl.engine.SimpleCamelContext;
 import org.apache.camel.impl.engine.TransformerKey;
 import org.apache.camel.impl.engine.ValidatorKey;
+import org.apache.camel.impl.scan.AssignableToPackageScanFilter;
+import org.apache.camel.impl.scan.InvertingPackageScanFilter;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.model.FaultToleranceConfigurationDefinition;
 import org.apache.camel.model.HystrixConfigurationDefinition;
@@ -60,6 +65,7 @@ import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.DataType;
 import org.apache.camel.spi.ExecutorServiceManager;
 import org.apache.camel.spi.ModelReifierFactory;
+import org.apache.camel.spi.PackageScanClassResolver;
 import org.apache.camel.spi.PropertiesComponent;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.spi.StartupStepRecorder;
@@ -68,6 +74,7 @@ import org.apache.camel.spi.Validator;
 import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.support.DefaultRegistry;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.StopWatch;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -77,6 +84,7 @@ import org.slf4j.LoggerFactory;
 public class DefaultCamelContext extends SimpleCamelContext implements ModelCamelContext {
 
     private static final Logger LOG = LoggerFactory.getLogger(DefaultCamelContext.class);
+    protected static final ThreadLocal<OptionHolder> OPTIONS = ThreadLocal.withInitial(OptionHolder::new);
 
     private Model model = new DefaultModel(this);
 
@@ -111,6 +119,73 @@ public class DefaultCamelContext extends SimpleCamelContext implements ModelCame
 
     public DefaultCamelContext(boolean init) {
         super(init);
+        if (isDisableJmx()) {
+            disableJMX();
+        }
+    }
+
+    public static void setNoStart(boolean b) {
+        getOptions().noStart = b;
+    }
+
+    public static boolean isNoStart() {
+        return getOptions().noStart;
+    }
+
+    public static void setDisableJmx(boolean b) {
+        getOptions().disableJmx = b;
+    }
+
+    public static boolean isDisableJmx() {
+        return getOptions().disableJmx;
+    }
+
+    public static String getExcludeRoutes() {
+        return getOptions().excludeRoutes;
+    }
+
+    public static void setExcludeRoutes(String s) {
+        getOptions().excludeRoutes = s;
+    }
+
+    public static void clearOptions() {
+        OPTIONS.set(new OptionHolder());
+    }
+
+    private static OptionHolder getOptions() {
+        return OPTIONS.get();
+    }
+
+    @Override
+    public void start() {
+        // for example from unit testing we want to start Camel later (manually)
+        if (isNoStart()) {
+            LOG.trace("Ignoring start() as NO_START is false");
+            return;
+        }
+
+        if (!isStarted() && !isStarting()) {
+            StopWatch watch = new StopWatch();
+            super.start();
+            LOG.debug("start() took {} millis", watch.taken());
+        } else {
+            // ignore as Camel is already started
+            LOG.trace("Ignoring start() as Camel is already started");
+        }
+    }
+
+    @Override
+    protected PackageScanClassResolver createPackageScanClassResolver() {
+        PackageScanClassResolver resolver = super.createPackageScanClassResolver();
+        String excluded = getExcludeRoutes();
+        if (ObjectHelper.isNotEmpty(excluded)) {
+            Set<Class<?>> excludedClasses = new HashSet<>();
+            for (String str : excluded.split(",")) {
+                excludedClasses.add(getClassResolver().resolveClass(str));
+            }
+            resolver.addFilter(new InvertingPackageScanFilter(new AssignableToPackageScanFilter(excludedClasses)));
+        }
+        return resolver;
     }
 
     @Override
@@ -681,4 +756,10 @@ public class DefaultCamelContext extends SimpleCamelContext implements ModelCame
                 ? new TransformerKey(def.getScheme())
                 : new TransformerKey(new DataType(def.getFromType()), new DataType(def.getToType()));
     }
+
+    protected static class OptionHolder {
+        public boolean noStart;
+        public boolean disableJmx = Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED);
+        public String excludeRoutes;
+    }
 }


[camel] 11/11: Merge remote-tracking branch 'origin/master'

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b9cf7e20dfc94a3d5533536c2915213a7d060f17
Merge: 30d8594 f3b688c
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Mon Feb 15 08:28:53 2021 +0100

    Merge remote-tracking branch 'origin/master'

 camel-dependencies/pom.xml                         |   4 +-
 .../camel/catalog/docs/properties-component.adoc   |   2 +-
 .../apache/camel/catalog/docs/sql-component.adoc   |   5 +
 .../camel/component/apns/util/ApnsUtils.java       |   4 +-
 .../camel/component/aws2/s3/AWS2S3Producer.java    |   4 +
 .../aws2/s3/localstack/Aws2S3BaseTest.java         |   6 +
 ...mpleEncryptedUploadOperationLocalstackTest.java | 103 ++++
 .../blob/integration/BlobOperationsITTest.java     |  10 +-
 .../blob/integration/BlobProducerITTest.java       |   4 +-
 .../caffeine/cache/CaffeineCacheTestSupport.java   |   4 +-
 .../CaffeineAggregationRepositoryRoutesTest.java   |   4 +-
 .../camel/component/consul/ConsulHealthTest.java   |   4 +-
 .../component/consul/ConsulKeyValueWatchTest.java  |   6 +-
 .../component/ehcache/EhcacheTestSupport.java      |   4 +-
 .../file/remote/FtpConsumerAsyncStressTest.java    |   4 +-
 .../file/remote/FtpProducerMoveExistingTest.java   |   4 +-
 .../apache/camel/component/http/HttpProducer.java  | 124 +++--
 .../camel/component/http/HttpProducerLoadTest.java | 125 +++++
 .../camel-sql/src/main/docs/sql-component.adoc     |   5 +
 .../vertx/http/DefaultVertxHttpBinding.java        |  27 +-
 .../vertx/http/VertxHttpProducerLoadTest.java      |  97 ++++
 .../component/vertx/kafka/VertxKafkaConsumer.java  |  42 +-
 .../src/main/java/org/apache/camel/InOnly.java     |   3 +-
 .../src/main/java/org/apache/camel/InOut.java      |   3 +-
 .../src/main/java/org/apache/camel/Pattern.java    |   3 +-
 .../org/apache/camel/spi/HeaderFilterStrategy.java |   4 +-
 .../src/main/docs/properties-component.adoc        |   2 +-
 .../camel/processor/RemoveHeadersAllTest.java      | 107 +++++
 .../org/apache/camel/main/BaseMainSupport.java     |   8 +-
 .../camel/main/MainConfigurationProperties.java    |  63 ++-
 .../camel/main/MainSupportModelConfigurer.java     |   6 +-
 .../org/apache/camel/support/DefaultExchange.java  |  17 +-
 .../camel/support/DefaultHeaderFilterStrategy.java |  37 +-
 .../org/apache/camel/support/DefaultMessage.java   |  28 +-
 .../java/org/apache/camel/util/SensitiveUtils.java |   4 +
 .../org/apache/camel/util/SensitiveUtilsTest.java  |   2 +
 .../modules/ROOT/pages/properties-component.adoc   |   2 +-
 .../modules/ROOT/pages/sql-component.adoc          |   5 +
 docs/user-manual-nav.adoc.template                 |   1 -
 docs/user-manual/modules/ROOT/nav.adoc             |   1 -
 .../modules/ROOT/pages/bean-injection.adoc         |   3 +-
 .../modules/ROOT/pages/bean-integration.adoc       |   3 +-
 .../ROOT/pages/camel-3x-upgrade-guide-3_9.adoc     |  10 +
 .../modules/ROOT/pages/hiding-middleware.adoc      |  10 +-
 .../modules/ROOT/pages/pojo-producing.adoc         |   3 +-
 .../modules/ROOT/pages/spring-remoting.adoc        | 522 ---------------------
 .../pages/using-exchange-pattern-annotations.adoc  |   3 +-
 .../ROOT/pages/using-propertyplaceholder.adoc      |   2 +-
 parent/pom.xml                                     |   4 +-
 .../itest/proxy/SpringEchoCamelProxyTest.java      |  41 --
 .../camel/itest/proxy/SpringEchoCamelProxyTest.xml |  46 --
 51 files changed, 764 insertions(+), 771 deletions(-)



[camel] 03/11: Fix invalid profile id (for maven 4)

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 2f5e601fecfb99eaf9d1c79bcf264461a3ea500f
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Feb 11 14:03:07 2021 +0100

    Fix invalid profile id (for maven 4)
---
 components/camel-cdi/pom.xml                                            | 2 +-
 components/camel-jmx/pom.xml                                            | 2 +-
 components/camel-kubernetes/pom.xml                                     | 2 +-
 components/camel-soap/pom.xml                                           | 2 +-
 core/camel-core-engine/pom.xml                                          | 2 +-
 core/camel-management-api/pom.xml                                       | 2 +-
 core/camel-management/pom.xml                                           | 2 +-
 parent/pom.xml                                                          | 2 +-
 tests/camel-itest/pom.xml                                               | 2 +-
 tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml     | 2 +-
 .../maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto-v3/pom.xml | 2 +-
 .../maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto/pom.xml    | 2 +-
 tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-v3/pom.xml | 2 +-
 tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml/pom.xml    | 2 +-
 .../maven/camel-restdsl-swagger-plugin/src/it/simple-xml-dto/pom.xml    | 2 +-
 tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml    | 2 +-
 16 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/components/camel-cdi/pom.xml b/components/camel-cdi/pom.xml
index 895ee50..b076e79 100644
--- a/components/camel-cdi/pom.xml
+++ b/components/camel-cdi/pom.xml
@@ -448,7 +448,7 @@
         </profile>
 
         <profile>
-            <id>jdk9+-weld-3.0</id>
+            <id>jdk9s-weld-3.0</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/components/camel-jmx/pom.xml b/components/camel-jmx/pom.xml
index 83b96ea..0469bb9 100644
--- a/components/camel-jmx/pom.xml
+++ b/components/camel-jmx/pom.xml
@@ -124,7 +124,7 @@
             (https://github.com/mojohaus/jaxb2-maven-plugin/issues/43). We need to add the plugin back
             once we are sure it works on both JDK8 and JDK9.
             See https://issues.apache.org/jira/browse/CAMEL-10141 for more info. -->
-            <id>jdk9+-build</id>
+            <id>jdk9s-build</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/components/camel-kubernetes/pom.xml b/components/camel-kubernetes/pom.xml
index 89221f8..b7ad997 100644
--- a/components/camel-kubernetes/pom.xml
+++ b/components/camel-kubernetes/pom.xml
@@ -126,7 +126,7 @@
 
     <profiles>
         <profile>
-            <id>jdk9+-build</id>
+            <id>jdk9s-build</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/components/camel-soap/pom.xml b/components/camel-soap/pom.xml
index fbfb04b..d16fd40 100644
--- a/components/camel-soap/pom.xml
+++ b/components/camel-soap/pom.xml
@@ -222,7 +222,7 @@
             (https://github.com/mojohaus/jaxb2-maven-plugin/issues/43). We need to add the plugin back
             once we are sure it works on both JDK8 and JDK9.
             See https://issues.apache.org/jira/browse/CAMEL-10141 for more info. -->
-            <id>jdk9+-build</id>
+            <id>jdk9s-build</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/core/camel-core-engine/pom.xml b/core/camel-core-engine/pom.xml
index 369f5c5..892333c 100644
--- a/core/camel-core-engine/pom.xml
+++ b/core/camel-core-engine/pom.xml
@@ -363,7 +363,7 @@
         </profile>
 
         <profile>
-            <id>jdk9+-build</id>
+            <id>jdk9s-build</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/core/camel-management-api/pom.xml b/core/camel-management-api/pom.xml
index 7f51f96..0ca4839 100644
--- a/core/camel-management-api/pom.xml
+++ b/core/camel-management-api/pom.xml
@@ -257,7 +257,7 @@
         </profile>
 
         <profile>
-            <id>jdk9+-build</id>
+            <id>jdk9s-build</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/core/camel-management/pom.xml b/core/camel-management/pom.xml
index 5bf231d..e484a6f 100644
--- a/core/camel-management/pom.xml
+++ b/core/camel-management/pom.xml
@@ -313,7 +313,7 @@
         </profile>
 
         <profile>
-            <id>jdk9+-build</id>
+            <id>jdk9s-build</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/parent/pom.xml b/parent/pom.xml
index 1a2b42a..6e36103 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -4781,7 +4781,7 @@
         </profile>
 
         <profile>
-            <id>jdk9+-build</id>
+            <id>jdk9s-build</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/tests/camel-itest/pom.xml b/tests/camel-itest/pom.xml
index fe85502..4494703 100644
--- a/tests/camel-itest/pom.xml
+++ b/tests/camel-itest/pom.xml
@@ -453,7 +453,7 @@
 
     <profiles>
         <profile>
-            <id>jdk9+-build</id>
+            <id>jdk9s-build</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml
index 02836e6..e996388 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml
@@ -161,7 +161,7 @@
 
     <profiles>
         <profile>
-            <id>jdk9+-build</id>
+            <id>jdk9s-build</id>
             <activation>
                 <jdk>[9,)</jdk>
             </activation>
diff --git a/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto-v3/pom.xml b/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto-v3/pom.xml
index 0840e84..a16bb71 100644
--- a/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto-v3/pom.xml
+++ b/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto-v3/pom.xml
@@ -94,7 +94,7 @@
   </build>
   <profiles>
     <profile>
-      <id>jdk9+-build</id>
+      <id>jdk9s-build</id>
       <activation>
         <jdk>[9,)</jdk>
       </activation>
diff --git a/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto/pom.xml b/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto/pom.xml
index 4ea0e33..499cf87 100644
--- a/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto/pom.xml
+++ b/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-dto/pom.xml
@@ -94,7 +94,7 @@
   </build>
   <profiles>
     <profile>
-      <id>jdk9+-build</id>
+      <id>jdk9s-build</id>
       <activation>
         <jdk>[9,)</jdk>
       </activation>
diff --git a/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-v3/pom.xml b/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-v3/pom.xml
index c923c1c..fca3776 100644
--- a/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-v3/pom.xml
+++ b/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml-v3/pom.xml
@@ -56,7 +56,7 @@
   </build>
   <profiles>
     <profile>
-      <id>jdk9+-build</id>
+      <id>jdk9s-build</id>
       <activation>
         <jdk>[9,)</jdk>
       </activation>
diff --git a/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml/pom.xml b/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml/pom.xml
index 1c787ac..9de5458 100644
--- a/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml/pom.xml
+++ b/tooling/maven/camel-restdsl-openapi-plugin/src/it/simple-xml/pom.xml
@@ -56,7 +56,7 @@
   </build>
   <profiles>
     <profile>
-      <id>jdk9+-build</id>
+      <id>jdk9s-build</id>
       <activation>
         <jdk>[9,)</jdk>
       </activation>
diff --git a/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml-dto/pom.xml b/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml-dto/pom.xml
index 2e0d4f6..0f1d75a 100644
--- a/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml-dto/pom.xml
+++ b/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml-dto/pom.xml
@@ -89,7 +89,7 @@
   </build>
   <profiles>
     <profile>
-      <id>jdk9+-build</id>
+      <id>jdk9s-build</id>
       <activation>
         <jdk>[9,)</jdk>
       </activation>
diff --git a/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml b/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml
index 4f2c915..aba3f53 100644
--- a/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml
+++ b/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml
@@ -56,7 +56,7 @@
   </build>
   <profiles>
     <profile>
-      <id>jdk9+-build</id>
+      <id>jdk9s-build</id>
       <activation>
         <jdk>[9,)</jdk>
       </activation>


[camel] 01/11: Enable TIA for failsafe plugin too

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 01f6159c0a42cefe123b9d53bfa34fee85cdfe7a
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Feb 4 15:20:51 2021 +0100

    Enable TIA for failsafe plugin too
---
 parent/pom.xml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/parent/pom.xml b/parent/pom.xml
index 8c167f8..1a2b42a 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -4918,6 +4918,13 @@
                             <argLine>@{camel.surefire.fork.vmargs}</argLine>
                         </configuration>
                     </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <configuration>
+                            <argLine>@{camel.surefire.fork.vmargs}</argLine>
+                        </configuration>
+                    </plugin>
                 </plugins>
             </build>
         </profile>