Search in sources :

Example 1 with LogFactory

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));
}
Also used : ScreenLogFactory(quickfix.ScreenLogFactory) LogFactory(quickfix.LogFactory) SLF4JLogFactory(quickfix.SLF4JLogFactory) JdbcLogFactory(quickfix.JdbcLogFactory) FileLogFactory(quickfix.FileLogFactory) MessageFactory(quickfix.MessageFactory) DefaultMessageFactory(quickfix.DefaultMessageFactory) MessageStoreFactory(quickfix.MessageStoreFactory) Test(org.junit.Test)

Example 2 with LogFactory

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;
}
Also used : SLF4JLogFactory(quickfix.SLF4JLogFactory) ScreenLogFactory(quickfix.ScreenLogFactory) JdbcLogFactory(quickfix.JdbcLogFactory) FileLogFactory(quickfix.FileLogFactory) LogFactory(quickfix.LogFactory) ConfigError(quickfix.ConfigError) ScreenLogFactory(quickfix.ScreenLogFactory) HashSet(java.util.HashSet)

Aggregations

FileLogFactory (quickfix.FileLogFactory)2 JdbcLogFactory (quickfix.JdbcLogFactory)2 LogFactory (quickfix.LogFactory)2 SLF4JLogFactory (quickfix.SLF4JLogFactory)2 ScreenLogFactory (quickfix.ScreenLogFactory)2 HashSet (java.util.HashSet)1 Test (org.junit.Test)1 ConfigError (quickfix.ConfigError)1 DefaultMessageFactory (quickfix.DefaultMessageFactory)1 MessageFactory (quickfix.MessageFactory)1 MessageStoreFactory (quickfix.MessageStoreFactory)1