You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/11/29 07:22:58 UTC

svn commit: r1040021 - in /camel/trunk/components/camel-quickfix: ./ src/main/java/org/apache/camel/component/quickfixj/ src/test/java/org/apache/camel/component/quickfixj/ src/test/resources/examples/ src/test/resources/org/ src/test/resources/org/apa...

Author: davsclaus
Date: Mon Nov 29 06:22:57 2010
New Revision: 1040021

URL: http://svn.apache.org/viewvc?rev=1040021&view=rev
Log:
CAMEL-3374: Added support for quickfix settings in spring XML. Thanks to Steve Bate for patch.

Added:
    camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactory.java
    camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactoryTest.java
    camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSpringTest.java
    camel/trunk/components/camel-quickfix/src/test/resources/org/
    camel/trunk/components/camel-quickfix/src/test/resources/org/apache/
    camel/trunk/components/camel-quickfix/src/test/resources/org/apache/camel/
    camel/trunk/components/camel-quickfix/src/test/resources/org/apache/camel/component/
    camel/trunk/components/camel-quickfix/src/test/resources/org/apache/camel/component/quickfixj/
    camel/trunk/components/camel-quickfix/src/test/resources/org/apache/camel/component/quickfixj/QuickfixjSpringTest-context.xml
Modified:
    camel/trunk/components/camel-quickfix/pom.xml
    camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
    camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
    camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java
    camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java
    camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
    camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java
    camel/trunk/components/camel-quickfix/src/test/resources/examples/gateway.cfg
    camel/trunk/components/camel-quickfix/src/test/resources/examples/inprocess.cfg

Modified: camel/trunk/components/camel-quickfix/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/pom.xml?rev=1040021&r1=1040020&r2=1040021&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/pom.xml (original)
+++ camel/trunk/components/camel-quickfix/pom.xml Mon Nov 29 06:22:57 2010
@@ -32,14 +32,12 @@
 	<description>Camel QuickFIX/J support</description>
 
 	<properties>
-		<camel.osgi.export.pkg>
-			org.apache.camel.component.quickfixj.*
-        </camel.osgi.export.pkg>
+		<camel.osgi.export.pkg>org.apache.camel.component.quickfixj.*</camel.osgi.export.pkg>
 	</properties>
 
     <repositories>
         <repository>
-            <id>open.iona.m2-all</id>
+            <id>fusesource.m2</id>
             <name>Fusesource Dependency Repository</name>
             <url>http://repo.fusesource.com/maven2-all</url>
         </repository>
@@ -53,7 +51,6 @@
 		<dependency>
 			<groupId>org.apache.camel</groupId>
 			<artifactId>camel-spring</artifactId>
-			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.quickfixj</groupId>
@@ -64,20 +61,22 @@
 			<groupId>org.apache.mina</groupId>
 			<artifactId>mina-core</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>commons-logging</groupId>
-			<artifactId>commons-logging</artifactId>
-		</dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+
 		<dependency>
 			<groupId>org.slf4j</groupId>
 			<artifactId>slf4j-log4j12</artifactId>
 			<scope>test</scope>
 		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-api</artifactId>
-		</dependency>
 
+	    <dependency>
+	      <groupId>org.springframework</groupId>
+	      <artifactId>spring-test</artifactId>
+	      <scope>test</scope>
+	    </dependency>
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
@@ -88,6 +87,11 @@
 			<artifactId>mockito-core</artifactId>
 			<scope>test</scope>
 		</dependency>
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+			<scope>test</scope>
+		</dependency>
 
 	</dependencies>
 </project>

Modified: camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java?rev=1040021&r1=1040020&r2=1040021&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java (original)
+++ camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java Mon Nov 29 06:22:57 2010
@@ -16,18 +16,25 @@
  */
 package org.apache.camel.component.quickfixj;
 
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import javax.management.JMException;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
+import quickfix.ConfigError;
+import quickfix.FieldConvertError;
 import quickfix.LogFactory;
 import quickfix.MessageFactory;
 import quickfix.MessageStoreFactory;
