Package quickfix.fix42

Examples of quickfix.fix42.NewOrderSingle


    private static final String CHECKSUM        = "67890";
    private static final String TX_DATE         = new Date().toString();
    private static final String SESSION_ID      = "FIX.4.1:BANZAI->SYNAPSE";

    public void testSimpleFIXMessage() throws Exception {
        Message message = new NewOrderSingle();
        message.getHeader().setField(new BeginString(BEGIN_STRING));
        message.getHeader().setField(new SenderCompID(SENDER_ID));
        message.getHeader().setField(new TargetCompID(TARGET_ID));
        message.getHeader().setField(new MsgSeqNum(SEQ_NUM));

        message.setField(new Symbol(SYMBOL));
        message.setField(new ClOrdID(CLORD_ID));
        message.setField(new TradeOriginationDate(TX_DATE));

        message.getTrailer().setField(new CheckSum(CHECKSUM));

        MessageContext msgCtx = new MessageContext();
        FIXUtils.getInstance().setSOAPEnvelope(message, SEQ_NUM, SESSION_ID, msgCtx);
        String result = msgCtx.getEnvelope().getBody().getFirstElement().toString();
        String expected =
View Full Code Here


        assertXMLEqual(expected, AXIOMUtil.stringToOM(result).toString());       
    }

    public void testAdvancedFIXMessage() throws Exception {
        Message message = new NewOrderSingle();
        message.getHeader().setField(new BeginString(BEGIN_STRING));
        message.getHeader().setField(new SenderCompID(SENDER_ID));
        message.getHeader().setField(new TargetCompID(TARGET_ID));
        message.getHeader().setField(new MsgSeqNum(SEQ_NUM));

        message.setField(new Symbol(SYMBOL));
        message.setField(new ClOrdID(CLORD_ID));
        message.setField(new TradeOriginationDate(TX_DATE));

        Group g1 = new Group(NoAllocs.FIELD, AllocAccount.FIELD);
        g1.setField(new AllocAccount("ABC"));
        g1.setField(new IndividualAllocID("PQR"));
        message.addGroup(g1);
        Group g2 = new Group(NoAllocs.FIELD, AllocAccount.FIELD);
        g2.setField(new AllocAccount("MNO"));
        g2.setField(new IndividualAllocID("XYZ"));
        message.addGroup(g2);

        message.getTrailer().setField(new CheckSum(CHECKSUM));

        MessageContext msgCtx = new MessageContext();
        FIXUtils.getInstance().setSOAPEnvelope(message, SEQ_NUM, SESSION_ID, msgCtx);
        String result = msgCtx.getEnvelope().getBody().getFirstElement().toString();
        String expected =
View Full Code Here

                }
            }
        };

        quickfixjEngine.addEventListener(messageListener);
        Email email = TestSupport.createEmailMessage("Test");
        Session.sendToTarget(email, initiatorSessionID);

        assertTrue("Application message not received", messageLatch.await(5000, TimeUnit.MILLISECONDS));
        quickfixjEngine.removeEventListener(messageListener);
View Full Code Here

            1000L, Long.class)).thenReturn(5000L);
               
        org.apache.camel.Message mockOutboundCamelMessage = Mockito.mock(org.apache.camel.Message.class);
        Mockito.when(mockExchange.getOut()).thenReturn(mockOutboundCamelMessage);
       
        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
View Full Code Here

        sessionSettings.setString(sessionID, SessionSettings.SENDERCOMPID, sessionID.getSenderCompID());
        sessionSettings.setString(sessionID, SessionSettings.TARGETCOMPID, sessionID.getTargetCompID());
    }

    public static Email createEmailMessage(String subject) {
        Email email = new Email(new EmailThreadID("ID"), new EmailType(EmailType.NEW), new Subject(subject));
        Email.LinesOfText text = new Email.LinesOfText();
        text.set(new Text("Content"));
        email.addGroup(text);
        return email;
    }
View Full Code Here

                }
            }
        };

        quickfixjEngine.addEventListener(messageListener);
        Email email = TestSupport.createEmailMessage("Test");
        Session.sendToTarget(email, initiatorSessionID);

        assertTrue("Application message not received", messageLatch.await(5000, TimeUnit.MILLISECONDS));
        quickfixjEngine.removeEventListener(messageListener);
View Full Code Here

                }
            }
        };

        quickfixjEngine.addEventListener(messageListener);
        Email email = TestSupport.createEmailMessage("Test");
        Session.sendToTarget(email, initiatorSessionID);

        assertTrue("Application message not received", messageLatch.await(5000, TimeUnit.MILLISECONDS));
        quickfixjEngine.removeEventListener(messageListener);
View Full Code Here

                }
            }
        };

        quickfixjEngine.addEventListener(messageListener);
        Email email = TestSupport.createEmailMessage("Test");
        Session.sendToTarget(email, initiatorSessionID);

        assertTrue("Application message not received", messageLatch.await(5000, TimeUnit.MILLISECONDS));
        quickfixjEngine.removeEventListener(messageListener);
View Full Code Here

                }
            }
        };

        quickfixjEngine.addEventListener(messageListener);
        Email email = TestSupport.createEmailMessage("Test");
        Session.sendToTarget(email, initiatorSessionID);

        assertTrue("Application message not received", messageLatch.await(5000, TimeUnit.MILLISECONDS));
        quickfixjEngine.removeEventListener(messageListener);
View Full Code Here

            1000L, Long.class)).thenReturn(5000L);
               
        org.apache.camel.Message mockOutboundCamelMessage = Mockito.mock(org.apache.camel.Message.class);
        Mockito.when(mockExchange.getOut()).thenReturn(mockOutboundCamelMessage);
       
        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
View Full Code Here

TOP

Related Classes of quickfix.fix42.NewOrderSingle

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.