camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r949960 - in /camel/trunk: camel-core/src/test/java/org/apache/camel/util/ components/camel-jms/src/test/java/org/apache/camel/component/jms/ components/camel-jms/src/test/resources/org/apache/camel/component/jms/
Date Tue, 01 Jun 2010 08:01:52 GMT
Author: davsclaus
Date: Tue Jun  1 08:01:52 2010
New Revision: 949960

URL: http://svn.apache.org/viewvc?rev=949960&view=rev
Log:
CAMEL-2770: Added unit tests about JMS selector using equals sign in endpoint uri.

Added:
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/SpringJmsSelectorTest.java
      - copied, changed from r949958, camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java
    camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/SpringJmsSelectorTest.xml
      - copied, changed from r949958, camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml
Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java?rev=949960&r1=949959&r2=949960&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java Tue Jun
 1 08:01:52 2010
@@ -105,4 +105,11 @@ public class URISupportTest extends Cont
         assertEquals("http://camel.apache.org?foo=123", s);
     }
 
+    public void testNormalizeEndpointWithEqualSignInParameter() throws Exception {
+        String out = URISupport.normalizeUri("jms:queue:foo?selector=somekey='somevalue'&foo=bar");
+        assertNotNull(out);
+        // Camel will safe encode the URI
+        assertEquals("jms://queue:foo?foo=bar&selector=somekey%3D%27somevalue%27", out);
+    }
+
 }

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java?rev=949960&r1=949959&r2=949960&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java
Tue Jun  1 08:01:52 2010
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.jms;
 
-
 import javax.jms.ConnectionFactory;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
@@ -28,18 +27,17 @@ import org.junit.Test;
 
 import static org.apache.camel.component.jms.JmsComponent.jmsComponentTransacted;
 
-
 /**
  * @version $Revision$
  */
 public class JmsSelectorTest extends CamelTestSupport {
+
     @Test
-    public void testJmsRouteWithTextMessage() throws Exception {
+    public void testJmsSelector() throws Exception {
         MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
         String expectedBody = "Hello there!";
         String expectedBody2 = "Goodbye!";
 
-
         resultEndpoint.expectedBodiesReceived(expectedBody2);
         resultEndpoint.message(0).header("cheese").isEqualTo("y");
 

Copied: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/SpringJmsSelectorTest.java
(from r949958, camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/SpringJmsSelectorTest.java?p2=camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/SpringJmsSelectorTest.java&p1=camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java&r1=949958&r2=949960&rev=949960&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/SpringJmsSelectorTest.java
Tue Jun  1 08:01:52 2010
@@ -16,30 +16,23 @@
  */
 package org.apache.camel.component.jms;
 
-
-import javax.jms.ConnectionFactory;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
 import org.junit.Test;
-
-import static org.apache.camel.component.jms.JmsComponent.jmsComponentTransacted;
-
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**
  * @version $Revision$
  */
-public class JmsSelectorTest extends CamelTestSupport {
+public class SpringJmsSelectorTest extends CamelSpringTestSupport {
+
     @Test
-    public void testJmsRouteWithTextMessage() throws Exception {
+    public void testJmsSelector() throws Exception {
         MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
         String expectedBody = "Hello there!";
         String expectedBody2 = "Goodbye!";
 
-
         resultEndpoint.expectedBodiesReceived(expectedBody2);
         resultEndpoint.message(0).header("cheese").isEqualTo("y");
 
@@ -49,21 +42,9 @@ public class JmsSelectorTest extends Cam
         resultEndpoint.assertIsSatisfied();
     }
 
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-
-        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false&broker.useJmx=false");
-        JmsComponent component = jmsComponentTransacted(connectionFactory);
-        camelContext.addComponent("activemq", component);
-        return camelContext;
+    @Override
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/SpringJmsSelectorTest.xml");
     }
 
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() throws Exception {
-                from("activemq:test.a").to("activemq:test.b");
-                from("activemq:test.b?selector=cheese='y'").to("mock:result");
-            }
-        };
-    }
 }
\ No newline at end of file

Copied: camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/SpringJmsSelectorTest.xml
(from r949958, camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/SpringJmsSelectorTest.xml?p2=camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/SpringJmsSelectorTest.xml&p1=camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml&r1=949958&r2=949960&rev=949960&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml
(original)
+++ camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/SpringJmsSelectorTest.xml
Tue Jun  1 08:01:52 2010
@@ -22,17 +22,23 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <!-- START SNIPPET: example -->
-  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-  </camelContext>
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="activemq:test.a"/>
+            <to uri="activemq:test.b"/>
+        </route>
+        <route>
+            <from uri="activemq:test.b?selector=cheese='y'"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
 
-  <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
-    <property name="connectionFactory">
-      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
-        <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
-      </bean>
-    </property>
-  </bean>
-  <!-- END SNIPPET: example -->
+    <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
+        <property name="connectionFactory">
+            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+                <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
+            </bean>
+        </property>
+    </bean>
 
 </beans>



Mime
View raw message