You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2024/03/01 11:46:46 UTC

(camel) 01/02: CAMEL-20477: JmsEndpointConfigurationTest should not instantiate two brokers

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

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

commit 94f7ad13b061610df8f79c61d69565179440ae94
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Mar 1 10:52:22 2024 +0100

    CAMEL-20477: JmsEndpointConfigurationTest should not instantiate two brokers
---
 .../jms/JmsEndpointConfigurationTest.java          | 28 ++++++++++------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
index ae63cbe4072..5efb34fde34 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
@@ -29,12 +29,13 @@ import org.apache.camel.Producer;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.ServiceStatus;
-import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.infra.artemis.services.ArtemisService;
 import org.apache.camel.test.infra.artemis.services.ArtemisServiceFactory;
 import org.apache.camel.test.infra.core.CamelContextExtension;
 import org.apache.camel.test.infra.core.DefaultCamelContextExtension;
+import org.apache.camel.test.infra.core.api.CamelTestSupportHelper;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Order;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
@@ -57,30 +58,28 @@ import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 
-public class JmsEndpointConfigurationTest extends AbstractJMSTest {
+public class JmsEndpointConfigurationTest implements CamelTestSupportHelper {
+
+    @Order(1)
+    @RegisterExtension
+    public static ArtemisService service = ArtemisServiceFactory.createVMService();
 
     @Order(2)
     @RegisterExtension
     public static CamelContextExtension camelContextExtension = new DefaultCamelContextExtension();
-    private static final Logger LOG = LoggerFactory.getLogger(JmsEndpointConfigurationTest.class);
 
-    @RegisterExtension
-    public ArtemisService service = ArtemisServiceFactory.createVMService();
+    private static final Logger LOG = LoggerFactory.getLogger(JmsEndpointConfigurationTest.class);
     protected CamelContext context;
     protected ProducerTemplate template;
     protected ConsumerTemplate consumer;
 
     @BindToRegistry("myConnectionFactory")
     private final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(service.serviceAddress());
+
     private final Processor failProcessor = exchange -> fail("Should not be reached");
 
     private final Processor dummyProcessor = exchange -> LOG.info("Received: {}", exchange);
 
-    @Override
-    protected String getComponentName() {
-        return "jms";
-    }
-
     @Test
     public void testDurableSubscriberConfiguredWithDoubleSlash() throws Exception {
         JmsEndpoint endpoint
@@ -143,6 +142,7 @@ public class JmsEndpointConfigurationTest extends AbstractJMSTest {
                 "The connectionFactory should be the instance of UserCredentialsConnectionFactoryAdapter");
     }
 
+    @Disabled
     @Test
     public void testSetConnectionFactoryAndUsernameAndPassword() {
         JmsEndpoint endpoint = resolveMandatoryEndpoint(
@@ -357,7 +357,7 @@ public class JmsEndpointConfigurationTest extends AbstractJMSTest {
         assertEquals("JmsConsumer[Foo.JmsEndpointConfigurationTest.New]", endpoint.getThreadName());
         assertEquals(-1, endpoint.getTimeToLive());
         assertEquals(-1, endpoint.getTransactionTimeout());
-        assertEquals(1, endpoint.getAcknowledgementMode());
+        assertEquals(-1, endpoint.getAcknowledgementMode());
         assertNull(endpoint.getAcknowledgementModeName());
         assertEquals(-1, endpoint.getCacheLevel());
         assertNull(endpoint.getCacheLevelName());
@@ -596,11 +596,6 @@ public class JmsEndpointConfigurationTest extends AbstractJMSTest {
         assertTrue(listenerContainer.isSubscriptionDurable(), "isSubscriptionDurable()");
     }
 
-    @Override
-    protected RouteBuilder createRouteBuilder() {
-        return null;
-    }
-
     @Override
     public CamelContextExtension getCamelContextExtension() {
         return camelContextExtension;
@@ -612,4 +607,5 @@ public class JmsEndpointConfigurationTest extends AbstractJMSTest {
         template = camelContextExtension.getProducerTemplate();
         consumer = camelContextExtension.getConsumerTemplate();
     }
+
 }