+import quickfix.SessionSettings;
 
 public class QuickfixjComponent extends DefaultComponent {
     private static final Logger LOG = LoggerFactory.getLogger(QuickfixjComponent.class);
@@ -39,7 +46,9 @@ public class QuickfixjComponent extends 
     private MessageStoreFactory messageStoreFactory;
     private LogFactory logFactory;
     private MessageFactory messageFactory;
-    
+    private boolean forcedShutdown;
+    private Map<String, SessionSettings> engineSettings = new HashMap<String, SessionSettings>();
+
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
         // Look up the engine instance based on the settings file ("remaining")
@@ -51,18 +60,23 @@ public class QuickfixjComponent extends 
                 engine = engines.get(remaining);
                 if (engine == null) {
                     LOG.info("Creating QuickFIX/J engine using settings: " + remaining);
-                    engine = new QuickfixjEngine(remaining, false, messageStoreFactory, logFactory, messageFactory);
+                    SessionSettings settings = engineSettings.get(remaining);
+                    if (settings != null) {
+                        engine = new QuickfixjEngine(uri, settings, forcedShutdown, messageStoreFactory, logFactory, messageFactory);
+                    } else {
+                        engine = new QuickfixjEngine(uri, remaining, forcedShutdown, messageStoreFactory, logFactory, messageFactory);
+                    }
                     engines.put(remaining, engine);
                     if (isStarted()) {
                         startQuickfixjEngine(engine);
                     }
                 }
-                
+
                 endpoint = new QuickfixjEndpoint(uri, getCamelContext());
                 engine.addEventListener(endpoint);
                 endpoints.put(uri, endpoint);
             }
-            
+
             return endpoint;
         }
     }
@@ -73,13 +87,13 @@ public class QuickfixjComponent extends 
         LOG.info("QuickFIX/J component started");
         synchronized (engineInstancesLock) {
             for (QuickfixjEngine engine : engines.values()) {
-                startQuickfixjEngine(engine);            
+                startQuickfixjEngine(engine);
             }
         }
     }
 
     private void startQuickfixjEngine(QuickfixjEngine engine) throws Exception {
-        LOG.info("Starting QuickFIX/J engine: " + engine.getSettingsResourceName());
+        LOG.info("Starting QuickFIX/J engine: uri=" + engine.getUri());
         engine.start();
     }
 
@@ -88,7 +102,7 @@ public class QuickfixjComponent extends 
         super.doStop();
         synchronized (engineInstancesLock) {
             for (QuickfixjEngine engine : engines.values()) {
-                engine.stop();           
+                engine.stop();
             }
         }
         LOG.info("QuickFIX/J component stopped");
@@ -98,16 +112,44 @@ public class QuickfixjComponent extends 
     Map<String, QuickfixjEngine> getEngines() {
         return Collections.unmodifiableMap(engines);
     }
-    
+
     public void setMessageFactory(MessageFactory messageFactory) {
         this.messageFactory = messageFactory;
     }
-    
+
     public void setLogFactory(LogFactory logFactory) {
         this.logFactory = logFactory;
     }
-    
+
     public void setMessageStoreFactory(MessageStoreFactory messageStoreFactory) {
         this.messageStoreFactory = messageStoreFactory;
     }
+
+    public void setForcedShutdown(boolean forcedShutdown) {
+        this.forcedShutdown = forcedShutdown;
+    }
+
+    public void setEngineSettings(Map<String, SessionSettings> engineSettings)
+        throws ConfigError, FieldConvertError, IOException, JMException, URISyntaxException {
+        for (Map.Entry<String, SessionSettings> s : engineSettings.entrySet()) {
+            // QuickfixjEngine engine = new QuickfixjEngine(s.getKey(), s.getValue(),
+            // forcedShutdown, messageStoreFactory, logFactory, messageFactory);
+            this.engineSettings.put(getPath(s.getKey()), s.getValue());
+        }
+    }
+
+    private static String getPath(String uri) throws URISyntaxException {
+        // Adapted from DefaultComponent
+        URI u = new URI(UnsafeUriCharactersEncoder.encode(uri));
+        String path = u.getSchemeSpecificPart();
+        // lets trim off any query arguments
+        if (path.startsWith("//")) {
+            path = path.substring(2);
+        }
+        int idx = path.indexOf('?');
+        if (idx > 0) {
+            path = path.substring(0, idx);
+        }
+        return path;
+    }
 }

