Package quickfix

Examples of quickfix.Session


            dataDictionary = (DataDictionary) dictionaryValue;
        } else if (dictionaryValue instanceof String) {
            dataDictionary = new DataDictionary((String) dictionaryValue);
        } else {
            SessionID sessionID = (SessionID) exchange.getIn().getHeader(QuickfixjEndpoint.SESSION_ID_KEY);
            Session session = Session.lookupSession(sessionID);
            dataDictionary = session != null ? session.getDataDictionary() : null;
        }

        return dataDictionary;
    }
View Full Code Here


       
    }
   
    @Test
    public void setExceptionOnExchange() throws Exception {
        Session mockSession = Mockito.spy(TestSupport.createSession(sessionID));
        Mockito.doReturn(mockSession).when(producer).getSession(MessageUtils.getSessionID(inboundFixMessage));
        Mockito.doThrow(new TestException()).when(mockSession).send(Mockito.isA(Message.class));

        producer.process(mockExchange);   
        Mockito.verify(mockExchange).setException(Matchers.isA(TestException.class));
View Full Code Here

        Mockito.verify(mockExchange).setException(Matchers.isA(TestException.class));
    }
   
    @Test
    public void processInOnlyExchange() throws Exception {       
        Session mockSession = Mockito.spy(TestSupport.createSession(sessionID));
        Mockito.doReturn(mockSession).when(producer).getSession(MessageUtils.getSessionID(inboundFixMessage));
        Mockito.doReturn(true).when(mockSession).send(Mockito.isA(Message.class));
       
        producer.process(mockExchange);
       
View Full Code Here

       
        final Message outboundFixMessage = new Email();
        outboundFixMessage.getHeader().setString(SenderCompID.FIELD, "TARGET");
        outboundFixMessage.getHeader().setString(TargetCompID.FIELD, "SENDER");
       
        Session mockSession = Mockito.spy(TestSupport.createSession(sessionID));
        Mockito.doReturn(mockSession).when(producer).getSession(MessageUtils.getSessionID(inboundFixMessage));
        Mockito.doAnswer(new Answer<Boolean>() {
            @Override
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                new Timer().schedule(new TimerTask() {               
View Full Code Here

        Mockito.when(mockExchange.getOut()).thenReturn(mockCamelOutMessage);
        Message outboundFixMessage = new Message();
        Mockito.when(mockCamelOutMessage.getBody(Message.class)).thenReturn(outboundFixMessage);
       
        QuickfixjConsumer consumer = Mockito.spy(new QuickfixjConsumer(mockEndpoint, mockProcessor));
        Session mockSession = Mockito.spy(TestSupport.createSession(sessionID));
        Mockito.doReturn(mockSession).when(consumer).getSession(MessageUtils.getReverseSessionID(inboundFixMessage));
        Mockito.doReturn(true).when(mockSession).send(Mockito.isA(Message.class));
       
        consumer.start();
        Mockito.when(mockExchange.getPattern()).thenReturn(ExchangePattern.InOut);
View Full Code Here

        return price;
    }

    private void sendMessage(SessionID sessionID, Message message) {
        try {
            Session session = Session.lookupSession(sessionID);
            if (session == null) {
                throw new SessionNotFound(sessionID.toString());
            }
           
            DataDictionaryProvider provider = session.getDataDictionaryProvider();
            if (provider != null) {
                try {
                    ApplVerID applVerID = getApplVerID(session, message);
                    DataDictionary appDataDictionary = provider.getApplicationDataDictionary(applVerID);
                    appDataDictionary.validate(message, true);
View Full Code Here

        SessionID messageSessionID = sessionID;
        if (messageSessionID == null) {
            messageSessionID = MessageUtils.getSessionID(message);
        }
       
        Session session = Session.lookupSession(messageSessionID);
        if (session == null) {
            exchange.setException(new IllegalStateException("Unknown session: " + messageSessionID));
            return;
        }
       
        session.send(message);
    }
View Full Code Here

                log.debug("Sending FIX message reply: " + quickfixjMessage.toString());
            }
           
            SessionID messageSessionID = MessageUtils.getReverseSessionID(exchange.getIn().getBody(quickfix.Message.class));
           
            Session session = getSession(messageSessionID);
            if (session == null) {
                throw new IllegalStateException("Unknown session: " + messageSessionID);
            }
           
            session.send(quickfixjMessage);
        } catch (Exception e) {
            exchange.setException(e);
        }
    }
View Full Code Here

        Mockito.when(mockExchange.getOut()).thenReturn(mockCamelOutMessage);
        Message outboundFixMessage = new Message();
        Mockito.when(mockCamelOutMessage.getBody(Message.class)).thenReturn(outboundFixMessage);
       
        QuickfixjConsumer consumer = Mockito.spy(new QuickfixjConsumer(mockEndpoint, mockProcessor));
        Session mockSession = Mockito.spy(TestSupport.createSession(sessionID));
        Mockito.doReturn(mockSession).when(consumer).getSession(MessageUtils.getReverseSessionID(inboundFixMessage));
        Mockito.doReturn(true).when(mockSession).send(Mockito.isA(Message.class));
       
        consumer.start();
        Mockito.when(mockExchange.getPattern()).thenReturn(ExchangePattern.InOut);
View Full Code Here

            dataDictionary = (DataDictionary)dictionaryValue;
        } else if (dictionaryValue instanceof String) {
            dataDictionary = new DataDictionary((String) dictionaryValue);
        } else {
            SessionID sessionID = (SessionID) exchange.getIn().getHeader(QuickfixjEndpoint.SESSION_ID_KEY);
            Session session = Session.lookupSession(sessionID);
            dataDictionary = session != null ? session.getDataDictionary() : null;
        }
       
        return dataDictionary;
    }
View Full Code Here

TOP

Related Classes of quickfix.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.