This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 76765f6 CAMEL-12240: Create a real tests with Apache Qpid Broker-J 76765f6 is described below commit 76765f6e6cc793db0bb7176eee0c1e4081bcc27e Author: Dmitry Volodin <dmvo...@gmail.com> AuthorDate: Mon Feb 12 19:13:41 2018 +0300 CAMEL-12240: Create a real tests with Apache Qpid Broker-J --- components/camel-rabbitmq/pom.xml | 24 +++++++ .../rabbitmq/RabbitMQMessagePublisher.java | 1 - .../rabbitmq/AbstractRabbitMQIntTest.java | 27 +++++++- .../rabbitmq/RabbitMQConsumerIntTestReplyTo.java | 15 ++-- .../component/rabbitmq/RabbitMQInOutIntTest.java | 3 +- .../component/rabbitmq/RabbitMQLoadIntTest.java | 3 +- .../rabbitmq/RabbitMQReConnectionIntTest.java | 4 +- .../component/rabbitmq/RabbitMQRequeueIntTest.java | 3 +- .../RabbitMQRequeueUnhandledExceptionIntTest.java | 3 +- .../rabbitmq/RabbitMQSupendResumeIntTest.java | 3 +- .../rabbitmq/qpid/RabbitMQConsumerQpidTest.java | 33 +++++++++ .../qpid/RabbitMQConsumerQpidTestReplyTo.java | 42 +++++++++++ .../rabbitmq/qpid/RabbitMQInOutQpidTest.java | 33 +++++++++ .../rabbitmq/qpid/RabbitMQLoadQpidTest.java | 33 +++++++++ .../rabbitmq/qpid/RabbitMQProducerQpidTest.java | 47 +++++++++++++ .../qpid/RabbitMQReConnectionQpidTest.java | 33 +++++++++ .../rabbitmq/qpid/RabbitMQRequeueQpidTest.java | 49 +++++++++++++ .../RabbitMQRequeueUnhandledExceptionQpidTest.java | 33 +++++++++ .../qpid/RabbitMQSupendResumeQpidTest.java | 33 +++++++++ .../camel-rabbitmq/src/test/resources/README.md | 5 ++ .../rabbitmq/RabbitMQSpringIntTest-context.xml | 39 ++++------- .../test/resources/qpid-test-initial-config.json | 67 ++++++++++++++++++ .../test/resources/qpid-test-with-management.json | 81 ++++++++++++++++++++++ .../src/test/resources/qpid-test.acl | 6 ++ parent/pom.xml | 1 + 25 files changed, 572 insertions(+), 49 deletions(-) diff --git a/components/camel-rabbitmq/pom.xml b/components/camel-rabbitmq/pom.xml index 949cc9e..5928ad1 100644 --- a/components/camel-rabbitmq/pom.xml +++ b/components/camel-rabbitmq/pom.xml @@ -66,6 +66,30 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.apache.qpid</groupId> + <artifactId>qpid-broker-core</artifactId> + <version>${qpid-broker-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.qpid</groupId> + <artifactId>qpid-broker-plugins-amqp-0-8-protocol</artifactId> + <version>${qpid-broker-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.qpid</groupId> + <artifactId>qpid-broker-plugins-memory-store</artifactId> + <version>${qpid-broker-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.qpid</groupId> + <artifactId>qpid-broker-plugins-access-control</artifactId> + <version>${qpid-broker-version}</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> <scope>test</scope> diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessagePublisher.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessagePublisher.java index a61d470..85e657f 100644 --- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessagePublisher.java +++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessagePublisher.java @@ -24,7 +24,6 @@ import java.io.Serializable; import java.util.concurrent.TimeoutException; import com.rabbitmq.client.AMQP; -import com.rabbitmq.client.AlreadyClosedException; import com.rabbitmq.client.Channel; import com.rabbitmq.client.ReturnListener; diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/AbstractRabbitMQIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/AbstractRabbitMQIntTest.java index fdb2cb8..f78eb90 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/AbstractRabbitMQIntTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/AbstractRabbitMQIntTest.java @@ -17,16 +17,23 @@ package org.apache.camel.component.rabbitmq; import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.TimeoutException; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.qpid.server.SystemLauncher; +import org.apache.qpid.server.model.SystemConfig; public abstract class AbstractRabbitMQIntTest extends CamelTestSupport { - + protected static final String INITIAL_CONFIGURATION = "qpid-test-initial-config.json"; + protected static SystemLauncher systemLauncher = new SystemLauncher(); + /** - * Helper method for creating a rabbitmq connection to the test instance of the - * rabbitmq server. + * Helper method for creating a RabbitMQ connection to the test instance of the + * RabbitMQ server. * @return * @throws IOException * @throws TimeoutException @@ -40,4 +47,18 @@ public abstract class AbstractRabbitMQIntTest extends CamelTestSupport { factory.setVirtualHost("/"); return factory.newConnection(); } + + /** + * Helper method for creating a Qpid Broker-J system configuration for the + * initiate of the local AMQP server. + */ + protected static Map<String, Object> createQpidSystemConfig() { + Map<String, Object> attributes = new HashMap<>(); + URL initialConfig = AbstractRabbitMQIntTest.class.getClassLoader().getResource(INITIAL_CONFIGURATION); + attributes.put(SystemConfig.TYPE, "Memory"); + attributes.put(SystemConfig.INITIAL_CONFIGURATION_LOCATION, initialConfig.toExternalForm()); + attributes.put(SystemConfig.STARTUP_LOGGED_TO_SYSTEM_OUT, false); + + return attributes; + } } diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTestReplyTo.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTestReplyTo.java index 85cc1f3..07c2d6e 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTestReplyTo.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTestReplyTo.java @@ -37,25 +37,24 @@ import org.junit.Test; * Integration test to check if requested direct reply messages are received */ public class RabbitMQConsumerIntTestReplyTo extends AbstractRabbitMQIntTest { - + protected static final String QUEUE = "amq.rabbitmq.reply-to"; + private static final String EXCHANGE = "ex_reply"; private static final String ROUTING_KEY = "testreply"; private static final String REQUEST = "Knock! Knock!"; private static final String REPLY = "Hello world"; - private static final String QUEUE = "amq.rabbitmq.reply-to"; + protected Channel channel; + @EndpointInject(uri = "rabbitmq:localhost:5672/" + EXCHANGE + "?routingKey=" + ROUTING_KEY) private Endpoint from; private Connection connection; - private Channel channel; - + @Before public void setUpRabbitMQ() throws Exception { connection = connection(); channel = connection.createChannel(); -// channel.queueDeclare("sammyq", false, false, true, null); -// channel.queueBind("sammyq", EXCHANGE, ROUTE); } @Override @@ -112,6 +111,4 @@ public class RabbitMQConsumerIntTestReplyTo extends AbstractRabbitMQIntTest { received.add(new String(body)); } } - -} - +} \ No newline at end of file diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java index 467c57e..0b73135 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java @@ -40,10 +40,9 @@ import org.apache.camel.component.rabbitmq.testbeans.TestNonSerializableObject; import org.apache.camel.component.rabbitmq.testbeans.TestPartiallySerializableObject; import org.apache.camel.component.rabbitmq.testbeans.TestSerializableObject; import org.apache.camel.impl.JndiRegistry; -import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; -public class RabbitMQInOutIntTest extends CamelTestSupport { +public class RabbitMQInOutIntTest extends AbstractRabbitMQIntTest { public static final String ROUTING_KEY = "rk5"; public static final long TIMEOUT_MS = 2000; diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLoadIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLoadIntTest.java index 281ef52..40354e6 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLoadIntTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLoadIntTest.java @@ -29,14 +29,13 @@ import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; /** * Integration test to check that RabbitMQ Endpoint is able handle heavy load using multiple producers and * consumers */ -public class RabbitMQLoadIntTest extends CamelTestSupport { +public class RabbitMQLoadIntTest extends AbstractRabbitMQIntTest { public static final String ROUTING_KEY = "rk4"; private static final int PRODUCER_COUNT = 10; private static final int CONSUMER_COUNT = 10; diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQReConnectionIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQReConnectionIntTest.java index ec72f7b..b8cccb8 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQReConnectionIntTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQReConnectionIntTest.java @@ -28,7 +28,6 @@ import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; /** @@ -43,7 +42,7 @@ import org.junit.Test; * <li>Kill all connections from the broker: the producer sends messages, and the consumer receives messages</li> * </ul> */ -public class RabbitMQReConnectionIntTest extends CamelTestSupport { +public class RabbitMQReConnectionIntTest extends AbstractRabbitMQIntTest { private static final String EXCHANGE = "ex3"; @Produce(uri = "direct:rabbitMQ") @@ -65,6 +64,7 @@ public class RabbitMQReConnectionIntTest extends CamelTestSupport { return new RouteBuilder() { @Override + @SuppressWarnings("unchecked") public void configure() throws Exception { from("direct:rabbitMQ") .id("producingRoute") diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQRequeueIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQRequeueIntTest.java index e0c8d74..cbaf3d0 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQRequeueIntTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQRequeueIntTest.java @@ -22,13 +22,12 @@ import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; /** * Integration test to confirm REQUEUE header causes message to be re-queued instead of sent to DLQ. */ -public class RabbitMQRequeueIntTest extends CamelTestSupport { +public class RabbitMQRequeueIntTest extends AbstractRabbitMQIntTest { public static final String ROUTING_KEY = "rk4"; @Produce(uri = "direct:rabbitMQ") diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQRequeueUnhandledExceptionIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQRequeueUnhandledExceptionIntTest.java index 4b7c6fa..2e18a4e 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQRequeueUnhandledExceptionIntTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQRequeueUnhandledExceptionIntTest.java @@ -22,13 +22,12 @@ import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; /** * Integration test to confirm REQUEUE header causes message to be re-queued when an unhandled exception occurs. */ -public class RabbitMQRequeueUnhandledExceptionIntTest extends CamelTestSupport { +public class RabbitMQRequeueUnhandledExceptionIntTest extends AbstractRabbitMQIntTest { public static final String ROUTING_KEY = "rk4"; @Produce(uri = "direct:rabbitMQ") diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQSupendResumeIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQSupendResumeIntTest.java index c5c3481..2bb3820 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQSupendResumeIntTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQSupendResumeIntTest.java @@ -24,10 +24,9 @@ import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; -public class RabbitMQSupendResumeIntTest extends CamelTestSupport { +public class RabbitMQSupendResumeIntTest extends AbstractRabbitMQIntTest { private static final String EXCHANGE = "ex6"; @EndpointInject(uri = "mock:result") diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQConsumerQpidTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQConsumerQpidTest.java new file mode 100644 index 0000000..1272848 --- /dev/null +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQConsumerQpidTest.java @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.rabbitmq.qpid; + +import org.apache.camel.component.rabbitmq.RabbitMQConsumerIntTest; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +public class RabbitMQConsumerQpidTest extends RabbitMQConsumerIntTest { + @BeforeClass + public static void startBroker() throws Exception { + systemLauncher.startup(createQpidSystemConfig()); + } + + @AfterClass + public static void stopBroker() { + systemLauncher.shutdown(); + } +} diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQConsumerQpidTestReplyTo.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQConsumerQpidTestReplyTo.java new file mode 100644 index 0000000..e84087d --- /dev/null +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQConsumerQpidTestReplyTo.java @@ -0,0 +1,42 @@ +/** + * 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.rabbitmq.qpid; + +import org.apache.camel.component.rabbitmq.RabbitMQConsumerIntTestReplyTo; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; + +public class RabbitMQConsumerQpidTestReplyTo extends RabbitMQConsumerIntTestReplyTo { + @BeforeClass + public static void startBroker() throws Exception { + systemLauncher.startup(createQpidSystemConfig()); + } + + @AfterClass + public static void stopBroker() { + systemLauncher.shutdown(); + } + + @Override + @Before + public void setUpRabbitMQ() throws Exception { + super.setUpRabbitMQ(); + + channel.queueDeclare(QUEUE, false, false, true, null); + } +} diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQInOutQpidTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQInOutQpidTest.java new file mode 100644 index 0000000..53c4113 --- /dev/null +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQInOutQpidTest.java @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.rabbitmq.qpid; + +import org.apache.camel.component.rabbitmq.RabbitMQInOutIntTest; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +public class RabbitMQInOutQpidTest extends RabbitMQInOutIntTest { + @BeforeClass + public static void startBroker() throws Exception { + systemLauncher.startup(createQpidSystemConfig()); + } + + @AfterClass + public static void stopBroker() { + systemLauncher.shutdown(); + } +} diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQLoadQpidTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQLoadQpidTest.java new file mode 100644 index 0000000..86d9999 --- /dev/null +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQLoadQpidTest.java @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.rabbitmq.qpid; + +import org.apache.camel.component.rabbitmq.RabbitMQLoadIntTest; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +public class RabbitMQLoadQpidTest extends RabbitMQLoadIntTest { + @BeforeClass + public static void startBroker() throws Exception { + systemLauncher.startup(createQpidSystemConfig()); + } + + @AfterClass + public static void stopBroker() { + systemLauncher.shutdown(); + } +} diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQProducerQpidTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQProducerQpidTest.java new file mode 100644 index 0000000..957872d --- /dev/null +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQProducerQpidTest.java @@ -0,0 +1,47 @@ +/** + * 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.rabbitmq.qpid; + +import java.io.IOException; +import java.util.concurrent.TimeoutException; + +import org.apache.camel.component.rabbitmq.RabbitMQProducerIntTest; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; + +public class RabbitMQProducerQpidTest extends RabbitMQProducerIntTest { + @BeforeClass + public static void startBroker() throws Exception { + systemLauncher.startup(createQpidSystemConfig()); + } + + @AfterClass + public static void stopBroker() { + systemLauncher.shutdown(); + } + + @Ignore + @Override + public void producedMessageIsReceivedWhenPublisherAcknowledgementsAreEnabledAndBadRoutingKeyIsUsed() throws InterruptedException, IOException, TimeoutException { + } + + @Ignore + @Override + public void shouldSuccessfullyProduceMessageWhenGuaranteedDeliveryIsActivatedOnABadRouteButMessageIsNotMandatory() throws InterruptedException, IOException, TimeoutException { + } +} \ No newline at end of file diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQReConnectionQpidTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQReConnectionQpidTest.java new file mode 100644 index 0000000..eacf64f --- /dev/null +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQReConnectionQpidTest.java @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.rabbitmq.qpid; + +import org.apache.camel.component.rabbitmq.RabbitMQReConnectionIntTest; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +public class RabbitMQReConnectionQpidTest extends RabbitMQReConnectionIntTest { + @BeforeClass + public static void startBroker() throws Exception { + systemLauncher.startup(createQpidSystemConfig()); + } + + @AfterClass + public static void stopBroker() { + systemLauncher.shutdown(); + } +} diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQRequeueQpidTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQRequeueQpidTest.java new file mode 100644 index 0000000..871d15f --- /dev/null +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQRequeueQpidTest.java @@ -0,0 +1,49 @@ +/** + * 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.rabbitmq.qpid; + +import org.apache.camel.component.rabbitmq.RabbitMQRequeueIntTest; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; + +public class RabbitMQRequeueQpidTest extends RabbitMQRequeueIntTest { + @BeforeClass + public static void startBroker() throws Exception { + systemLauncher.startup(createQpidSystemConfig()); + } + + @AfterClass + public static void stopBroker() { + systemLauncher.shutdown(); + } + + @Ignore + @Override + public void testNoRequeueHeaderCausesReject() throws Exception { + } + + @Ignore + @Override + public void testNonBooleanRequeueHeaderCausesReject() throws Exception { + } + + @Ignore + @Override + public void testFalseRequeueHeaderCausesReject() throws Exception { + } +} diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQRequeueUnhandledExceptionQpidTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQRequeueUnhandledExceptionQpidTest.java new file mode 100644 index 0000000..6be8423 --- /dev/null +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQRequeueUnhandledExceptionQpidTest.java @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.rabbitmq.qpid; + +import org.apache.camel.component.rabbitmq.RabbitMQRequeueUnhandledExceptionIntTest; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +public class RabbitMQRequeueUnhandledExceptionQpidTest extends RabbitMQRequeueUnhandledExceptionIntTest { + @BeforeClass + public static void startBroker() throws Exception { + systemLauncher.startup(createQpidSystemConfig()); + } + + @AfterClass + public static void stopBroker() { + systemLauncher.shutdown(); + } +} diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQSupendResumeQpidTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQSupendResumeQpidTest.java new file mode 100644 index 0000000..ff3da87 --- /dev/null +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/qpid/RabbitMQSupendResumeQpidTest.java @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.rabbitmq.qpid; + +import org.apache.camel.component.rabbitmq.RabbitMQSupendResumeIntTest; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +public class RabbitMQSupendResumeQpidTest extends RabbitMQSupendResumeIntTest { + @BeforeClass + public static void startBroker() throws Exception { + systemLauncher.startup(createQpidSystemConfig()); + } + + @AfterClass + public static void stopBroker() { + systemLauncher.shutdown(); + } +} \ No newline at end of file diff --git a/components/camel-rabbitmq/src/test/resources/README.md b/components/camel-rabbitmq/src/test/resources/README.md new file mode 100644 index 0000000..89f3d1b --- /dev/null +++ b/components/camel-rabbitmq/src/test/resources/README.md @@ -0,0 +1,5 @@ +How to configure RabbitMQ server for integration tests +----------------------- +rabbitmq-server +rabbitmqctl add_user cameltest cameltest +rabbitmqctl set_permissions -p / cameltest ".*" ".*" ".*" \ No newline at end of file diff --git a/components/camel-rabbitmq/src/test/resources/org/apache/camel/component/rabbitmq/RabbitMQSpringIntTest-context.xml b/components/camel-rabbitmq/src/test/resources/org/apache/camel/component/rabbitmq/RabbitMQSpringIntTest-context.xml index 8c12207..51a80de 100644 --- a/components/camel-rabbitmq/src/test/resources/org/apache/camel/component/rabbitmq/RabbitMQSpringIntTest-context.xml +++ b/components/camel-rabbitmq/src/test/resources/org/apache/camel/component/rabbitmq/RabbitMQSpringIntTest-context.xml @@ -18,28 +18,19 @@ --> <beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - 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 - "> - <!-- To create and grant user cameltest: - rabbitmqctl add_user cameltest cameltest - rabbitmqctl set_permissions -p / cameltest ".*" ".*" ".*" - --> - <!-- START SNIPPET: custom connection factory --> - <bean id="customConnectionFactory" class="com.rabbitmq.client.ConnectionFactory"> - <property name="host" value="localhost"/> - <property name="port" value="5672"/> - <property name="username" value="cameltest"/> - <property name="password" value="cameltest"/> - </bean> - - <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:rabbitMQ"/> - <to uri="rabbitmq://localhost:5672/ex2?connectionFactory=#customConnectionFactory&queue=q2&routingKey=rk2"/> - </route> - </camelContext> - <!-- END SNIPPET: example --> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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 "> + <!-- START SNIPPET: custom connection factory --> + <bean class="com.rabbitmq.client.ConnectionFactory" id="customConnectionFactory"> + <property name="host" value="localhost"/> + <property name="port" value="5672"/> + <property name="username" value="cameltest"/> + <property name="password" value="cameltest"/> + </bean> + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <route id="_route1"> + <from id="_from1" uri="direct:rabbitMQ"/> + <to id="_to1" uri="rabbitmq://localhost:5672/ex2?connectionFactory=#customConnectionFactory&queue=q2&routingKey=rk2"/> + </route> + </camelContext> + <!-- END SNIPPET: example --> </beans> diff --git a/components/camel-rabbitmq/src/test/resources/qpid-test-initial-config.json b/components/camel-rabbitmq/src/test/resources/qpid-test-initial-config.json new file mode 100644 index 0000000..d05aa21 --- /dev/null +++ b/components/camel-rabbitmq/src/test/resources/qpid-test-initial-config.json @@ -0,0 +1,67 @@ +{ + "name": "Embedded Broker", + "modelVersion": "7.0", + "accesscontrolproviders": [ + { + "name": "myprovider", + "type": "AclFile", + "path": "src/test/resources/qpid-test.acl" + } + ], + "authenticationproviders": [ + { + "name": "plain", + "type": "Plain", + "users": [ + { + "name": "admin", + "type": "managed", + "password": "admin" + }, + { + "name": "cameltest", + "type": "managed", + "password": "cameltest" + }, + { + "name": "guest", + "type": "managed", + "password": "guest" + } + ], + "secureOnlyMechanisms": [] + } + ], + "ports": [ + { + "name": "AMQP", + "port": "${qpid.amqp_port}", + "protocols": [ + "AMQP_0_9_1" + ], + "authenticationProvider": "plain", + "virtualhostaliases": [ + { + "name": "nameAlias", + "type": "nameAlias" + }, + { + "name": "defaultAlias", + "type": "defaultAlias" + }, + { + "name": "hostnameAlias", + "type": "hostnameAlias" + } + ] + } + ], + "virtualhostnodes": [ + { + "name": "default", + "type": "Memory", + "defaultVirtualHostNode": "true", + "virtualHostInitialConfiguration": "{\"type\" : \"Memory\",\"name\" : \"default\",\"modelVersion\" : \"7.0\"}" + } + ] +} \ No newline at end of file diff --git a/components/camel-rabbitmq/src/test/resources/qpid-test-with-management.json b/components/camel-rabbitmq/src/test/resources/qpid-test-with-management.json new file mode 100644 index 0000000..64947ec --- /dev/null +++ b/components/camel-rabbitmq/src/test/resources/qpid-test-with-management.json @@ -0,0 +1,81 @@ +{ + "name": "Embedded Broker", + "modelVersion": "7.0", + "accesscontrolproviders": [ + { + "name": "myprovider", + "type": "AclFile", + "path": "src/test/resources/qpid-test.acl" + } + ], + "authenticationproviders": [ + { + "name": "plain", + "type": "Plain", + "users": [ + { + "name": "admin", + "type": "managed", + "password": "admin" + }, + { + "name": "cameltest", + "type": "managed", + "password": "cameltest" + }, + { + "name": "guest", + "type": "managed", + "password": "guest" + } + ], + "secureOnlyMechanisms": [] + } + ], + "plugins": [ + { + "type": "MANAGEMENT-HTTP", + "name": "httpManagement" + } + ], + "ports": [ + { + "name": "AMQP", + "port": "${qpid.amqp_port}", + "protocols": [ + "AMQP_0_9_1" + ], + "authenticationProvider": "plain", + "virtualhostaliases": [ + { + "name": "nameAlias", + "type": "nameAlias" + }, + { + "name": "defaultAlias", + "type": "defaultAlias" + }, + { + "name": "hostnameAlias", + "type": "hostnameAlias" + } + ] + }, + { + "name": "HTTP", + "port": "${qpid.http_port}", + "authenticationProvider": "plain", + "protocols": [ + "HTTP" + ] + } + ], + "virtualhostnodes": [ + { + "name": "default", + "type": "Memory", + "defaultVirtualHostNode": "true", + "virtualHostInitialConfiguration": "{\"type\" : \"Memory\",\"name\" : \"default\",\"modelVersion\" : \"7.0\"}" + } + ] +} \ No newline at end of file diff --git a/components/camel-rabbitmq/src/test/resources/qpid-test.acl b/components/camel-rabbitmq/src/test/resources/qpid-test.acl new file mode 100644 index 0000000..ac5da03 --- /dev/null +++ b/components/camel-rabbitmq/src/test/resources/qpid-test.acl @@ -0,0 +1,6 @@ +ACL ALLOW ALL CREATE QUEUE +ACL ALLOW ALL CREATE EXCHANGE +ACL ALLOW ALL BIND EXCHANGE +ACL ALLOW ALL CONSUME QUEUE +ACL ALLOW ALL PUBLISH EXCHANGE +ACL ALLOW ALL ACCESS VIRTUALHOST from_hostname=localhost \ No newline at end of file diff --git a/parent/pom.xml b/parent/pom.xml index b615c87..ae44aa5 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -568,6 +568,7 @@ <protobuf-maven-plugin-version>0.5.1</protobuf-maven-plugin-version> <protonpack-version>1.8</protonpack-version> <pubnub-version>4.18.0</pubnub-version> + <qpid-broker-version>7.0.1</qpid-broker-version> <qpid-bundle-version>0.28_1</qpid-bundle-version> <qpid-proton-j-version>0.25.0</qpid-proton-j-version> <qpid-jms-client-version>0.29.0</qpid-jms-client-version> -- To stop receiving notification emails like this one, please contact acosent...@apache.org.