Author: bvahdat
Date: Tue Apr 30 22:26:49 2013
New Revision: 1477859

URL: http://svn.apache.org/r1477859
Log:
Merged revisions 1477857 via svnmerge from 
https://svn.apache.org/repos/asf/camel/branches/camel-2.11.x

................
  r1477857 | bvahdat | 2013-05-01 00:22:24 +0200 (Mi, 01 Mai 2013) | 9 lines
  
  Merged revisions 1477851 via svnmerge from 
  https://svn.apache.org/repos/asf/camel/trunk
  
  ........
    r1477851 | bvahdat | 2013-05-01 00:01:34 +0200 (Mi, 01 Mai 2013) | 1 line
    
    CAMEL-5880: QuickfixjEndpoint should adhere the InOut MEP if you would ask 
for it. Thanks to Steve Bates for the patch. Fixed CS and omitted part of the 
provided patch.
  ........
................

Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/components/camel-http/   (props changed)
    camel/branches/camel-2.10.x/components/camel-jms/   (props changed)
    camel/branches/camel-2.10.x/components/camel-quickfix/pom.xml
    
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/MessagePredicate.java
    
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEndpoint.java
    
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/converter/QuickfixjConverters.java
    
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java
    
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java
    
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RequestReplyExample.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1477851
  Merged /camel/branches/camel-2.11.x:r1477857

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Propchange: camel/branches/camel-2.10.x/components/camel-http/
------------------------------------------------------------------------------
  Merged /camel/branches/camel-2.11.x/components/camel-http:r1477857

Propchange: camel/branches/camel-2.10.x/components/camel-jms/
------------------------------------------------------------------------------
  Merged /camel/branches/camel-2.11.x/components/camel-jms:r1477857

Modified: camel/branches/camel-2.10.x/components/camel-quickfix/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/pom.xml?rev=1477859&r1=1477858&r2=1477859&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-quickfix/pom.xml (original)
+++ camel/branches/camel-2.10.x/components/camel-quickfix/pom.xml Tue Apr 30 
22:26:49 2013
@@ -78,4 +78,21 @@
     </dependency>
 
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <!--
+              TODO: should fork always as otherwise running tests would cause 
'java.lang.OutOfMemoryError: PermGen space'.
+              interestingly there's a quick & dirty solution for this which 
would be to remove the <filter> tag inside the
+              test resource QuickfixjSpringTest-context.xml then the build 
would run perfectly without a need to fork always!
+          -->
+          <forkMode>always</forkMode>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>

Modified: 
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/MessagePredicate.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/MessagePredicate.java?rev=1477859&r1=1477858&r2=1477859&view=diff
==============================================================================
--- 
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/MessagePredicate.java
 (original)
+++ 
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/MessagePredicate.java
 Tue Apr 30 22:26:49 2013
