use of quickfix.SessionID in project camel by apache.
the class QuickfixjConvertersTest method convertMessageWithRepeatingGroupsUsingExchangeDictionaryResource.
@Test
public void convertMessageWithRepeatingGroupsUsingExchangeDictionaryResource() throws Exception {
SessionID sessionID = new SessionID("FIX.4.4", "FOO", "BAR");
createSession(sessionID);
try {
String data = "8=FIX.4.4\0019=40\00135=A\001" + "627=2\001628=FOO\001628=BAR\001" + "98=0\001384=2\001372=D\001385=R\001372=8\001385=S\00110=230\001";
Exchange exchange = new DefaultExchange(context);
exchange.setProperty(QuickfixjEndpoint.DATA_DICTIONARY_KEY, "FIX44.xml");
exchange.getIn().setBody(data);
Message message = exchange.getIn().getBody(Message.class);
NoHops hop = new NoHops();
message.getHeader().getGroup(1, hop);
assertEquals("FOO", hop.getString(HopCompID.FIELD));
message.getHeader().getGroup(2, hop);
assertEquals("BAR", hop.getString(HopCompID.FIELD));
} finally {
quickfixjEngine.stop();
}
}
use of quickfix.SessionID in project camel by apache.
the class QuickfixjConvertersTest method convertToExchange.
@Test
public void convertToExchange() {
SessionID sessionID = new SessionID("FIX.4.0", "FOO", "BAR");
QuickfixjEndpoint endpoint = new QuickfixjEndpoint(null, "", new QuickfixjComponent());
Message message = new Message();
message.getHeader().setString(MsgType.FIELD, MsgType.ORDER_SINGLE);
Exchange exchange = QuickfixjConverters.toExchange(endpoint, sessionID, message, QuickfixjEventCategory.AppMessageSent);
assertThat((SessionID) exchange.getIn().getHeader(QuickfixjEndpoint.SESSION_ID_KEY), is(sessionID));
assertThat((QuickfixjEventCategory) exchange.getIn().getHeader(QuickfixjEndpoint.EVENT_CATEGORY_KEY), is(QuickfixjEventCategory.AppMessageSent));
assertThat((String) exchange.getIn().getHeader(QuickfixjEndpoint.MESSAGE_TYPE_KEY), is(MsgType.ORDER_SINGLE));
}
use of quickfix.SessionID in project camel by apache.
the class QuickfixjConvertersTest method convertToExchangeWithNullMessage.
@Test
public void convertToExchangeWithNullMessage() {
SessionID sessionID = new SessionID("FIX.4.0", "FOO", "BAR");
QuickfixjEndpoint endpoint = new QuickfixjEndpoint(null, "", new QuickfixjComponent());
Exchange exchange = QuickfixjConverters.toExchange(endpoint, sessionID, null, QuickfixjEventCategory.AppMessageSent);
assertThat((SessionID) exchange.getIn().getHeader(QuickfixjEndpoint.SESSION_ID_KEY), is(sessionID));
assertThat((QuickfixjEventCategory) exchange.getIn().getHeader(QuickfixjEndpoint.EVENT_CATEGORY_KEY), is(QuickfixjEventCategory.AppMessageSent));
assertThat(exchange.getIn().getHeader(QuickfixjEndpoint.MESSAGE_TYPE_KEY), is(nullValue()));
}
use of quickfix.SessionID in project camel by apache.
the class QuickfixjConvertersTest method convertMessageWithRepeatingGroupsUsingExchangeDictionary.
@Test
public void convertMessageWithRepeatingGroupsUsingExchangeDictionary() throws Exception {
SessionID sessionID = new SessionID("FIX.4.4", "FOO", "BAR");
createSession(sessionID);
try {
String data = "8=FIX.4.4\0019=40\00135=A\001" + "627=2\001628=FOO\001628=BAR\001" + "98=0\001384=2\001372=D\001385=R\001372=8\001385=S\00110=230\001";
Exchange exchange = new DefaultExchange(context);
exchange.setProperty(QuickfixjEndpoint.DATA_DICTIONARY_KEY, new DataDictionary("FIX44.xml"));
exchange.getIn().setBody(data);
Message message = exchange.getIn().getBody(Message.class);
NoHops hop = new NoHops();
message.getHeader().getGroup(1, hop);
assertEquals("FOO", hop.getString(HopCompID.FIELD));
message.getHeader().getGroup(2, hop);
assertEquals("BAR", hop.getString(HopCompID.FIELD));
} finally {
quickfixjEngine.stop();
}
}
use of quickfix.SessionID in project camel by apache.
the class QuickfixjConvertersTest method convertMessageWithRepeatingGroupsUsingSessionID.
@Test
public void convertMessageWithRepeatingGroupsUsingSessionID() throws Exception {
SessionID sessionID = new SessionID("FIX.4.4", "FOO", "BAR");
createSession(sessionID);
try {
String data = "8=FIX.4.4\0019=40\00135=A\001" + "627=2\001628=FOO\001628=BAR\001" + "98=0\001384=2\001372=D\001385=R\001372=8\001385=S\00110=230\001";
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setHeader(QuickfixjEndpoint.SESSION_ID_KEY, sessionID);
exchange.getIn().setBody(data);
Message message = exchange.getIn().getBody(Message.class);
NoHops hop = new NoHops();
message.getHeader().getGroup(1, hop);
assertEquals("FOO", hop.getString(HopCompID.FIELD));
message.getHeader().getGroup(2, hop);
assertEquals("BAR", hop.getString(HopCompID.FIELD));
} finally {
quickfixjEngine.stop();
}
}
Aggregations