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 292c22f819ec669234a2c477df86c8bafd9b6ca5 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Tue Apr 12 18:35:39 2022 +0200 CAMEL-17763: cleaned up unused exceptions in camel-rabbitmq --- .../component/rabbitmq/RabbitMQEndpointTest.java | 38 +++++++++++----------- .../RabbitMQLookupConnectionFactoryTest.java | 4 +-- .../component/rabbitmq/RabbitMQProducerTest.java | 32 +++++++++--------- .../rabbitmq/integration/RabbitMQBasicIT.java | 4 +-- .../rabbitmq/integration/RabbitMQConsumerIT.java | 4 +-- .../integration/RabbitMQConsumerReplyToIT.java | 12 +++---- .../RabbitMQDeadLetterRoutingKeyIT.java | 2 +- .../rabbitmq/integration/RabbitMQInOutIT.java | 15 ++++----- .../rabbitmq/integration/RabbitMQLoadIT.java | 4 +-- .../rabbitmq/integration/RabbitMQProducerIT.java | 26 +++++++-------- .../integration/RabbitMQReConnectionIT.java | 4 +-- .../RabbitMQRequeueHandledExceptionIT.java | 4 +-- .../RabbitMQRequeueUnhandledExceptionIT.java | 4 +-- .../integration/RabbitMQSupendResumeIT.java | 4 +-- .../rabbitmq/integration/RabbitMQToDIT.java | 4 +-- .../integration/RabbitMQToDSendDynamicIT.java | 6 ++-- .../integration/qpid/RabbitMQProducerQpidIT.java | 9 ++--- .../integration/qpid/RabbitMQRequeueQpidIT.java | 6 ++-- 18 files changed, 86 insertions(+), 96 deletions(-) diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java index 318844ae63f..028b9e16f45 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java @@ -58,7 +58,7 @@ public class RabbitMQEndpointTest extends CamelTestSupport { private AMQP.BasicProperties properties = Mockito.mock(AMQP.BasicProperties.class); @Override - protected Registry createCamelRegistry() throws Exception { + protected Registry createCamelRegistry() { SimpleRegistry registry = new SimpleRegistry(); Map<String, Object> args = new HashMap<>(); @@ -77,7 +77,7 @@ public class RabbitMQEndpointTest extends CamelTestSupport { } @Test - public void testCreatingRabbitExchangeSetsStandardHeaders() throws Exception { + public void testCreatingRabbitExchangeSetsStandardHeaders() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange", RabbitMQEndpoint.class); String routingKey = UUID.randomUUID().toString(); @@ -101,7 +101,7 @@ public class RabbitMQEndpointTest extends CamelTestSupport { } @Test - public void testExchangeNameIsOptional() throws Exception { + public void testExchangeNameIsOptional() { RabbitMQEndpoint endpoint1 = context.getEndpoint("rabbitmq:localhost/", RabbitMQEndpoint.class); assertEquals("", endpoint1.getExchangeName(), "Get a wrong exchange name"); @@ -110,7 +110,7 @@ public class RabbitMQEndpointTest extends CamelTestSupport { } @Test - public void testCreatingRabbitExchangeSetsCustomHeaders() throws Exception { + public void testCreatingRabbitExchangeSetsCustomHeaders() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange", RabbitMQEndpoint.class); String routingKey = UUID.randomUUID().toString(); @@ -157,7 +157,7 @@ public class RabbitMQEndpointTest extends CamelTestSupport { } @Test - public void creatingExecutorUsesThreadPoolSettings() throws Exception { + public void creatingExecutorUsesThreadPoolSettings() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?threadPoolSize=20", RabbitMQEndpoint.class); assertEquals(20, endpoint.getThreadPoolSize()); @@ -167,19 +167,19 @@ public class RabbitMQEndpointTest extends CamelTestSupport { } @Test - public void createEndpointWithAutoAckDisabled() throws Exception { + public void createEndpointWithAutoAckDisabled() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?autoAck=false", RabbitMQEndpoint.class); assertFalse(endpoint.isAutoAck()); } @Test - public void assertSingleton() throws Exception { + public void assertSingleton() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange", RabbitMQEndpoint.class); assertTrue(endpoint.isSingleton()); } @Test - public void testMultiArgsPopulateCorrectEndpointProperties() throws Exception { + public void testMultiArgsPopulateCorrectEndpointProperties() { RabbitMQEndpoint endpoint = context.getEndpoint( "rabbitmq:localhost/exchange?arg.exchange.e1=v1&arg.exchange.e2=v2&arg.queue.q1=v3&arg.binding.b1=v4&arg.dlq.queue.dq1=v5&arg.dlq.binding.db1=v6", RabbitMQEndpoint.class); @@ -192,7 +192,7 @@ public class RabbitMQEndpointTest extends CamelTestSupport { } @Test - public void brokerEndpointAddressesSettings() throws Exception { + public void brokerEndpointAddressesSettings() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?addresses=server1:12345,server2:12345", RabbitMQEndpoint.class); assertEquals(2, endpoint.parseAddresses().length, "Wrong size of endpoint addresses."); @@ -255,68 +255,68 @@ public class RabbitMQEndpointTest extends CamelTestSupport { } @Test - public void createEndpointWithTransferExceptionEnabled() throws Exception { + public void createEndpointWithTransferExceptionEnabled() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?transferException=true", RabbitMQEndpoint.class); assertEquals(true, endpoint.isTransferException()); } @Test - public void createEndpointWithReplyTimeout() throws Exception { + public void createEndpointWithReplyTimeout() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?requestTimeout=2000", RabbitMQEndpoint.class); assertEquals(2000, endpoint.getRequestTimeout()); } @Test - public void createEndpointWithRequestTimeoutCheckerInterval() throws Exception { + public void createEndpointWithRequestTimeoutCheckerInterval() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?requestTimeoutCheckerInterval=1000", RabbitMQEndpoint.class); assertEquals(1000, endpoint.getRequestTimeoutCheckerInterval()); } @Test - public void createEndpointWithSkipQueueDeclareEnabled() throws Exception { + public void createEndpointWithSkipQueueDeclareEnabled() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?skipQueueDeclare=true", RabbitMQEndpoint.class); assertTrue(endpoint.isSkipQueueDeclare()); } @Test - public void createEndpointWithSkipExchangeDeclareEnabled() throws Exception { + public void createEndpointWithSkipExchangeDeclareEnabled() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?skipExchangeDeclare=true", RabbitMQEndpoint.class); assertTrue(endpoint.isSkipExchangeDeclare()); } @Test - public void createEndpointWithSkipQueueBindEndabled() throws Exception { + public void createEndpointWithSkipQueueBindEndabled() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?SkipQueueBind=true", RabbitMQEndpoint.class); assertTrue(endpoint.isSkipQueueBind()); } @Test - public void createEndpointWithExclusiveEnabled() throws Exception { + public void createEndpointWithExclusiveEnabled() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?exclusive=true", RabbitMQEndpoint.class); assertTrue(endpoint.isExclusive()); } @Test - public void createEndpointWithExclusiveConsumerEnabled() throws Exception { + public void createEndpointWithExclusiveConsumerEnabled() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?exclusiveConsumer=true", RabbitMQEndpoint.class); assertTrue(endpoint.isExclusiveConsumer()); } @Test - public void createEndpointWithPassiveEnabled() throws Exception { + public void createEndpointWithPassiveEnabled() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?passive=true", RabbitMQEndpoint.class); assertTrue(endpoint.isPassive()); } @Test - public void testEndpointArgsIssue() throws Exception { + public void testEndpointArgsIssue() { RabbitMQEndpoint endpoint1 = context.getEndpoint("rabbitmq://localhost:5672/mydirectdelayed?queue=testQ4" + "&routingKey=testKey&username=me&password=mypwd&threadPoolSize=1&concurrentConsumers=1&autoDelete=false" + "&vhost=myvhost&arg.queue.x-single-active-consumer=true&arg.exchange.x-delayed-type=direct&exchangeType=x-delayed-message", diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLookupConnectionFactoryTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLookupConnectionFactoryTest.java index 8068f962eaf..5f64495094e 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLookupConnectionFactoryTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLookupConnectionFactoryTest.java @@ -30,7 +30,7 @@ public class RabbitMQLookupConnectionFactoryTest extends CamelTestSupport { private ConnectionFactory myConnectionFactory; @Override - protected Registry createCamelRegistry() throws Exception { + protected Registry createCamelRegistry() { SimpleRegistry registry = new SimpleRegistry(); myConnectionFactory = new ConnectionFactory(); myConnectionFactory.setHost("myhost"); @@ -40,7 +40,7 @@ public class RabbitMQLookupConnectionFactoryTest extends CamelTestSupport { } @Test - public void testLookupConnectionFactory() throws Exception { + public void testLookupConnectionFactory() { RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:myexchange", RabbitMQEndpoint.class); assertNotNull(endpoint); assertSame(endpoint.getConnectionFactory(), myConnectionFactory); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java index 5775a144c4e..d8182688fb8 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java @@ -62,7 +62,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesContentTypeHeader() throws IOException { + public void testPropertiesUsesContentTypeHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.CONTENT_TYPE, "application/json"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -70,7 +70,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesCorrelationHeader() throws IOException { + public void testPropertiesUsesCorrelationHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.CORRELATIONID, "124544"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -78,7 +78,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesUserIdHeader() throws IOException { + public void testPropertiesUsesUserIdHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.USERID, "abcd"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -86,7 +86,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesMessageIdHeader() throws IOException { + public void testPropertiesUsesMessageIdHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.MESSAGE_ID, "abvasweaqQQ"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -94,7 +94,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesDeliveryModeHeader() throws IOException { + public void testPropertiesUsesDeliveryModeHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.DELIVERY_MODE, "444"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -102,7 +102,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesClusterIdHeader() throws IOException { + public void testPropertiesUsesClusterIdHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.CLUSTERID, "abtasg5r"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -110,7 +110,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesReplyToHeader() throws IOException { + public void testPropertiesUsesReplyToHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.REPLY_TO, "bbbbdfgdfg"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -118,7 +118,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesPriorityHeader() throws IOException { + public void testPropertiesUsesPriorityHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.PRIORITY, "15"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -126,7 +126,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesExpirationHeader() throws IOException { + public void testPropertiesUsesExpirationHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.EXPIRATION, "thursday"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -134,7 +134,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesTypeHeader() throws IOException { + public void testPropertiesUsesTypeHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.TYPE, "sometype"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -142,7 +142,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesContentEncodingHeader() throws IOException { + public void testPropertiesUsesContentEncodingHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.CONTENT_ENCODING, "qwergghdfdfgdfgg"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -150,7 +150,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesAppIdHeader() throws IOException { + public void testPropertiesAppIdHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.APP_ID, "qweeqwe"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -158,7 +158,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesOverrideNameHeader() throws IOException { + public void testPropertiesOverrideNameHeader() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.EXCHANGE_OVERRIDE_NAME, "qweeqwe"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -166,7 +166,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesTimestampHeaderAsLongValue() throws IOException { + public void testPropertiesUsesTimestampHeaderAsLongValue() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.TIMESTAMP, "12345123"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -174,7 +174,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesTimestampHeaderAsDateValue() throws IOException { + public void testPropertiesUsesTimestampHeaderAsDateValue() { Date timestamp = new Date(); RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.TIMESTAMP, timestamp); @@ -183,7 +183,7 @@ public class RabbitMQProducerTest { } @Test - public void testPropertiesUsesCustomHeaders() throws IOException { + public void testPropertiesUsesCustomHeaders() { RabbitMQProducer producer = new RabbitMQProducer(endpoint); Map<String, Object> customHeaders = new HashMap<>(); customHeaders.put("stringHeader", "A string"); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQBasicIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQBasicIT.java index fd77a688ffe..482aac9b9d4 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQBasicIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQBasicIT.java @@ -33,7 +33,7 @@ public class RabbitMQBasicIT extends AbstractRabbitMQIT { private MockEndpoint mock; @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { ConnectionProperties connectionProperties = service.connectionProperties(); foo = String.format("rabbitmq:%s:%d/foo?username=%s&password=%s", connectionProperties.hostname(), connectionProperties.port(), connectionProperties.username(), connectionProperties.password()); @@ -43,7 +43,7 @@ public class RabbitMQBasicIT extends AbstractRabbitMQIT { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from(foo).log("FOO received: ${body}").to(bar); from(bar).log("BAR received: ${body}").to(mock).transform().simple("Bye ${body}"); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQConsumerIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQConsumerIT.java index 7163ab5a460..d36211b1d12 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQConsumerIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQConsumerIT.java @@ -54,13 +54,13 @@ public class RabbitMQConsumerIT extends AbstractRabbitMQIT { }; @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { ConnectionProperties connectionProperties = service.connectionProperties(); return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { fromF("rabbitmq:localhost:%d/%s?username=%s&password=%s&arg.queue.x-single-active-consumer=true", connectionProperties.port(), EXCHANGE, connectionProperties.username(), connectionProperties.password()) .to(to); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQConsumerReplyToIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQConsumerReplyToIT.java index 22fc4ccbd4f..a2a6a4fd1af 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQConsumerReplyToIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQConsumerReplyToIT.java @@ -20,7 +20,6 @@ import java.io.IOException; import java.time.Duration; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.TimeoutException; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.Channel; @@ -58,14 +57,14 @@ public class RabbitMQConsumerReplyToIT extends AbstractRabbitMQIT { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { ConnectionProperties connectionProperties = service.connectionProperties(); context().setTracing(true); return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { log.info("Building routes..."); fromF("rabbitmq:localhost:%d/%s?username=%s&password=%s&routingKey=%s", connectionProperties.port(), @@ -76,7 +75,7 @@ public class RabbitMQConsumerReplyToIT extends AbstractRabbitMQIT { } @Test - public void replyMessageIsReceived() throws IOException, TimeoutException, InterruptedException { + public void replyMessageIsReceived() throws IOException, InterruptedException { final List<String> received = new ArrayList<>(); AMQP.BasicProperties.Builder prop = new AMQP.BasicProperties.Builder(); @@ -88,7 +87,7 @@ public class RabbitMQConsumerReplyToIT extends AbstractRabbitMQIT { assertThatBodiesReceivedIn(received, REPLY); } - private void assertThatBodiesReceivedIn(final List<String> received, final String... expected) throws InterruptedException { + private void assertThatBodiesReceivedIn(final List<String> received, final String... expected) { Awaitility.await().atMost(Duration.ofSeconds(1)).untilAsserted(() -> assertListSize(received, expected.length)); for (String body : expected) { @@ -105,8 +104,7 @@ public class RabbitMQConsumerReplyToIT extends AbstractRabbitMQIT { } @Override - public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) - throws IOException { + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) { received.add(new String(body)); } } diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQDeadLetterRoutingKeyIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQDeadLetterRoutingKeyIT.java index 778be72c6b0..43b63e3b26e 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQDeadLetterRoutingKeyIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQDeadLetterRoutingKeyIT.java @@ -99,7 +99,7 @@ public class RabbitMQDeadLetterRoutingKeyIT extends AbstractRabbitMQIT { } @Test - public void originalRoutingKeyIsReceived() throws IOException, InterruptedException { + public void originalRoutingKeyIsReceived() throws IOException { final List<String> received = new ArrayList<>(); final StringBuilder routingKey = new StringBuilder(); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQInOutIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQInOutIT.java index ed6893a6c2f..6abcf4181d8 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQInOutIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQInOutIT.java @@ -16,7 +16,6 @@ */ package org.apache.camel.component.rabbitmq.integration; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -63,7 +62,7 @@ public class RabbitMQInOutIT extends AbstractRabbitMQIT { private MockEndpoint resultEndpoint; @Override - protected Registry createCamelRegistry() throws Exception { + protected Registry createCamelRegistry() { SimpleRegistry reg = new SimpleRegistry(); Map<String, Object> args = new HashMap<>(); @@ -74,7 +73,7 @@ public class RabbitMQInOutIT extends AbstractRabbitMQIT { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { ConnectionProperties connectionProperties = service.connectionProperties(); String rabbitMQEndpoint = String .format("rabbitmq:%s:%d/%s?threadPoolSize=1&exchangeType=direct&username=%s&password=%s" @@ -93,7 +92,7 @@ public class RabbitMQInOutIT extends AbstractRabbitMQIT { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("direct:rabbitMQ").id("producingRoute").setHeader("routeHeader", simple("routeHeader")) .to(ExchangePattern.InOut, rabbitMQEndpoint); @@ -138,7 +137,7 @@ public class RabbitMQInOutIT extends AbstractRabbitMQIT { } @Test - public void inOutRaceConditionTest1() throws InterruptedException, IOException { + public void inOutRaceConditionTest1() { String reply = template.requestBodyAndHeader("direct:rabbitMQ", "test1", RabbitMQConstants.EXCHANGE_NAME, EXCHANGE, String.class); @@ -146,7 +145,7 @@ public class RabbitMQInOutIT extends AbstractRabbitMQIT { } @Test - public void inOutRaceConditionTest2() throws InterruptedException, IOException { + public void inOutRaceConditionTest2() { String reply = template.requestBodyAndHeader("direct:rabbitMQ", "test2", RabbitMQConstants.EXCHANGE_NAME, EXCHANGE, String.class); @@ -154,7 +153,7 @@ public class RabbitMQInOutIT extends AbstractRabbitMQIT { } @Test - public void headerTest() throws InterruptedException, IOException { + public void headerTest() { Map<String, Object> headers = new HashMap<>(); TestSerializableObject testObject = new TestSerializableObject(); @@ -206,7 +205,7 @@ public class RabbitMQInOutIT extends AbstractRabbitMQIT { } @Test - public void inOutTimeOutTest() throws InterruptedException { + public void inOutTimeOutTest() { try { template.requestBodyAndHeader("direct:rabbitMQ", "TimeOut", RabbitMQConstants.EXCHANGE_NAME, EXCHANGE, String.class); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQLoadIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQLoadIT.java index 549b64f7d05..0cd879a244f 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQLoadIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQLoadIT.java @@ -52,7 +52,7 @@ public class RabbitMQLoadIT extends AbstractRabbitMQIT { private MockEndpoint consumingMockEndpoint; @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { ConnectionProperties connectionProperties = service.connectionProperties(); String rabbitMQEndpoint = String.format("rabbitmq:localhost:%d/ex4?username=%s&password=%s&queue=q4&routingKey=%s" @@ -64,7 +64,7 @@ public class RabbitMQLoadIT extends AbstractRabbitMQIT { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("direct:rabbitMQ").id("producingRoute").log("Sending message").to(ExchangePattern.InOnly, rabbitMQEndpoint) .to(producingMockEndpoint); from(rabbitMQEndpoint).id("consumingRoute").log("Receiving message").to(consumingMockEndpoint); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQProducerIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQProducerIT.java index 02bd32014b7..8f2d18e89ac 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQProducerIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQProducerIT.java @@ -22,7 +22,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.TimeoutException; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.Channel; @@ -95,7 +94,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { String basicURI = getBasicURI(ROUTE); String allowNullHeaders = basicURI + "&allowNullHeaders=true&allowCustomHeaders=false"; String allowCustomHeaders = basicURI + "&allowCustomHeaders=true"; @@ -108,7 +107,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { context().setTracing(true); return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("direct:start").to(basicURI); from("direct:start-allow-null-headers").to(allowNullHeaders); from("direct:start-not-allow-custom-headers").to(allowNullHeaders); @@ -138,7 +137,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { } @Test - public void producedMessageIsReceived() throws InterruptedException, IOException, TimeoutException { + public void producedMessageIsReceived() throws InterruptedException, IOException { final List<String> received = new ArrayList<>(); channel.basicConsume("sammyq", true, new ArrayPopulatingConsumer(received)); @@ -148,7 +147,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { } @Test - public void producedMessageWithNotNullHeaders() throws InterruptedException, IOException, TimeoutException { + public void producedMessageWithNotNullHeaders() throws InterruptedException, IOException { final List<String> received = new ArrayList<>(); final Map<String, Object> receivedHeaders = new HashMap<>(); Map<String, Object> headers = new HashMap<>(); @@ -164,7 +163,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { } @Test - public void producedMessageAllowNullHeaders() throws InterruptedException, IOException, TimeoutException { + public void producedMessageAllowNullHeaders() throws InterruptedException, IOException { final List<String> received = new ArrayList<>(); final Map<String, Object> receivedHeaders = new HashMap<>(); Map<String, Object> headers = new HashMap<>(); @@ -180,7 +179,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { } @Test - public void producedMessageNotAllowCustomHeaders() throws InterruptedException, IOException, TimeoutException { + public void producedMessageNotAllowCustomHeaders() throws IOException { final List<String> received = new ArrayList<>(); final Map<String, Object> receivedHeaders = new HashMap<>(); Map<String, Object> headers = new HashMap<>(); @@ -199,7 +198,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { } @Test - public void producedMessageAllowCustomHeaders() throws InterruptedException, IOException, TimeoutException { + public void producedMessageAllowCustomHeaders() throws InterruptedException, IOException { final List<String> received = new ArrayList<>(); final Map<String, Object> receivedHeaders = new HashMap<>(); Map<String, Object> headers = new HashMap<>(); @@ -249,7 +248,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { @Test public void producedMessageIsReceivedWhenPublisherAcknowledgementsAreEnabled() - throws InterruptedException, IOException, TimeoutException { + throws InterruptedException, IOException { final List<String> received = new ArrayList<>(); channel.basicConsume("sammyq", true, new ArrayPopulatingConsumer(received)); @@ -260,7 +259,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { @Test public void producedMessageIsReceivedWhenPublisherAcknowledgementsAreEnabledAndBadRoutingKeyIsUsed() - throws InterruptedException, IOException, TimeoutException { + throws InterruptedException, IOException { final List<String> received = new ArrayList<>(); channel.basicConsume("sammyq", true, new ArrayPopulatingConsumer(received)); @@ -271,7 +270,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { @Test public void shouldSuccessfullyProduceMessageWhenGuaranteedDeliveryIsActivatedAndMessageIsMarkedAsMandatory() - throws InterruptedException, IOException, TimeoutException { + throws InterruptedException, IOException { final List<String> received = new ArrayList<>(); channel.basicConsume("sammyq", true, new ArrayPopulatingConsumer(received)); @@ -288,7 +287,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { @Test public void shouldSuccessfullyProduceMessageWhenGuaranteedDeliveryIsActivatedOnABadRouteButMessageIsNotMandatory() - throws InterruptedException, IOException, TimeoutException { + throws InterruptedException, IOException { final List<String> received = new ArrayList<>(); channel.basicConsume("sammyq", true, new ArrayPopulatingConsumer(received)); @@ -315,8 +314,7 @@ public class RabbitMQProducerIT extends AbstractRabbitMQIT { } @Override - public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) - throws IOException { + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) { LOGGER.info("AMQP.BasicProperties: {}", properties); receivedHeaders.putAll(properties.getHeaders()); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQReConnectionIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQReConnectionIT.java index 9ad7d9aa52f..a7ca0b0a24c 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQReConnectionIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQReConnectionIT.java @@ -55,7 +55,7 @@ public class RabbitMQReConnectionIT extends AbstractRabbitMQIT { private MockEndpoint consumingMockEndpoint; @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { ConnectionProperties connectionProperties = service.connectionProperties(); String rabbitMQEndpoint = String.format("rabbitmq:localhost:%d/%s?username=%s&password=%s" + "&queue=q3&routingKey=rk3&automaticRecoveryEnabled=true&requestedHeartbeat=1000&connectionTimeout=5000", @@ -65,7 +65,7 @@ public class RabbitMQReConnectionIT extends AbstractRabbitMQIT { @Override @SuppressWarnings("unchecked") - public void configure() throws Exception { + public void configure() { from("direct:rabbitMQ").id("producingRoute").onException(AlreadyClosedException.class, ConnectException.class) .maximumRedeliveries(10).redeliveryDelay(500L).end() .log("Sending message").to(ExchangePattern.InOnly, rabbitMQEndpoint).to(producingMockEndpoint); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQRequeueHandledExceptionIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQRequeueHandledExceptionIT.java index 455ecdaf374..2044456ec7b 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQRequeueHandledExceptionIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQRequeueHandledExceptionIT.java @@ -42,7 +42,7 @@ public class RabbitMQRequeueHandledExceptionIT extends AbstractRabbitMQIT { private MockEndpoint consumingMockEndpoint; @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { ConnectionProperties connectionProperties = service.connectionProperties(); String rabbitMQEndpoint @@ -53,7 +53,7 @@ public class RabbitMQRequeueHandledExceptionIT extends AbstractRabbitMQIT { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("direct:rabbitMQ").id("producingRoute").log("Sending message").to(ExchangePattern.InOnly, rabbitMQEndpoint) .to(producingMockEndpoint); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQRequeueUnhandledExceptionIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQRequeueUnhandledExceptionIT.java index e0c854d15ae..fe4873bd5fa 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQRequeueUnhandledExceptionIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQRequeueUnhandledExceptionIT.java @@ -42,7 +42,7 @@ public class RabbitMQRequeueUnhandledExceptionIT extends AbstractRabbitMQIT { private MockEndpoint consumingMockEndpoint; @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { ConnectionProperties connectionProperties = service.connectionProperties(); String rabbitMQEndpoint = String.format("rabbitmq:localhost:%d/ex4?username=%s&password=%s&autoAck=false&queue=q4&routingKey=%s", @@ -52,7 +52,7 @@ public class RabbitMQRequeueUnhandledExceptionIT extends AbstractRabbitMQIT { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("direct:rabbitMQ").id("producingRoute").log("Sending message") .to(ExchangePattern.InOnly, rabbitMQEndpoint) .to(producingMockEndpoint); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQSupendResumeIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQSupendResumeIT.java index 7985a9ac606..96904d88eed 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQSupendResumeIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQSupendResumeIT.java @@ -36,7 +36,7 @@ public class RabbitMQSupendResumeIT extends AbstractRabbitMQIT { private ProducerTemplate template; @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { ConnectionProperties connectionProperties = service.connectionProperties(); String rabbitMQEndpoint = String.format( "rabbitmq:localhost:%d/%susername=%s&password=%s&queue=q6&routingKey=rk3&autoDelete=false", @@ -45,7 +45,7 @@ public class RabbitMQSupendResumeIT extends AbstractRabbitMQIT { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("direct:start").routeId("producer").log("sending ${body}").to(rabbitMQEndpoint); from(rabbitMQEndpoint).routeId("consumer").log("got ${body}").to("mock:result"); } diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQToDIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQToDIT.java index b56339e5d99..619ec4a7e5c 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQToDIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQToDIT.java @@ -34,10 +34,10 @@ public class RabbitMQToDIT extends AbstractRabbitMQIT { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { RabbitMQComponent mq = context.getComponent("rabbitmq", RabbitMQComponent.class); mq.setHostname(service.connectionProperties().hostname()); mq.setPortNumber(service.connectionProperties().port()); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQToDSendDynamicIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQToDSendDynamicIT.java index 89e0a91fe05..8cb71d613ca 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQToDSendDynamicIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQToDSendDynamicIT.java @@ -26,7 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class RabbitMQToDSendDynamicIT extends AbstractRabbitMQIT { @Test - public void testToD() throws Exception { + public void testToD() { template.sendBodyAndHeader("direct:start", "Hello bar", "where", "bar"); template.sendBodyAndHeader("direct:start", "Hello beer", "where", "beer"); @@ -36,10 +36,10 @@ public class RabbitMQToDSendDynamicIT extends AbstractRabbitMQIT { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { RabbitMQComponent mq = context.getComponent("rabbitmq", RabbitMQComponent.class); mq.setHostname(service.connectionProperties().hostname()); mq.setPortNumber(service.connectionProperties().port()); diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/qpid/RabbitMQProducerQpidIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/qpid/RabbitMQProducerQpidIT.java index 900948f3d60..3bf8ce10920 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/qpid/RabbitMQProducerQpidIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/qpid/RabbitMQProducerQpidIT.java @@ -16,9 +16,6 @@ */ package org.apache.camel.component.rabbitmq.integration.qpid; -import java.io.IOException; -import java.util.concurrent.TimeoutException; - import org.apache.camel.component.rabbitmq.integration.RabbitMQProducerIT; import org.junit.jupiter.api.condition.EnabledIfSystemProperty; @@ -26,12 +23,10 @@ import org.junit.jupiter.api.condition.EnabledIfSystemProperty; public class RabbitMQProducerQpidIT extends RabbitMQProducerIT { @Override - public void producedMessageIsReceivedWhenPublisherAcknowledgementsAreEnabledAndBadRoutingKeyIsUsed() - throws InterruptedException, IOException, TimeoutException { + public void producedMessageIsReceivedWhenPublisherAcknowledgementsAreEnabledAndBadRoutingKeyIsUsed() { } @Override - public void shouldSuccessfullyProduceMessageWhenGuaranteedDeliveryIsActivatedOnABadRouteButMessageIsNotMandatory() - throws InterruptedException, IOException, TimeoutException { + public void shouldSuccessfullyProduceMessageWhenGuaranteedDeliveryIsActivatedOnABadRouteButMessageIsNotMandatory() { } } diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/qpid/RabbitMQRequeueQpidIT.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/qpid/RabbitMQRequeueQpidIT.java index 928edd637a8..8377b2a76b8 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/qpid/RabbitMQRequeueQpidIT.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/qpid/RabbitMQRequeueQpidIT.java @@ -25,16 +25,16 @@ public class RabbitMQRequeueQpidIT extends RabbitMQRequeueIT { @Override @Test - public void testNoRequeueHeaderCausesReject() throws Exception { + public void testNoRequeueHeaderCausesReject() { } @Override @Test - public void testNonBooleanRequeueHeaderCausesReject() throws Exception { + public void testNonBooleanRequeueHeaderCausesReject() { } @Override @Test - public void testFalseRequeueHeaderCausesReject() throws Exception { + public void testFalseRequeueHeaderCausesReject() { } }
