use of quickfix.LogFactory in project camel by apache.
the class QuickfixjEngineTest method useExplicitComponentImplementations.
@Test
public void useExplicitComponentImplementations() throws Exception {
settings.setString(SLF4JLogFactory.SETTING_EVENT_CATEGORY, "Events");
settings.setString(sessionID, SessionFactory.SETTING_CONNECTION_TYPE, SessionFactory.INITIATOR_CONNECTION_TYPE);
writeSettings();
MessageStoreFactory messageStoreFactory = Mockito.mock(MessageStoreFactory.class);
LogFactory logFactory = Mockito.mock(LogFactory.class);
MessageFactory messageFactory = Mockito.mock(MessageFactory.class);
quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), messageStoreFactory, logFactory, messageFactory);
assertThat(quickfixjEngine.getMessageStoreFactory(), is(messageStoreFactory));
assertThat(quickfixjEngine.getLogFactory(), is(logFactory));
assertThat(quickfixjEngine.getMessageFactory(), is(messageFactory));
}
use of quickfix.LogFactory in project camel by apache.
the class QuickfixjEngine method inferLogFactory.
private LogFactory inferLogFactory(SessionSettings settings) throws ConfigError {
Set<LogFactory> impliedLogFactories = new HashSet<LogFactory>();
isFileLog(settings, impliedLogFactories);
isScreenLog(settings, impliedLogFactories);
isSL4JLog(settings, impliedLogFactories);
isJdbcLog(settings, impliedLogFactories);
if (impliedLogFactories.size() > 1) {
throw new ConfigError("Ambiguous log factory implied in configuration");
}
LogFactory sessionLogFactory;
if (impliedLogFactories.size() == 1) {
sessionLogFactory = impliedLogFactories.iterator().next();
} else {
// Default
sessionLogFactory = new ScreenLogFactory(settings);
}
LOG.info("Inferring log factory: {}", sessionLogFactory.getClass().getName());
return sessionLogFactory;
}
Aggregations