Creates a message store that stores all data in memory
Наследование: IMessageStoreFactory
Пример #1
0
    public void SetUp()
    {
        application = new ApplicationImpl();
        SessionSettings settings = new SessionSettings( "c:\\development\\quickfix\\test\\cfg\\at_client.cfg" );
        MessageStoreFactory messageStoreFactory =
            new MemoryStoreFactory();
        QuickFix42.MessageFactory messageFactory = new QuickFix42.MessageFactory();

        initiator = new SocketInitiator
            (application, messageStoreFactory, settings, messageFactory);

        server = new Process();
        server.StartInfo.FileName = "c:\\development\\quickfix\\test\\debug\\at\\at";
        server.StartInfo.Arguments = "-f c:\\development\\quickfix\\test\\cfg\\at.cfg";
        server.Start();

        Thread quickFixThread = new Thread(RunThread);
        quickFixThread.Start();

        for(int i = 0;i < 50;++i)
        {
            if(application.isLoggedOn())
            {
                break;
            }
            Thread.Sleep(1000);
        }
        if(!application.isLoggedOn())
        {
            throw new Exception();
        }
    }
Пример #2
0
        public void ValidConfiguration()
        {
            Application app = new NullApplication();
            MessageStoreFactory storeFactory = new MemoryStoreFactory();
            SessionFactory factory = new SessionFactory(app, storeFactory);

            SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
            Dictionary settings = new Dictionary();
            settings.SetString(SessionSettings.CONNECTION_TYPE, "initiator");
            settings.SetString(SessionSettings.USE_DATA_DICTIONARY, "N");
            settings.SetString(SessionSettings.START_TIME, "12:00:00");
            settings.SetString(SessionSettings.END_TIME, "12:00:00");
            settings.SetString(SessionSettings.HEARTBTINT, "30");

            Assert.DoesNotThrow(delegate { factory.Create(sessionID, settings); });
        }
Пример #3
0
        public void TestExtendedSettings()
        {
            IApplication app = new NullApplication();
            IMessageStoreFactory storeFactory = new MemoryStoreFactory();
            SessionFactory factory = new SessionFactory(app, storeFactory);

            SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
            Dictionary settings = new Dictionary();
            settings.SetString(SessionSettings.USE_DATA_DICTIONARY, "N");
            settings.SetString(SessionSettings.SEND_REDUNDANT_RESENDREQUESTS, "Y");
            settings.SetString(SessionSettings.RESEND_SESSION_LEVEL_REJECTS, "Y");
            settings.SetString(SessionSettings.MILLISECONDS_IN_TIMESTAMP, "Y");
            settings.SetString(SessionSettings.CONNECTION_TYPE, "initiator");
            settings.SetString(SessionSettings.HEARTBTINT, "30");
            settings.SetString(SessionSettings.START_TIME, "12:00:00");
            settings.SetString(SessionSettings.END_TIME, "12:00:00");
            settings.SetString(SessionSettings.ENABLE_LAST_MSG_SEQ_NUM_PROCESSED, "Y");
            settings.SetString(SessionSettings.MAX_MESSAGES_IN_RESEND_REQUEST, "2500");
            settings.SetString(SessionSettings.SEND_LOGOUT_BEFORE_TIMEOUT_DISCONNECT, "Y");
            settings.SetString(SessionSettings.IGNORE_POSSDUP_RESEND_REQUESTS, "Y");

            Session session = factory.Create(sessionID, settings);

            Assert.That(session.SendRedundantResendRequests);
            Assert.That(session.ResendSessionLevelRejects);
            Assert.That(session.MillisecondsInTimeStamp);

            settings.SetString(SessionSettings.SEND_REDUNDANT_RESENDREQUESTS, "N");
            settings.SetString(SessionSettings.RESEND_SESSION_LEVEL_REJECTS, "N");
            settings.SetString(SessionSettings.MILLISECONDS_IN_TIMESTAMP, "N");
            session = factory.Create(sessionID, settings);

            Assert.That(!session.SendRedundantResendRequests);
            Assert.That(!session.ResendSessionLevelRejects);
            Assert.That(!session.MillisecondsInTimeStamp);
            Assert.That(session.EnableLastMsgSeqNumProcessed);
            Assert.That(session.MaxMessagesInResendRequest, Is.EqualTo(2500));
            Assert.That(session.SendLogoutBeforeTimeoutDisconnect);
            Assert.That(session.IgnorePossDupResendRequests);
        }
