activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1414727 - /activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/InvokeRequestReplyUsingJmsReplyToHeaderTest.java
Date Wed, 28 Nov 2012 14:33:20 GMT
Author: davsclaus
Date: Wed Nov 28 14:33:19 2012
New Revision: 1414727

URL: http://svn.apache.org/viewvc?rev=1414727&view=rev
Log:
Fixed test that was wrong

Modified:
    activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/InvokeRequestReplyUsingJmsReplyToHeaderTest.java

Modified: activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/InvokeRequestReplyUsingJmsReplyToHeaderTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/InvokeRequestReplyUsingJmsReplyToHeaderTest.java?rev=1414727&r1=1414726&r2=1414727&view=diff
==============================================================================
--- activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/InvokeRequestReplyUsingJmsReplyToHeaderTest.java
(original)
+++ activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/InvokeRequestReplyUsingJmsReplyToHeaderTest.java
Wed Nov 28 14:33:19 2012
@@ -16,15 +16,8 @@
  */
 package org.apache.activemq.camel.component;
 
-import static org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.hasEntry;
-import static org.hamcrest.Matchers.hasKey;
-
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
-
 import javax.jms.Destination;
 
 import org.apache.camel.CamelContext;
@@ -33,13 +26,15 @@ import org.apache.camel.Headers;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.AssertionClause;
-import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent;
+import static org.hamcrest.Matchers.hasEntry;
+import static org.hamcrest.Matchers.hasKey;
+
 /**
  * 
  */
@@ -52,28 +47,13 @@ public class InvokeRequestReplyUsingJmsR
 
     @Test
     public void testPerformRequestReplyOverJms() throws Exception {
-        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
-
-        resultEndpoint.expectedBodiesReceived("Hello James");
-        AssertionClause firstMessage = resultEndpoint.message(0);
-        firstMessage.header("JMSCorrelationID").isEqualTo(correlationID);
-/*
-        TODO - allow JMS headers to be copied?
-
-        firstMessage.header("cheese").isEqualTo(123);
-        firstMessage.header("JMSXGroupID").isEqualTo(groupID);
-        firstMessage.header("JMSReplyTo").isEqualTo(ActiveMQConverter.toDestination(replyQueueName));
-*/
-        
         Map<String, Object> headers = new HashMap<String, Object>();
         headers.put("cheese", 123);
         headers.put("JMSReplyTo", replyQueueName);
         headers.put("JMSCorrelationID", correlationID);
         headers.put("JMSXGroupID", groupID);
-        
-        
-        // Camel 2.0 ignores JMSReplyTo, so we're using replyTo MEP property
-        template.request("activemq:test.server?replyTo=queue:test.reply", new Processor()
{
+
+        Exchange reply = template.request("activemq:test.server?replyTo=queue:test.reply",
new Processor() {
             public void process(Exchange exchange) {
                 exchange.getIn().setBody("James");
                 Map<String, Object> headers = new HashMap<String, Object>();
@@ -85,29 +65,15 @@ public class InvokeRequestReplyUsingJmsR
             }
         });
 
-        resultEndpoint.assertIsSatisfied();
-
-        List<Exchange> list = resultEndpoint.getReceivedExchanges();
-        Exchange exchange = list.get(0);
-        Message in = exchange.getIn();
+        Message in = reply.getIn();
         Object replyTo = in.getHeader("JMSReplyTo");
         LOG.info("Reply to is: " + replyTo);
-
         LOG.info("Received headers: " + in.getHeaders());
         LOG.info("Received body: " + in.getBody());
 
         assertMessageHeader(in, "JMSCorrelationID", correlationID);
 
-        /*
-        TODO
-        Destination destination = assertIsInstanceOf(Destination.class, replyTo);
-        assertEquals("ReplyTo", replyQueueName, destination.toString());
-        assertMessageHeader(in, "cheese", 123);
-        assertMessageHeader(in, "JMSXGroupID", groupID);
-        */
-
         Map<String,Object> receivedHeaders = myBean.getHeaders();
-
         assertThat(receivedHeaders, hasKey("JMSReplyTo"));
         assertThat(receivedHeaders, hasEntry("JMSXGroupID", groupID));
         assertThat(receivedHeaders, hasEntry("JMSCorrelationID", correlationID));
@@ -116,8 +82,6 @@ public class InvokeRequestReplyUsingJmsR
         LOG.info("Reply to is: " + replyTo);
         Destination destination = assertIsInstanceOf(Destination.class, replyTo);
         assertEquals("ReplyTo", replyQueueName, destination.toString());
-
-        
     }
 
     protected CamelContext createCamelContext() throws Exception {
@@ -134,8 +98,6 @@ public class InvokeRequestReplyUsingJmsR
         return new RouteBuilder() {
             public void configure() throws Exception {
                 from("activemq:test.server").bean(myBean);
-
-                from("activemq:test.reply").to("mock:result");
             }
         };
     }



Mime
View raw message