You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2012/07/27 20:37:47 UTC

svn commit: r1366483 - in /camel/trunk/components/camel-jms/src/test: java/org/apache/camel/component/jms/activemq/ resources/org/apache/camel/component/jms/activemq/

Author: bvahdat
Date: Fri Jul 27 18:37:47 2012
New Revision: 1366483

URL: http://svn.apache.org/viewvc?rev=1366483&view=rev
Log:
Added test based on user forum issue.

Added:
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/activemq/TwoEmbeddedActiveMQBrokersTest.java   (with props)
    camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/
    camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/brokers.xml   (with props)
    camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/camelBrokersClient.xml   (with props)

Added: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/activemq/TwoEmbeddedActiveMQBrokersTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/activemq/TwoEmbeddedActiveMQBrokersTest.java?rev=1366483&view=auto
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/activemq/TwoEmbeddedActiveMQBrokersTest.java (added)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/activemq/TwoEmbeddedActiveMQBrokersTest.java Fri Jul 27 18:37:47 2012
@@ -0,0 +1,45 @@
+/**
+ * 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.activemq;
+
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ *
+ */
+public class TwoEmbeddedActiveMQBrokersTest extends CamelSpringTestSupport {
+
+    @Test
+    public void testSendToTwoEmbeddedBrokers() throws Exception {
+        getMockEndpoint("mock:foo").expectedMessageCount(1);
+        getMockEndpoint("mock:bar").expectedMessageCount(1);
+
+        template.sendBody("activemq1:queue:foo", "foo");
+        template.sendBody("activemq2:queue:bar", "bar");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext(new String[] {"classpath:org/apache/camel/component/jms/activemq/brokers.xml",
+                                                                "classpath:org/apache/camel/component/jms/activemq/camelBrokersClient.xml"});
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/activemq/TwoEmbeddedActiveMQBrokersTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/brokers.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/brokers.xml?rev=1366483&view=auto
==============================================================================
--- camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/brokers.xml (added)
+++ camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/brokers.xml Fri Jul 27 18:37:47 2012
@@ -0,0 +1,33 @@
+<?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:amq="http://activemq.apache.org/schema/core" 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://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+
+   <amq:broker brokerName="myBroker" id="broker" useJmx="false" persistent="false" start="true">
+      <amq:transportConnectors>
+         <amq:transportConnector uri="vm://localhost:61617" />
+      </amq:transportConnectors>
+   </amq:broker>
+
+   <amq:broker brokerName="myBroker2" id="broker2" useJmx="false" persistent="false" start="true">
+      <amq:transportConnectors>
+         <amq:transportConnector uri="vm://0.0.0.0:61618" />
+      </amq:transportConnectors>
+   </amq:broker>
+</beans>

Propchange: camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/brokers.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/camelBrokersClient.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/camelBrokersClient.xml?rev=1366483&view=auto
==============================================================================
--- camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/camelBrokersClient.xml (added)
+++ camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/camelBrokersClient.xml Fri Jul 27 18:37:47 2012
@@ -0,0 +1,45 @@
+<?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"
+   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">
+
+   <camelContext xmlns="http://camel.apache.org/schema/spring">
+      <jmxAgent id="agent" disabled="true" />
+
+      <route>
+         <from uri="activemq1:queue:foo" />
+         <to uri="mock:foo" />
+      </route>
+
+      <route>
+         <from uri="activemq2:queue:bar" />
+         <to uri="mock:bar" />
+      </route>
+
+   </camelContext>
+
+   <bean id="activemq1" class="org.apache.activemq.camel.component.ActiveMQComponent">
+      <property name="brokerURL" value="vm://myBroker" />
+   </bean>
+
+   <bean id="activemq2" class="org.apache.activemq.camel.component.ActiveMQComponent">
+      <property name="brokerURL" value="vm://myBroker2" />
+   </bean>
+
+</beans>

Propchange: camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/activemq/camelBrokersClient.xml
------------------------------------------------------------------------------
    svn:eol-style = native