@@ -35,10 +35,9 @@ public class MessagePredicate {
     private final List<Field<String>> bodyCriteria = new 
ArrayList<Field<String>>();
     
     public MessagePredicate(SessionID requestingSessionID, String msgType) {
-        // Reverse session ID for reply
         // TODO may need to optionally include subID and locationID
-        addHeaderFieldIfPresent(SenderCompID.FIELD, 
requestingSessionID.getTargetCompID());
-        addHeaderFieldIfPresent(TargetCompID.FIELD, 
requestingSessionID.getSenderCompID());
+        addHeaderFieldIfPresent(SenderCompID.FIELD, 
requestingSessionID.getSenderCompID());
+        addHeaderFieldIfPresent(TargetCompID.FIELD, 
requestingSessionID.getTargetCompID());
         withMessageType(msgType);
     }
     

Modified: 
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEndpoint.java?rev=1477859&r1=1477858&r2=1477859&view=diff
==============================================================================
--- 
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEndpoint.java
 (original)
+++ 
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEndpoint.java
 Tue Apr 30 22:26:49 2013
@@ -87,7 +87,7 @@ public class QuickfixjEndpoint extends D
     public void onEvent(QuickfixjEventCategory eventCategory, SessionID 
sessionID, Message message) throws Exception {
         if (this.sessionID == null || isMatching(sessionID)) {
             for (QuickfixjConsumer consumer : consumers) {
-                Exchange exchange = QuickfixjConverters.toExchange(this, 
sessionID, message, eventCategory);
+                Exchange exchange = QuickfixjConverters.toExchange(this, 
sessionID, message, eventCategory, getExchangePattern());
                 consumer.onExchange(exchange);
                 if (exchange.getException() != null) {
                     throw exchange.getException();

Modified: 
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/converter/QuickfixjConverters.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/converter/QuickfixjConverters.java?rev=1477859&r1=1477858&r2=1477859&view=diff
==============================================================================
--- 
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/converter/QuickfixjConverters.java
 (original)
+++ 
camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/converter/QuickfixjConverters.java
 Tue Apr 30 22:26:49 2013
@@ -117,7 +117,11 @@ public final class QuickfixjConverters {
     }
 
     public static Exchange toExchange(Endpoint endpoint, SessionID sessionID, 
Message message, QuickfixjEventCategory eventCategory) {
-        Exchange exchange = endpoint.createExchange(ExchangePattern.InOnly);
+        return toExchange(endpoint, sessionID, message, eventCategory, 
ExchangePattern.InOnly);
+    }
+
+    public static Exchange toExchange(Endpoint endpoint, SessionID sessionID, 
Message message, QuickfixjEventCategory eventCategory, ExchangePattern 
exchangePattern) {
+        Exchange exchange = endpoint.createExchange(exchangePattern);
 
         org.apache.camel.Message camelMessage = exchange.getIn();
         camelMessage.setHeader(EVENT_CATEGORY_KEY, eventCategory);

Modified: 
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java?rev=1477859&r1=1477858&r2=1477859&view=diff
==============================================================================
--- 
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java
 (original)
+++ 
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java
 Tue Apr 30 22:26:49 2013
@@ -104,6 +104,7 @@ public class QuickfixjConsumerTest {
         Mockito.doReturn(null).when(consumer).getSession(mockSessionId);
 
         
Mockito.when(mockExchange.getPattern()).thenReturn(ExchangePattern.InOut);
+        Mockito.when(mockExchange.copy()).thenReturn(mockExchange);
         Mockito.when(mockExchange.hasOut()).thenReturn(true);
         Mockito.when(mockExchange.getOut()).thenReturn(mockCamelOutMessage);
         Message outboundFixMessage = new Message();
@@ -131,6 +132,7 @@ public class QuickfixjConsumerTest {
         
Mockito.doReturn(true).when(mockSession).send(Mockito.isA(Message.class));
 
         
Mockito.when(mockExchange.getPattern()).thenReturn(ExchangePattern.InOut);
+        Mockito.when(mockExchange.copy()).thenReturn(mockExchange);
         Mockito.when(mockExchange.hasOut()).thenReturn(true);
         Mockito.when(mockExchange.getOut()).thenReturn(mockCamelOutMessage);
         Message outboundFixMessage = new Message();

Modified: 
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java?rev=1477859&r1=1477858&r2=1477859&view=diff
==============================================================================
--- 
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java
 (original)
+++ 
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java
 Tue Apr 30 22:26:49 2013
@@ -115,9 +115,11 @@ public class QuickfixjProducerTest {
 
     @Test
     public void processInOutExchangeSuccess() throws Exception {
+        Mockito.when(mockExchange.copy()).thenReturn(mockExchange);
         
Mockito.when(mockExchange.getPattern()).thenReturn(ExchangePattern.InOut);
+        SessionID responseSessionID = new 
SessionID(sessionID.getBeginString(), sessionID.getTargetCompID(), 
sessionID.getSenderCompID());
         
Mockito.when(mockExchange.getProperty(QuickfixjProducer.CORRELATION_CRITERIA_KEY)).thenReturn(
-            new MessagePredicate(sessionID, MsgType.EMAIL));
+            new MessagePredicate(responseSessionID, MsgType.EMAIL));
         Mockito.when(mockExchange.getProperty(
             QuickfixjProducer.CORRELATION_TIMEOUT_KEY,
             1000L, Long.class)).thenReturn(5000L);

Modified: 
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RequestReplyExample.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RequestReplyExample.java?rev=1477859&r1=1477858&r2=1477859&view=diff
==============================================================================
--- 
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RequestReplyExample.java
 (original)
+++ 
camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RequestReplyExample.java
 Tue Apr 30 22:26:49 2013
@@ -118,7 +118,7 @@ public class RequestReplyExample {
                 sb.append('\n');
                 line = orderStatusReply.readLine();
             }
-            LOG.info("Web request:\n" + sb);
+            LOG.info("Web reply:\n" + sb);
         }
         orderStatusReply.close();
         
@@ -146,7 +146,7 @@ public class RequestReplyExample {
             // and having the requested OrderID. This is a loose correlation 
but the best
             // we can do with FIX 4.2. Newer versions of FIX have an optional 
explicit correlation field.
             exchange.setProperty(QuickfixjProducer.CORRELATION_CRITERIA_KEY, 
new MessagePredicate(
-                new SessionID(replySessionID), 
MsgType.ORDER_STATUS_REQUEST).withField(OrderID.FIELD, 
request.getString(OrderID.FIELD)));
+                new SessionID(replySessionID), 
MsgType.EXECUTION_REPORT).withField(OrderID.FIELD, 
request.getString(OrderID.FIELD)));
             
             exchange.getIn().setBody(request);
         }


Reply via email to