camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r581035 - in /activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms: JmsEndpointConfigurationTest.java JmsSelectorTest.java
Date Mon, 01 Oct 2007 18:42:39 GMT
Author: jstrachan
Date: Mon Oct  1 11:42:38 2007
New Revision: 581035

URL: http://svn.apache.org/viewvc?rev=581035&view=rev
Log:
added some selector based JMS tests

Added:
    activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java
      - copied, changed from r580933, activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTransactedRouteTest.java
Modified:
    activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java

Modified: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java?rev=581035&r1=581034&r2=581035&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
(original)
+++ activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
Mon Oct  1 11:42:38 2007
@@ -23,16 +23,13 @@
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-
-import org.springframework.jms.listener.AbstractMessageListenerContainer;
-
 import static org.apache.camel.component.jms.JmsComponent.jmsComponentClientAcknowledge;
+import org.springframework.jms.listener.AbstractMessageListenerContainer;
 
 /**
  * @version $Revision: $
  */
 public class JmsEndpointConfigurationTest extends ContextTestSupport {
-
     public void testDurableSubscriberConfiguredWithDoubleSlash() throws Exception {
         JmsEndpoint endpoint = (JmsEndpoint) resolveMandatoryEndpoint("jms://topic:Foo.Bar?durableSubscriptionName=James&clientId=ABC");
         assertDurableSubscriberEndpointIsValid(endpoint);
@@ -41,6 +38,17 @@
     public void testDurableSubscriberConfiguredWithNoSlashes() throws Exception {
         JmsEndpoint endpoint = (JmsEndpoint) resolveMandatoryEndpoint("jms:topic:Foo.Bar?durableSubscriptionName=James&clientId=ABC");
         assertDurableSubscriberEndpointIsValid(endpoint);
+    }
+
+    public void testSelector() throws Exception {
+        JmsEndpoint endpoint = (JmsEndpoint) resolveMandatoryEndpoint("jms:Foo.Bar?selector=foo%3D'ABC'");
+        JmsConsumer consumer = endpoint.createConsumer(new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                log.info("Received: " + exchange);
+            }
+        });
+        AbstractMessageListenerContainer container = consumer.getListenerContainer();
+        assertEquals("selector", "foo='ABC'", container.getMessageSelector());
     }
 
     protected void assertDurableSubscriberEndpointIsValid(JmsEndpoint endpoint) throws Exception
{

Copied: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java
(from r580933, activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTransactedRouteTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java?p2=activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java&p1=activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTransactedRouteTest.java&r1=580933&r2=581035&rev=581035&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTransactedRouteTest.java
(original)
+++ activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java
Mon Oct  1 11:42:38 2007
@@ -29,18 +29,18 @@
 /**
  * @version $Revision$
  */
-public class JmsTransactedRouteTest extends ContextTestSupport {
+public class JmsSelectorTest extends ContextTestSupport {
     public void testJmsRouteWithTextMessage() throws Exception {
         MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
         String expectedBody = "Hello there!";
         String expectedBody2 = "Goodbye!";
 
 
-        resultEndpoint.expectedBodiesReceived(expectedBody, expectedBody2);
-        resultEndpoint.message(0).header("cheese").isEqualTo(123);
+        resultEndpoint.expectedBodiesReceived(expectedBody2);
+        resultEndpoint.message(0).header("cheese").isEqualTo("y");
 
-        template.sendBodyAndHeader("activemq:test.a", expectedBody, "cheese", 123);
-        template.sendBodyAndHeader("activemq:test.a", expectedBody2, "cheese", 124);
+        template.sendBodyAndHeader("activemq:test.a", expectedBody, "cheese", "x");
+        template.sendBodyAndHeader("activemq:test.a", expectedBody2, "cheese", "y");
 
         resultEndpoint.assertIsSatisfied();
     }
@@ -50,8 +50,6 @@
 
         ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false&broker.useJmx=false");
         JmsComponent component = jmsComponentTransacted(connectionFactory);
-        //component.getConfiguration().setCacheLevelName("CACHE_CONNECTION");
-        //component.getConfiguration().setCacheLevel(DefaultMessageListenerContainer.CACHE_CONNECTION);
         camelContext.addComponent("activemq", component);
         return camelContext;
     }
@@ -60,7 +58,7 @@
         return new RouteBuilder() {
             public void configure() throws Exception {
                 from("activemq:test.a").to("activemq:test.b");
-                from("activemq:test.b").to("mock:result");
+                from("activemq:test.b?selector=cheese%3D'y'").to("mock:result");
             }
         };
     }



Mime
View raw message