@Test public void testSessionCreation() throws Exception { try (Session session1 = provider.getSession(new SessionID("FIX.4.2", "SENDER", "SENDERSUB", "SENDERLOC", "TARGET", "TARGETSUB", "TARGETLOC", null), null)) { SessionID sessionID1 = session1.getSessionID(); assertEquals("wrong FIX version", "FIX.4.2", sessionID1.getBeginString()); assertEquals("wrong sender", "SENDER", sessionID1.getSenderCompID()); assertEquals("wrong senderSub", "SENDERSUB", sessionID1.getSenderSubID()); assertEquals("wrong senderLoc", "SENDERLOC", sessionID1.getSenderLocationID()); assertEquals("wrong target", "TARGET", sessionID1.getTargetCompID()); assertEquals("wrong targetSub", "TARGETSUB", sessionID1.getTargetSubID()); assertEquals("wrong targetLoc", "TARGETLOC", sessionID1.getTargetLocationID()); assertFalse("wrong setting", session1.getResetOnLogout()); assertFalse("wrong setting", session1.getRefreshOnLogon()); assertFalse("wrong setting", session1.getCheckCompID()); } try (Session session2 = provider.getSession(new SessionID("FIX.4.4", "S1", "T"), null)) { SessionID sessionID2 = session2.getSessionID(); assertEquals("wrong FIX version", "FIX.4.4", sessionID2.getBeginString()); assertEquals("wrong sender", "S1", sessionID2.getSenderCompID()); assertEquals("wrong target", "T", sessionID2.getTargetCompID()); assertTrue("wrong setting", session2.getResetOnLogout()); assertFalse("wrong setting", session2.getRefreshOnLogon()); assertTrue("wrong setting", session2.getCheckCompID()); } try (Session session3 = provider.getSession(new SessionID("FIX.4.4", "X", "Y"), null)) { SessionID sessionID3 = session3.getSessionID(); assertEquals("wrong FIX version", "FIX.4.4", sessionID3.getBeginString()); assertEquals("wrong sender", "X", sessionID3.getSenderCompID()); assertEquals("wrong target", "Y", sessionID3.getTargetCompID()); assertFalse("wrong setting", session3.getResetOnLogout()); assertTrue("wrong setting", session3.getRefreshOnLogon()); assertTrue("wrong setting", session3.getCheckCompID()); } }
public synchronized Session getSession(SessionID sessionID, SessionConnector sessionConnector) { Session s = Session.lookupSession(sessionID); if (s == null) { try { SessionID templateID = lookupTemplateID(sessionID); if (templateID == null) { throw new ConfigError("Unable to find a session template for " + sessionID); } SessionSettings dynamicSettings = new SessionSettings(); copySettings(dynamicSettings, settings.getDefaultProperties()); copySettings(dynamicSettings, settings.getSessionProperties(templateID)); dynamicSettings.setString(BEGINSTRING, sessionID.getBeginString()); dynamicSettings.setString(SENDERCOMPID, sessionID.getSenderCompID()); optionallySetValue(dynamicSettings, SENDERSUBID, sessionID.getSenderSubID()); optionallySetValue(dynamicSettings, SENDERLOCID, sessionID.getSenderLocationID()); dynamicSettings.setString(TARGETCOMPID, sessionID.getTargetCompID()); optionallySetValue(dynamicSettings, TARGETSUBID, sessionID.getTargetSubID()); optionallySetValue(dynamicSettings, TARGETLOCID, sessionID.getTargetLocationID()); s = sessionFactory.create(sessionID, dynamicSettings); if (sessionConnector != null) { sessionConnector.addDynamicSession(s); } } catch (ConfigError e) { throw new QFJException(e); } } return s; }
DynamicAcceptorSessionProvider implements AcceptorSessionProvider { public synchronized Session getSession(SessionID sessionID, SessionConnector sessionConnector) { Session s = Session.lookupSession(sessionID); if (s == null) { try { SessionID templateID = lookupTemplateID(sessionID); if (templateID == null) { throw new ConfigError("Unable to find a session template for " + sessionID); } SessionSettings dynamicSettings = new SessionSettings(); copySettings(dynamicSettings, settings.getDefaultProperties()); copySettings(dynamicSettings, settings.getSessionProperties(templateID)); dynamicSettings.setString(BEGINSTRING, sessionID.getBeginString()); dynamicSettings.setString(SENDERCOMPID, sessionID.getSenderCompID()); optionallySetValue(dynamicSettings, SENDERSUBID, sessionID.getSenderSubID()); optionallySetValue(dynamicSettings, SENDERLOCID, sessionID.getSenderLocationID()); dynamicSettings.setString(TARGETCOMPID, sessionID.getTargetCompID()); optionallySetValue(dynamicSettings, TARGETSUBID, sessionID.getTargetSubID()); optionallySetValue(dynamicSettings, TARGETLOCID, sessionID.getTargetLocationID()); s = sessionFactory.create(sessionID, dynamicSettings); if (sessionConnector != null) { sessionConnector.addDynamicSession(s); } } catch (ConfigError e) { throw new QFJException(e); } } return s; } }
DynamicAcceptorSessionProvider implements AcceptorSessionProvider { public synchronized Session getSession(SessionID sessionID, SessionConnector sessionConnector) { Session s = Session.lookupSession(sessionID); if (s == null) { try { SessionID templateID = lookupTemplateID(sessionID); if (templateID == null) { throw new ConfigError("Unable to find a session template for " + sessionID); } SessionSettings dynamicSettings = new SessionSettings(); copySettings(dynamicSettings, settings.getDefaultProperties()); copySettings(dynamicSettings, settings.getSessionProperties(templateID)); dynamicSettings.setString(BEGINSTRING, sessionID.getBeginString()); dynamicSettings.setString(SENDERCOMPID, sessionID.getSenderCompID()); optionallySetValue(dynamicSettings, SENDERSUBID, sessionID.getSenderSubID()); optionallySetValue(dynamicSettings, SENDERLOCID, sessionID.getSenderLocationID()); dynamicSettings.setString(TARGETCOMPID, sessionID.getTargetCompID()); optionallySetValue(dynamicSettings, TARGETSUBID, sessionID.getTargetSubID()); optionallySetValue(dynamicSettings, TARGETLOCID, sessionID.getTargetLocationID()); s = sessionFactory.create(sessionID, dynamicSettings); if (sessionConnector != null) { sessionConnector.addDynamicSession(s); } } catch (ConfigError e) { throw new QFJException(e); } } return s; } DynamicAcceptorSessionProvider(final SessionSettings settings,
            final SessionID templateID, quickfix.Application application,
            MessageStoreFactory messageStoreFactory, LogFactory logFactory,
            MessageFactory messageFactory);  DynamicAcceptorSessionProvider(final SessionSettings settings,
            List<TemplateMapping> templateMappings, quickfix.Application application,
            MessageStoreFactory messageStoreFactory, LogFactory logFactory,
            MessageFactory messageFactory); }