Modified: camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java?rev=1040021&r1=1040020&r2=1040021&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java (original)
+++ camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java Mon Nov 29 06:22:57 2010
@@ -94,46 +94,42 @@ public class QuickfixjEngine {
     private final MessageFactory messageFactory;
 
     private boolean started;
-    private String settingsResourceName;
     private List<QuickfixjEventListener> eventListeners = new CopyOnWriteArrayList<QuickfixjEventListener>();
 
+    private final String uri;
+
     public enum ThreadModel {
         ThreadPerConnector, ThreadPerSession;
     }
 
-    public QuickfixjEngine(String settingsResourceName, boolean forcedShutdown)
+    public QuickfixjEngine(String uri, String settingsResourceName, boolean forcedShutdown)
         throws ConfigError, FieldConvertError, IOException, JMException {
 
-        this(settingsResourceName, forcedShutdown, null, null, null);
+        this(uri, settingsResourceName, forcedShutdown, null, null, null);
     }
 
-    public QuickfixjEngine(String settingsResourceName, boolean forcedShutdown,
-                           MessageStoreFactory messageStoreFactoryOverride, LogFactory sessionLogFactoryOverride, MessageFactory messageFactoryOverride)
-        throws ConfigError, FieldConvertError, IOException, JMException {
+    public QuickfixjEngine(String uri, String settingsResourceName, boolean forcedShutdown,
+            MessageStoreFactory messageStoreFactoryOverride, LogFactory sessionLogFactoryOverride,
+            MessageFactory messageFactoryOverride) throws ConfigError, FieldConvertError, IOException, JMException {
+        this(uri, loadSettings(settingsResourceName), forcedShutdown, messageStoreFactoryOverride,
+                sessionLogFactoryOverride, messageFactoryOverride);
+    }
 
-        this.forcedShutdown = forcedShutdown;
-        this.settingsResourceName = settingsResourceName;
+    public QuickfixjEngine(String uri, SessionSettings settings, boolean forcedShutdown,
+            MessageStoreFactory messageStoreFactoryOverride, LogFactory sessionLogFactoryOverride,
+            MessageFactory messageFactoryOverride) throws ConfigError, FieldConvertError, IOException, JMException {
 
-        InputStream inputStream = ObjectHelper.loadResourceAsStream(settingsResourceName);
-        if (inputStream == null) {
-            throw new IllegalArgumentException("Could not load " + settingsResourceName);
-        }
+        this.uri = uri;
+        this.forcedShutdown = forcedShutdown;
         
-        SessionSettings settings = new SessionSettings(inputStream);
+        messageFactory = messageFactoryOverride != null ? messageFactoryOverride : new DefaultMessageFactory();
 
-        messageFactory = messageFactoryOverride != null 
-            ? messageFactoryOverride 
-            : new DefaultMessageFactory();
-        
-        sessionLogFactory = sessionLogFactoryOverride != null 
-            ? sessionLogFactoryOverride 
-            : inferLogFactory(settings);
-        
-        messageStoreFactory = messageStoreFactoryOverride != null 
-            ? messageStoreFactoryOverride 
-            : inferMessageStoreFactory(settings);
+        sessionLogFactory = sessionLogFactoryOverride != null ? sessionLogFactoryOverride : inferLogFactory(settings);
+
+        messageStoreFactory = messageStoreFactoryOverride != null ? messageStoreFactoryOverride
+                : inferMessageStoreFactory(settings);
 
-        // Set default session schedule if not specified in configuration        
+        // Set default session schedule if not specified in configuration
         if (!settings.isSetting(Session.SETTING_START_TIME)) {
             settings.setString(Session.SETTING_START_TIME, DEFAULT_START_TIME);
         }
@@ -144,7 +140,7 @@ public class QuickfixjEngine {
         if (!settings.isSetting(Session.SETTING_HEARTBTINT)) {
             settings.setLong(Session.SETTING_HEARTBTINT, DEFAULT_HEARTBTINT);
         }
-        
+
         // Allow specification of the QFJ threading model
         ThreadModel threadModel = ThreadModel.ThreadPerConnector;
         if (settings.isSetting(SETTING_THREAD_MODEL)) {
@@ -157,7 +153,7 @@ public class QuickfixjEngine {
         } else {
             jmxExporter = null;
         }
-        
+
         // From original component implementation...
         // To avoid this exception in OSGi platform
         // java.lang.NoClassDefFoundError: quickfix/fix41/MessageFactory
@@ -165,21 +161,20 @@ public class QuickfixjEngine {
         try {
             Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
-
             if (isConnectorRole(settings, SessionFactory.ACCEPTOR_CONNECTION_TYPE)) {
-                acceptor = createAcceptor(new Dispatcher(), settings,
-                    messageStoreFactory, sessionLogFactory, messageFactory, threadModel);
+                acceptor = createAcceptor(new Dispatcher(), settings, messageStoreFactory, sessionLogFactory,
+                        messageFactory, threadModel);
             } else {
                 acceptor = null;
             }
-    
+
             if (isConnectorRole(settings, SessionFactory.INITIATOR_CONNECTION_TYPE)) {
-                initiator = createInitiator(new Dispatcher(), settings, 
-                    messageStoreFactory, sessionLogFactory, messageFactory, threadModel);               
+                initiator = createInitiator(new Dispatcher(), settings, messageStoreFactory, sessionLogFactory,
+                        messageFactory, threadModel);
             } else {
                 initiator = null;
             }
-    
+
             if (acceptor == null && initiator == null) {
                 throw new ConfigError("No connector role");
             }
@@ -188,6 +183,14 @@ public class QuickfixjEngine {
         }
     }
 
+    private static SessionSettings loadSettings(String settingsResourceName) throws ConfigError {
+        InputStream inputStream = ObjectHelper.loadResourceAsStream(settingsResourceName);
+        if (inputStream == null) {
+            throw new IllegalArgumentException("Could not load " + settingsResourceName);
+        }
+        return new SessionSettings(inputStream);
+    }
+
     public void start() throws Exception {
         if (acceptor != null) {
             acceptor.start();
@@ -455,9 +458,9 @@ public class QuickfixjEngine {
             }
         }
     }
-    
-    public String getSettingsResourceName() {
-        return settingsResourceName;
+        
+    public String getUri() {
+        return uri;
     }
 
     // For Testing

Added: camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactory.java?rev=1040021&view=auto
==============================================================================
--- camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactory.java (added)
+++ camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactory.java Mon Nov 29 06:22:57 2010
@@ -0,0 +1,55 @@
+/**
+ * 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.quickfixj;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.springframework.beans.factory.FactoryBean;
+import quickfix.Dictionary;
+import quickfix.SessionID;
+import quickfix.SessionSettings;
+
+public class QuickfixjSettingsFactory implements FactoryBean<SessionSettings> {
+    private Map<Object, Object> defaultSettings = Collections.emptyMap();
+    private Map<SessionID, Map<Object, Object>> sessionSettings = Collections.emptyMap();
+
+    public SessionSettings getObject() throws Exception {
+        SessionSettings settings = new SessionSettings();
+        settings.set(new Dictionary("defaults", defaultSettings));
+        for (Map.Entry<SessionID, Map<Object, Object>> sessionSetting : sessionSettings.entrySet()) {
+            settings.set(sessionSetting.getKey(), new Dictionary("session", sessionSetting.getValue()));
+        }
+        return settings;
+    }
+
+    public Class<?> getObjectType() {
+        return SessionSettings.class;
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public void setDefaultSettings(Map<Object, Object> defaultSettings) {
+        this.defaultSettings = defaultSettings;
+    }
+
+    public void setSessionSettings(Map<SessionID, Map<Object, Object>> sessionSettings) {
+        this.sessionSettings = sessionSettings;
+    }
+}

Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java?rev=1040021&r1=1040020&r2=1040021&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java (original)
+++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConsumerTest.java Mon Nov 29 06:22:57 2010
@@ -24,7 +24,6 @@ import org.apache.camel.impl.ServiceSupp
 import org.hamcrest.CoreMatchers;
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Matchers;
 import org.mockito.Mockito;
@@ -80,23 +79,5 @@ public class QuickfixjConsumerTest {
         consumer.onExchange(mockExchange);
         
         Mockito.verify(mockExchange).setException(exception);
-    }
-    
-    @Test
-    @Ignore("Modified behavior")
-    public void propagateException() throws Exception {
-        QuickfixjConsumer consumer = new QuickfixjConsumer(mockEndpoint, mockProcessor);
-        consumer.start();
-        
-        Throwable exception = new Exception("Throwable for test");
-        Mockito.doThrow(exception).when(mockProcessor).process(mockExchange);
-        
-        try {
-            consumer.onExchange(mockExchange);
-            Assert.fail("Exception was not thrown");
-        } catch (Exception e) {
-            Assert.assertThat(e.getMessage(), CoreMatchers.is("Throwable for test"));
-        }
-    }
-    
+    }    
 }

Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java?rev=1040021&r1=1040020&r2=1040021&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java (original)
+++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java Mon Nov 29 06:22:57 2010
@@ -233,7 +233,7 @@ public class QuickfixjConvertersTest {
 
         TestSupport.writeSettings(settings, settingsFile);
         
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
         quickfixjEngine.start(); 
     }
 }

Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java?rev=1040021&r1=1040020&r2=1040021&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java (original)
+++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java Mon Nov 29 06:22:57 2010
@@ -115,7 +115,7 @@ public class QuickfixjEngineTest {
 
     @Test(expected = IllegalArgumentException.class)
     public void missingSettingsResource() throws Exception {
-        new QuickfixjEngine("bogus.cfg", false);
+        new QuickfixjEngine("quickfix:test", "bogus.cfg", false);
     }
 
     @Test
@@ -124,7 +124,7 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), instanceOf(SocketInitiator.class));
         assertThat(quickfixjEngine.getAcceptor(), nullValue());
@@ -138,7 +138,7 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), instanceOf(ThreadedSocketInitiator.class));
         assertThat(quickfixjEngine.getAcceptor(), nullValue());
@@ -152,7 +152,7 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), nullValue());
         assertThat(quickfixjEngine.getAcceptor(), instanceOf(SocketAcceptor.class));
@@ -167,7 +167,7 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), nullValue());
         assertThat(quickfixjEngine.getAcceptor(), instanceOf(ThreadedSocketAcceptor.class));
@@ -185,7 +185,7 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), notNullValue());
         assertThat(quickfixjEngine.getAcceptor(), notNullValue());
@@ -199,11 +199,11 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), notNullValue());
         assertThat(quickfixjEngine.getAcceptor(), nullValue());
-        assertThat(quickfixjEngine.getSettingsResourceName(), is(settingsFile.getName()));
+        assertThat(quickfixjEngine.getUri(), is("quickfix:test"));
         assertThat(quickfixjEngine.getMessageStoreFactory(), instanceOf(FileStoreFactory.class));
         assertThat(quickfixjEngine.getLogFactory(), instanceOf(ScreenLogFactory.class));
         assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class));
@@ -219,11 +219,10 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), notNullValue());
         assertThat(quickfixjEngine.getAcceptor(), nullValue());
-        assertThat(quickfixjEngine.getSettingsResourceName(), is(settingsFile.getName()));
         assertThat(quickfixjEngine.getMessageStoreFactory(), instanceOf(JdbcStoreFactory.class));
         assertThat(quickfixjEngine.getLogFactory(), instanceOf(JdbcLogFactory.class));
         assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class));
@@ -248,11 +247,10 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), notNullValue());
         assertThat(quickfixjEngine.getAcceptor(), nullValue());
-        assertThat(quickfixjEngine.getSettingsResourceName(), is(settingsFile.getName()));
         assertThat(quickfixjEngine.getMessageStoreFactory(), instanceOf(JdbcStoreFactory.class));
         assertThat(quickfixjEngine.getLogFactory(), instanceOf(ScreenLogFactory.class));
         assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class));
@@ -265,11 +263,10 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), notNullValue());
         assertThat(quickfixjEngine.getAcceptor(), nullValue());
-        assertThat(quickfixjEngine.getSettingsResourceName(), is(settingsFile.getName()));
         assertThat(quickfixjEngine.getMessageStoreFactory(), instanceOf(SleepycatStoreFactory.class));
         assertThat(quickfixjEngine.getLogFactory(), instanceOf(ScreenLogFactory.class));
         assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class));
@@ -282,11 +279,10 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), notNullValue());
         assertThat(quickfixjEngine.getAcceptor(), nullValue());
-        assertThat(quickfixjEngine.getSettingsResourceName(), is(settingsFile.getName()));
         assertThat(quickfixjEngine.getMessageStoreFactory(), instanceOf(MemoryStoreFactory.class));
         assertThat(quickfixjEngine.getLogFactory(), instanceOf(FileLogFactory.class));
         assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class));
@@ -299,11 +295,10 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
 
         assertThat(quickfixjEngine.getInitiator(), notNullValue());
         assertThat(quickfixjEngine.getAcceptor(), nullValue());
-        assertThat(quickfixjEngine.getSettingsResourceName(), is(settingsFile.getName()));
         assertThat(quickfixjEngine.getMessageStoreFactory(), instanceOf(MemoryStoreFactory.class));
         assertThat(quickfixjEngine.getLogFactory(), instanceOf(SLF4JLogFactory.class));
         assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class));
@@ -322,7 +317,7 @@ public class QuickfixjEngineTest {
 
     private void doAmbiguityTest(String exceptionText) throws FieldConvertError, IOException, JMException {
         try {
-            quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+            quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
             fail("Expected exception, but none raised");
         } catch (ConfigError e) {
             assertTrue(e.getMessage().contains(exceptionText));
@@ -340,7 +335,7 @@ public class QuickfixjEngineTest {
         LogFactory logFactory = Mockito.mock(LogFactory.class);
         MessageFactory messageFactory = Mockito.mock(MessageFactory.class);
         
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false, messageStoreFactory, logFactory, messageFactory);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false, messageStoreFactory, logFactory, messageFactory);
  
         assertThat(quickfixjEngine.getMessageStoreFactory(), is(messageStoreFactory));
         assertThat(quickfixjEngine.getLogFactory(), is(logFactory));
@@ -355,7 +350,7 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
         quickfixjEngine.start();
 
         MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
@@ -371,7 +366,7 @@ public class QuickfixjEngineTest {
 
         writeSettings();
 
-        quickfixjEngine = new QuickfixjEngine(settingsFile.getName(), false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
         quickfixjEngine.start();
         MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
         Set<ObjectName> n = mbeanServer.queryNames(new ObjectName("org.quickfixj:type=Connector,role=Acceptor,*"), null);
@@ -383,7 +378,7 @@ public class QuickfixjEngineTest {
         SessionID acceptorSessionID = new SessionID(FixVersions.BEGINSTRING_FIX42, "MARKET", "TRADER");
         SessionID initiatorSessionID = new SessionID(FixVersions.BEGINSTRING_FIX42, "TRADER", "MARKET");
 
-        quickfixjEngine = new QuickfixjEngine("examples/inprocess.cfg", false);
+        quickfixjEngine = new QuickfixjEngine("quickfix:test", "examples/inprocess.cfg", false);
 
         doLogonEventsTest(acceptorSessionID, initiatorSessionID, quickfixjEngine);
 
@@ -564,7 +559,6 @@ public class QuickfixjEngineTest {
     }
 
     private void assertDefaultConfiguration(QuickfixjEngine quickfixjEngine) throws Exception {
-        assertThat(quickfixjEngine.getSettingsResourceName(), is(settingsFile.getName()));
         assertThat(quickfixjEngine.getMessageStoreFactory(), instanceOf(MemoryStoreFactory.class));
         assertThat(quickfixjEngine.getLogFactory(), instanceOf(ScreenLogFactory.class));
         assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class));

Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java?rev=1040021&r1=1040020&r2=1040021&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java (original)
+++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java Mon Nov 29 06:22:57 2010
@@ -26,6 +26,7 @@ import quickfix.Message;
 import quickfix.SessionID;
 
 public class QuickfixjProducerTest {
+
     @Test
     public void setExceptionOnExchange() throws Exception {
         Exchange mockExchange = Mockito.mock(Exchange.class);

Added: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactoryTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactoryTest.java?rev=1040021&view=auto
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactoryTest.java (added)
+++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSettingsFactoryTest.java Mon Nov 29 06:22:57 2010
@@ -0,0 +1,59 @@
+/**
+ * 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.quickfixj;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.hamcrest.CoreMatchers;
+import org.junit.Assert;
+import org.junit.Test;
+import quickfix.SessionID;
+import quickfix.SessionSettings;
+
+public class QuickfixjSettingsFactoryTest {
+
+    @Test
+    public void createSessionSettings() throws Exception {
+        QuickfixjSettingsFactory factory = new QuickfixjSettingsFactory();
+
+        Map<Object, Object> defaultSettings = new HashMap<Object, Object>();
+        defaultSettings.put("value1", 1);
+        defaultSettings.put("value2", 2);
+
+        factory.setDefaultSettings(defaultSettings);
+
+        Map<Object, Object> session1Settings = new HashMap<Object, Object>();
+        session1Settings.put("value1", 10);
+        session1Settings.put("value3", 30);
+
+        Map<SessionID, Map<Object, Object>> sessionSettings = new HashMap<SessionID, Map<Object, Object>>();
+
+        SessionID sessionID = new SessionID("FIX.4.2:SENDER->TARGET");
+        sessionSettings.put(sessionID, session1Settings);
+
+        factory.setSessionSettings(sessionSettings);
+
+        SessionSettings settings = factory.getObject();
+        Properties sessionProperties = settings.getSessionProperties(sessionID, true);
+
+        Assert.assertThat(sessionProperties.get("value1").toString(), CoreMatchers.is("10"));
+        Assert.assertThat(sessionProperties.get("value2").toString(), CoreMatchers.is("2"));
+        Assert.assertThat(sessionProperties.get("value3").toString(), CoreMatchers.is("30"));
+    }
+}

Added: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSpringTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSpringTest.java?rev=1040021&view=auto
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSpringTest.java (added)
+++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjSpringTest.java Mon Nov 29 06:22:57 2010
@@ -0,0 +1,76 @@
+/**
+ * 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.quickfixj;
+
+import java.util.Properties;
+
+import org.hamcrest.CoreMatchers;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import quickfix.DefaultMessageFactory;
+import quickfix.FixVersions;
+import quickfix.Message;
+import quickfix.SessionID;
+import quickfix.SessionSettings;
+import quickfix.field.MsgType;
+import quickfix.fix42.NewOrderSingle;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration
+public class QuickfixjSpringTest {
+    @Autowired(required = true)
+    private QuickfixjComponent component;
+
+    @Autowired(required = true)
+    private SessionSettings springSessionSettings;
+
+    @Test
+    public void configureInSpring() throws Exception {
+        SessionID sessionID = new SessionID("FIX.4.2:INITIATOR->ACCEPTOR");
+        Properties sessionProperties = springSessionSettings.getSessionProperties(sessionID, true);
+        Assert.assertThat(sessionProperties.get("ConnectionType").toString(), CoreMatchers.is("initiator"));
+        Assert.assertThat(sessionProperties.get("SocketConnectProtocol").toString(), CoreMatchers.is("VM_PIPE"));
+
+        QuickfixjEngine engine = component.getEngines().values().iterator().next();
+
+        Assert.assertThat(engine.getMessageFactory(), is(instanceOf(CustomMessageFactory.class)));
+    }
+
+    /**
+     * Customer message factory and message class for test purposes
+     */
+    public static class CustomMessageFactory extends DefaultMessageFactory {
+        @Override
+        public Message create(String beginString, String msgType) {
+            if (beginString.equals(FixVersions.BEGINSTRING_FIX42) && msgType.equals(MsgType.ORDER_SINGLE)) {
+                return new CustomNewOrderSingle();
+            }
+            return super.create(beginString, msgType);
+        }
+    }
+
+    @SuppressWarnings("serial")
+    public static class CustomNewOrderSingle extends NewOrderSingle {
+    }
+}

Modified: camel/trunk/components/camel-quickfix/src/test/resources/examples/gateway.cfg
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/resources/examples/gateway.cfg?rev=1040021&r1=1040020&r2=1040021&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/resources/examples/gateway.cfg (original)
+++ camel/trunk/components/camel-quickfix/src/test/resources/examples/gateway.cfg Mon Nov 29 06:22:57 2010
@@ -1,3 +1,20 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
 #
 # Creates an initiators and acceptors that communicate within a 
 # VM (no external socket connections).

Modified: camel/trunk/components/camel-quickfix/src/test/resources/examples/inprocess.cfg
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/resources/examples/inprocess.cfg?rev=1040021&r1=1040020&r2=1040021&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/resources/examples/inprocess.cfg (original)
+++ camel/trunk/components/camel-quickfix/src/test/resources/examples/inprocess.cfg Mon Nov 29 06:22:57 2010
@@ -1,3 +1,20 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
 #
 # Creates an initiator and acceptor that communicate within a 
 # VM (no external socket connections).

Added: camel/trunk/components/camel-quickfix/src/test/resources/org/apache/camel/component/quickfixj/QuickfixjSpringTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/resources/org/apache/camel/component/quickfixj/QuickfixjSpringTest-context.xml?rev=1040021&view=auto
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/resources/org/apache/camel/component/quickfixj/QuickfixjSpringTest-context.xml (added)
+++ camel/trunk/components/camel-quickfix/src/test/resources/org/apache/camel/component/quickfixj/QuickfixjSpringTest-context.xml Mon Nov 29 06:22:57 2010
@@ -0,0 +1,81 @@
+<?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"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+    <!-- START SNIPPET: e1 -->
+    <!-- camel route -->
+    <camelContext id="quickfixjContext" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="quickfix:example"/>
+            <filter>
+                <simple>${in.header.EventCategory} == 'AppMessageReceived'</simple>
+                <to uri="log:test"/>
+            </filter>
+        </route>
+    </camelContext>
+
+    <!-- quickfix component -->
+    <bean id="quickfix" class="org.apache.camel.component.quickfixj.QuickfixjComponent">
+        <property name="engineSettings">
+            <util:map>
+                <entry key="quickfix:example" value-ref="quickfixjSettings"/>
+            </util:map>
+        </property>
+        <property name="messageFactory">
+            <bean class="org.apache.camel.component.quickfixj.QuickfixjSpringTest.CustomMessageFactory"/>
+        </property>
+    </bean>
+
+    <!-- quickfix settings -->
+    <bean id="quickfixjSettings"
+          class="org.apache.camel.component.quickfixj.QuickfixjSettingsFactory">
+        <property name="defaultSettings">
+            <util:map>
+                <entry key="SocketConnectProtocol" value="VM_PIPE"/>
+                <entry key="SocketAcceptProtocol" value="VM_PIPE"/>
+                <entry key="UseDataDictionary" value="N"/>
+            </util:map>
+        </property>
+        <property name="sessionSettings">
+            <util:map>
+                <entry key="FIX.4.2:INITIATOR->ACCEPTOR">
+                    <util:map>
+                        <entry key="ConnectionType" value="initiator"/>
+                        <entry key="SocketConnectHost" value="localhost"/>
+                        <entry key="SocketConnectPort" value="5000"/>
+                    </util:map>
+                </entry>
+                <entry key="FIX.4.2:ACCEPTOR->INITIATOR">
+                    <util:map>
+                        <entry key="ConnectionType" value="acceptor"/>
+                        <entry key="SocketAcceptPort" value="5000"/>
+                    </util:map>
+                </entry>
+            </util:map>
+        </property>
+    </bean>
+    <!-- END SNIPPET: e1 -->
+
+</beans>
\ No newline at end of file