You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cm...@apache.org on 2012/04/25 23:43:58 UTC
svn commit: r1330573 - in
/camel/branches/camel-2.9.x/components/camel-quickfix/src:
main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
Author: cmueller
Date: Wed Apr 25 21:43:58 2012
New Revision: 1330573
URL: http://svn.apache.org/viewvc?rev=1330573&view=rev
Log:
CAMEL-5220: Using JdbcDataSourceName with Quickfix component
Modified:
camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
camel/branches/camel-2.9.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
Modified: camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java?rev=1330573&r1=1330572&r2=1330573&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java (original)
+++ camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java Wed Apr 25 21:43:58 2012
@@ -286,7 +286,7 @@ public class QuickfixjEngine {
}
private void isJdbcStore(SessionSettings settings, Set<MessageStoreFactory> impliedMessageStoreFactories) {
- if (settings.isSetting(JdbcSetting.SETTING_JDBC_DRIVER)) {
+ if (settings.isSetting(JdbcSetting.SETTING_JDBC_DRIVER) || settings.isSetting(JdbcSetting.SETTING_JDBC_DS_NAME)) {
impliedMessageStoreFactories.add(new JdbcStoreFactory(settings));
}
}
@@ -326,7 +326,8 @@ public class QuickfixjEngine {
}
private void isJdbcLog(SessionSettings settings, Set<LogFactory> impliedLogFactories) {
- if (settings.isSetting(JdbcSetting.SETTING_JDBC_DRIVER) && settings.isSetting(JdbcSetting.SETTING_LOG_EVENT_TABLE)) {
+ if ((settings.isSetting(JdbcSetting.SETTING_JDBC_DRIVER) || settings.isSetting(JdbcSetting.SETTING_JDBC_DS_NAME))
+ && settings.isSetting(JdbcSetting.SETTING_LOG_EVENT_TABLE)) {
impliedLogFactories.add(new JdbcLogFactory(settings));
}
}
Modified: camel/branches/camel-2.9.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java?rev=1330573&r1=1330572&r2=1330573&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java (original)
+++ camel/branches/camel-2.9.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java Wed Apr 25 21:43:58 2012
@@ -231,6 +231,25 @@ public class QuickfixjEngineTest {
assertThat(quickfixjEngine.getLogFactory(), instanceOf(JdbcLogFactory.class));
assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class));
}
+
+ @Test
+ public void inferJdbcStoreViaJNDI() throws Exception {
+ // If there is a setting of the LOG_EVENT_TABLE, we should create a jdbcLogFactory for it
+ settings.setString(JdbcSetting.SETTING_JDBC_DS_NAME, "ds_name");
+ settings.setString(JdbcSetting.SETTING_LOG_EVENT_TABLE, "table");
+
+ settings.setString(sessionID, SessionFactory.SETTING_CONNECTION_TYPE, SessionFactory.INITIATOR_CONNECTION_TYPE);
+
+ writeSettings();
+
+ quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName(), false);
+
+ assertThat(quickfixjEngine.getInitiator(), notNullValue());
+ assertThat(quickfixjEngine.getAcceptor(), nullValue());
+ assertThat(quickfixjEngine.getMessageStoreFactory(), instanceOf(JdbcStoreFactory.class));
+ assertThat(quickfixjEngine.getLogFactory(), instanceOf(JdbcLogFactory.class));
+ assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class));
+ }
@Test
public void ambiguousMessageStore() throws Exception {