Пример #4
0
        public void TestPersistMessages()
        {
            IApplication app = new NullApplication();
            IMessageStoreFactory storeFactory = new MemoryStoreFactory();
            SessionFactory factory = new SessionFactory(app, storeFactory);

            SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
            Dictionary settings = new Dictionary();
            settings.SetString(SessionSettings.USE_DATA_DICTIONARY, "N");
            settings.SetString(SessionSettings.CONNECTION_TYPE, "initiator");
            settings.SetString(SessionSettings.HEARTBTINT, "30");
            settings.SetString(SessionSettings.START_TIME, "12:00:00");
            settings.SetString(SessionSettings.END_TIME, "12:00:00");
            Session session = factory.Create(sessionID, settings);

            //true by default
            Assert.That(session.PersistMessages);

            settings.SetBool(SessionSettings.PERSIST_MESSAGES, false);
            session = factory.Create(sessionID, settings);

            Assert.That(!session.PersistMessages);
        }
Пример #5
0
        void StartEngine(bool initiator)
        {
            TestApplication application = new TestApplication(LogonCallback, LogoffCallback);
            IMessageStoreFactory storeFactory = new MemoryStoreFactory();
            ILogFactory logFactory = new ScreenLogFactory(false, false, false);
            SessionSettings settings = new SessionSettings();

            if (initiator)
            {
                Dictionary defaults = new Dictionary();
                defaults.SetString(SessionSettings.RECONNECT_INTERVAL, "1");
                settings.Set(defaults);
                settings.Set(CreateSessionID(StaticInitiatorCompID), CreateSessionConfig(StaticInitiatorCompID, true));
                _initiator = new SocketInitiator(application, storeFactory, settings, logFactory);
                _initiator.Start();
            }
            else
            {
                settings.Set(CreateSessionID(StaticAcceptorCompID), CreateSessionConfig(StaticAcceptorCompID, false));
                _acceptor = new ThreadedSocketAcceptor(application, storeFactory, settings, logFactory);
                _acceptor.Start();
            }
        }
Пример #6
0
        void StartEngine(bool initiator)
        {
            TestApplication application = new TestApplication(LogonCallback, LogoffCallback);
            IMessageStoreFactory storeFactory = new MemoryStoreFactory();
            SessionSettings settings = new SessionSettings();
            Dictionary defaults = new Dictionary();
            defaults.SetString(QuickFix.SessionSettings.FILE_LOG_PATH, LogPath);

            // Put IP endpoint settings into default section to verify that that defaults get merged into
            // session-specific settings not only for static sessions, but also for dynamic ones
            defaults.SetString(SessionSettings.SOCKET_CONNECT_HOST, Host);
            defaults.SetString(SessionSettings.SOCKET_CONNECT_PORT, ConnectPort.ToString());
            defaults.SetString(SessionSettings.SOCKET_ACCEPT_HOST, Host);
            defaults.SetString(SessionSettings.SOCKET_ACCEPT_PORT, AcceptPort.ToString());

            settings.Set(defaults);
            ILogFactory logFactory = new FileLogFactory(settings);

            if (initiator)
            {
                defaults.SetString(SessionSettings.RECONNECT_INTERVAL, "1");
                settings.Set(CreateSessionID(StaticInitiatorCompID), CreateSessionConfig(StaticInitiatorCompID, true));
                _initiator = new SocketInitiator(application, storeFactory, settings, logFactory);
                _initiator.Start();
            }
            else
            {
                settings.Set(CreateSessionID(StaticAcceptorCompID), CreateSessionConfig(StaticAcceptorCompID, false));
                _acceptor = new ThreadedSocketAcceptor(application, storeFactory, settings, logFactory);
                _acceptor.Start();
            }
        }