Package quickfix

Examples of quickfix.Session


       
    }
   
    @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

            SessionID messageSessionID = sessionID;
            if (messageSessionID == null) {
                messageSessionID = MessageUtils.getSessionID(message);
            }

            Session session = getSession(messageSessionID);
            if (session == null) {
                throw new IllegalStateException("Unknown session: " + messageSessionID);
            }

            Callable<Message> callable = null;

            if (exchange.getPattern().isOutCapable()) {
                QuickfixjEndpoint endpoint = (QuickfixjEndpoint) getEndpoint();
                MessageCorrelator messageCorrelator = endpoint.getEngine().getMessageCorrelator();
                callable = messageCorrelator.getReply(endpoint.getSessionID(), exchange);
            }

            session.send(message);

            if (callable != null) {
                Message reply = callable.call();
                exchange.getOut().setBody(reply);
            }
View Full Code Here

    @Test
    public void processInOutExchange() throws Exception {
        org.apache.camel.Message mockCamelOutMessage = Mockito.mock(org.apache.camel.Message.class);
        org.apache.camel.Message mockCamelInMessage = Mockito.mock(org.apache.camel.Message.class);
        SessionID mockSessionId = Mockito.mock(SessionID.class);
        Session mockSession = Mockito.mock(Session.class);

        QuickfixjConsumer consumer = Mockito.spy(new QuickfixjConsumer(mockEndpoint, mockProcessor));
        Mockito.doReturn(mockSession).when(consumer).getSession(mockSessionId);
        Mockito.doReturn(true).when(mockSession).send(Mockito.isA(Message.class));
View Full Code Here

        private static final long serialVersionUID = 1L;
    }
   
    @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 processInOnlyExchangeSuccess() 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

        Mockito.verify(mockSession).send(inboundFixMessage);
    }
   
    @Test
    public void processInOnlyExchangeSendUnsuccessful() throws Exception {
        Session mockSession = Mockito.spy(TestSupport.createSession(sessionID));
        Mockito.doReturn(mockSession).when(producer).getSession(MessageUtils.getSessionID(inboundFixMessage));
        Mockito.doReturn(false).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

               
        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

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.