DynamicAcceptorSessionProvider implements AcceptorSessionProvider { public synchronized Session getSession(SessionID sessionID, SessionConnector sessionConnector) { Session s = Session.lookupSession(sessionID); if (s == null) { try { SessionID templateID = lookupTemplateID(sessionID); if (templateID == null) { throw new ConfigError("Unable to find a session template for " + sessionID); } SessionSettings dynamicSettings = new SessionSettings(); copySettings(dynamicSettings, settings.getDefaultProperties()); copySettings(dynamicSettings, settings.getSessionProperties(templateID)); dynamicSettings.setString(BEGINSTRING, sessionID.getBeginString()); dynamicSettings.setString(SENDERCOMPID, sessionID.getSenderCompID()); optionallySetValue(dynamicSettings, SENDERSUBID, sessionID.getSenderSubID()); optionallySetValue(dynamicSettings, SENDERLOCID, sessionID.getSenderLocationID()); dynamicSettings.setString(TARGETCOMPID, sessionID.getTargetCompID()); optionallySetValue(dynamicSettings, TARGETSUBID, sessionID.getTargetSubID()); optionallySetValue(dynamicSettings, TARGETLOCID, sessionID.getTargetLocationID()); s = sessionFactory.create(sessionID, dynamicSettings); if (sessionConnector != null) { sessionConnector.addDynamicSession(s); } } catch (ConfigError e) { throw new QFJException(e); } } return s; } DynamicAcceptorSessionProvider(final SessionSettings settings,
            final SessionID templateID, quickfix.Application application,
            MessageStoreFactory messageStoreFactory, LogFactory logFactory,
            MessageFactory messageFactory);  DynamicAcceptorSessionProvider(final SessionSettings settings,
            List<TemplateMapping> templateMappings, quickfix.Application application,
            MessageStoreFactory messageStoreFactory, LogFactory logFactory,
            MessageFactory messageFactory); synchronized Session getSession(SessionID sessionID, SessionConnector sessionConnector); }
DynamicAcceptorSessionProvider implements AcceptorSessionProvider { public synchronized Session getSession(SessionID sessionID, SessionConnector sessionConnector) { Session s = Session.lookupSession(sessionID); if (s == null) { try { SessionID templateID = lookupTemplateID(sessionID); if (templateID == null) { throw new ConfigError("Unable to find a session template for " + sessionID); } SessionSettings dynamicSettings = new SessionSettings(); copySettings(dynamicSettings, settings.getDefaultProperties()); copySettings(dynamicSettings, settings.getSessionProperties(templateID)); dynamicSettings.setString(BEGINSTRING, sessionID.getBeginString()); dynamicSettings.setString(SENDERCOMPID, sessionID.getSenderCompID()); optionallySetValue(dynamicSettings, SENDERSUBID, sessionID.getSenderSubID()); optionallySetValue(dynamicSettings, SENDERLOCID, sessionID.getSenderLocationID()); dynamicSettings.setString(TARGETCOMPID, sessionID.getTargetCompID()); optionallySetValue(dynamicSettings, TARGETSUBID, sessionID.getTargetSubID()); optionallySetValue(dynamicSettings, TARGETLOCID, sessionID.getTargetLocationID()); s = sessionFactory.create(sessionID, dynamicSettings); if (sessionConnector != null) { sessionConnector.addDynamicSession(s); } } catch (ConfigError e) { throw new QFJException(e); } } return s; } DynamicAcceptorSessionProvider(final SessionSettings settings,
            final SessionID templateID, quickfix.Application application,
            MessageStoreFactory messageStoreFactory, LogFactory logFactory,
            MessageFactory messageFactory);  DynamicAcceptorSessionProvider(final SessionSettings settings,
            List<TemplateMapping> templateMappings, quickfix.Application application,
            MessageStoreFactory messageStoreFactory, LogFactory logFactory,
            MessageFactory messageFactory); synchronized Session getSession(SessionID sessionID, SessionConnector sessionConnector); static final String WILDCARD; }