svn commit: r1399815 - in /camel/branches/camel-2.9.x: ./ components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java components/camel-blueprint/src/main/java/org/ap
Author: davsclaus Date: Thu Oct 18 19:42:34 2012 New Revision: 1399815 URL: http://svn.apache.org/viewvc?rev=1399815&view=rev Log: CAMEL-5712: Fixed camel-blueprint to use a service listener to defer starting BlueprintCamelContext until after the BlueprintContainer is fully finished and has enlisted itself as service. This fixes among others using packageScan with blueprint. Modified: camel/branches/camel-2.9.x/ (props changed) camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java Propchange: camel/branches/camel-2.9.x/ -- Merged /camel/trunk:r1399808 Merged /camel/branches/camel-2.10.x:r1399809 Propchange: camel/branches/camel-2.9.x/ -- Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java?rev=1399815&r1=1399814&r2=1399815&view=diff == --- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java (original) +++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java Thu Oct 18 19:42:34 2012 @@ -29,11 +29,13 @@ import org.apache.camel.impl.DefaultCame import org.apache.camel.spi.FactoryFinder; import org.apache.camel.spi.Registry; import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceEvent; +import org.osgi.framework.ServiceListener; import org.osgi.service.blueprint.container.BlueprintContainer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class BlueprintCamelContext extends DefaultCamelContext { +public class BlueprintCamelContext extends DefaultCamelContext implements ServiceListener { private static final transient Logger LOG = LoggerFactory.getLogger(BlueprintCamelContext.class); @@ -73,30 +75,34 @@ public class BlueprintCamelContext exten } public void init() throws Exception { -final ClassLoader original = Thread.currentThread().getContextClassLoader(); -try { -// let's set a more suitable TCCL while starting the context - Thread.currentThread().setContextClassLoader(getApplicationContextClassLoader()); -maybeStart(); -} finally { -Thread.currentThread().setContextClassLoader(original); -} -} - -private void maybeStart() throws Exception { -if (!isStarted() && !isStarting()) { -start(); -} else { -// ignore as Camel is already started -LOG.trace("Ignoring maybeStart() as Apache Camel is already started"); -} +// add service listener so we can be notified when blueprint container is done +// and we would be ready to start CamelContext +bundleContext.addServiceListener(this); } public void destroy() throws Exception { +// remove listener and stop this CamelContext +bundleContext.removeServiceListener(this); stop(); } @Override +public void serviceChanged(ServiceEvent event) { +if (LOG.isDebugEnabled()) { +LOG.debug("Service {} changed to {}", event, event.getType()); +} +// look for blueprint container to be registered, and then we can start the CamelContext +if (event.getType() == ServiceEvent.REGISTERED && event.getServiceReference().isAssignableTo(bundleContext.getBundle(), +"org.osgi.service.blueprint.container.BlueprintContainer")) { +try { +maybeStart(); +} catch (Exception e) { +LOG.warn("Error occurred during starting " + this, e); +} +} +} + +@Override protected TypeConverter createTypeConverter() { // CAMEL-3614: make sure we use a bundle context which imports org.apache.camel.impl.converter package BundleContext ctx = BundleContextUtils.getBundleContext(getClass()); @@ -113,4 +119,20 @@ public class BlueprintCamelContext exten return OsgiCamelContextHelper.wrapRegistry(this, reg, bundleContext); } +private void maybeStart() throws Exception { +if (!isStarted() && !isStarting()) { +final ClassLoader original = Thread.currentThread().getContextClassLoader(); +try { +// let's set a more suitable TCCL whil
svn commit: r1399809 - in /camel/branches/camel-2.10.x: ./ components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ components/camel-test-blueprint/src/test/java/org/apache/camel/test/blue
Author: davsclaus Date: Thu Oct 18 19:31:46 2012 New Revision: 1399809 URL: http://svn.apache.org/viewvc?rev=1399809&view=rev Log: CAMEL-5712: Fixed camel-blueprint to use a service listener to defer starting BlueprintCamelContext until after the BlueprintContainer is fully finished and has enlisted itself as service. This fixes among others using packageScan with blueprint. Added: camel/branches/camel-2.10.x/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScanTest.java - copied unchanged from r1399808, camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScanTest.java camel/branches/camel-2.10.x/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/scan/ - copied from r1399808, camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/scan/ camel/branches/camel-2.10.x/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan.xml - copied unchanged from r1399808, camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan.xml Modified: camel/branches/camel-2.10.x/ (props changed) camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java Propchange: camel/branches/camel-2.10.x/ -- Merged /camel/trunk:r1399808 Propchange: camel/branches/camel-2.10.x/ -- Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java?rev=1399809&r1=1399808&r2=1399809&view=diff == --- camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java (original) +++ camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java Thu Oct 18 19:31:46 2012 @@ -26,11 +26,13 @@ import org.apache.camel.impl.DefaultCame import org.apache.camel.spi.FactoryFinder; import org.apache.camel.spi.Registry; import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceEvent; +import org.osgi.framework.ServiceListener; import org.osgi.service.blueprint.container.BlueprintContainer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class BlueprintCamelContext extends DefaultCamelContext { +public class BlueprintCamelContext extends DefaultCamelContext implements ServiceListener { private static final transient Logger LOG = LoggerFactory.getLogger(BlueprintCamelContext.class); @@ -71,30 +73,34 @@ public class BlueprintCamelContext exten } public void init() throws Exception { -final ClassLoader original = Thread.currentThread().getContextClassLoader(); -try { -// let's set a more suitable TCCL while starting the context - Thread.currentThread().setContextClassLoader(getApplicationContextClassLoader()); -maybeStart(); -} finally { -Thread.currentThread().setContextClassLoader(original); -} -} - -private void maybeStart() throws Exception { -if (!isStarted() && !isStarting()) { -start(); -} else { -// ignore as Camel is already started -LOG.trace("Ignoring maybeStart() as Apache Camel is already started"); -} +// add service listener so we can be notified when blueprint container is done +// and we would be ready to start CamelContext +bundleContext.addServiceListener(this); } public void destroy() throws Exception { +// remove listener and stop this CamelContext +bundleContext.removeServiceListener(this); stop(); } @Override +public void serviceChanged(ServiceEvent event) { +if (LOG.isDebugEnabled()) { +LOG.debug("Service {} changed to {}", event, event.getType()); +} +// look for blueprint container to be registered, and then we can start the CamelContext +if (event.getType() == ServiceEvent.REGISTERED && event.getServiceReference().isAssignableTo(bundleContext.getBundle(), +"org.osgi.service.blueprint.container.BlueprintContainer")) { +try { +maybeStart(); +}
svn commit: r1399682 - in /camel/branches/camel-2.10.x: ./ parent/ tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/ tooling/archetypes/camel-archetype-blueprint/src/
Author: davsclaus Date: Thu Oct 18 14:48:24 2012 New Revision: 1399682 URL: http://svn.apache.org/viewvc?rev=1399682&view=rev Log: added resources plugin to the archetypes to avoid eclipse m2e errors when importing the archetype genearted project Modified: camel/branches/camel-2.10.x/ (props changed) camel/branches/camel-2.10.x/parent/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-component-scala/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/pom.xml camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/pom.xml Propchange: camel/branches/camel-2.10.x/ -- Merged /camel/trunk:r1399664 Propchange: camel/branches/camel-2.10.x/ -- Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.10.x/parent/pom.xml URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/parent/pom.xml?rev=1399682&r1=1399681&r2=1399682&view=diff == --- camel/branches/camel-2.10.x/parent/pom.xml (original) +++ camel/branches/camel-2.10.x/parent/pom.xml Thu Oct 18 14:48:24 2012 @@ -133,6 +133,7 @@ 1.3 1.2.17 3.6.0 +2.4.3 1.1.7 2.0.7 1.9.0 Modified: camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml?rev=1399682&r1=1399681&r2=1399682&view=diff == --- camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml (original) +++ camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml Thu Oct 18 14:48:24 2012 @@ -108,6 +108,14 @@ 1.6 + +org.apache.maven.plugins +maven-resources-plugin +${maven-resources-plugin-version} + + UTF-8 + + Modified: camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml?rev=1399682&r1=1399681&r2=1399682&view=diff == --- camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml (original) +++ camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml Thu Oct 18 14:48:24 2012 @@ -88,6 +88,14 @@ 1.6 + +org.apache.maven.plugins +maven-resources-plugin +${maven-resources-plugin-version} + + UTF-8 + + Modified: camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-component-scala/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-component-scala/src/main/resources/archetype-resources/pom.xml?rev=1399682&r1=1399681&r2=1399682&view=diff == --- camel/branches/camel-2.10.x/tooling/archetypes/camel-archetype-component-scala/src/main/resources/archetype-resources/pom.xml (original) +++ camel/branches/camel-2.10.x/tooling/
svn commit: r1399674 - /camel/trunk/components/camel-quickfix/src/test/resources/log4j.properties
Author: bvahdat Date: Thu Oct 18 14:25:12 2012 New Revision: 1399674 URL: http://svn.apache.org/viewvc?rev=1399674&view=rev Log: To track the failed tests by QuickfixjEngineTest from time to time on JDK 7, temporarily write the logs into the console Modified: camel/trunk/components/camel-quickfix/src/test/resources/log4j.properties Modified: camel/trunk/components/camel-quickfix/src/test/resources/log4j.properties URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/resources/log4j.properties?rev=1399674&r1=1399673&r2=1399674&view=diff == --- camel/trunk/components/camel-quickfix/src/test/resources/log4j.properties (original) +++ camel/trunk/components/camel-quickfix/src/test/resources/log4j.properties Thu Oct 18 14:25:12 2012 @@ -18,7 +18,7 @@ # # The logging properties used for eclipse testing, We want to see debug output on the console. # -log4j.rootLogger=INFO, file +log4j.rootLogger=INFO, out # uncomment the following to enable camel debugging #log4j.logger.org.apache.camel=DEBUG
svn commit: r1399672 - /camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
Author: bvahdat Date: Thu Oct 18 14:22:03 2012 New Revision: 1399672 URL: http://svn.apache.org/viewvc?rev=1399672&view=rev Log: Reformattings. Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java?rev=1399672&r1=1399671&r2=1399672&view=diff == --- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java (original) +++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java Thu Oct 18 14:22:03 2012 @@ -91,7 +91,7 @@ public class QuickfixjEngineTest extends public void setUp() throws Exception { settingsFile = File.createTempFile("quickfixj_test_", ".cfg"); tempdir = settingsFile.getParentFile(); -URL[] urls = new URL[]{tempdir.toURI().toURL()}; +URL[] urls = new URL[] {tempdir.toURI().toURL()}; contextClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader testClassLoader = new URLClassLoader(urls, contextClassLoader); @@ -219,7 +219,7 @@ public class QuickfixjEngineTest extends // If there is a setting of the LOG_EVENT_TABLE, we should create a jdbcLogFactory for it settings.setString(JdbcSetting.SETTING_JDBC_DRIVER, "driver"); settings.setString(JdbcSetting.SETTING_LOG_EVENT_TABLE, "table"); - + settings.setString(sessionID, SessionFactory.SETTING_CONNECTION_TYPE, SessionFactory.INITIATOR_CONNECTION_TYPE); writeSettings(); @@ -232,13 +232,13 @@ public class QuickfixjEngineTest extends 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(); @@ -270,7 +270,7 @@ public class QuickfixjEngineTest extends settings.setString(sessionID, SessionFactory.SETTING_CONNECTION_TYPE, SessionFactory.INITIATOR_CONNECTION_TYPE); writeSettings(); - + quickfixjEngine = new QuickfixjEngine("quickfix:test", settingsFile.getName()); assertThat(quickfixjEngine.getInitiator(), notNullValue()); @@ -327,7 +327,7 @@ public class QuickfixjEngineTest extends assertThat(quickfixjEngine.getLogFactory(), instanceOf(SLF4JLogFactory.class)); assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class)); } - + @Test public void ambiguousLog() throws Exception { settings.setString(FileLogFactory.SETTING_FILE_LOG_PATH, tempdir.toString()); @@ -358,9 +358,9 @@ public class QuickfixjEngineTest extends 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)); @@ -412,15 +412,13 @@ public class QuickfixjEngineTest extends doLogoffEventsTest(acceptorSessionID, initiatorSessionID, quickfixjEngine); } -private void doLogonEventsTest(SessionID acceptorSessionID, SessionID initiatorSessionID, QuickfixjEngine quickfixjEngine) -throws Exception { +private void doLogonEventsTest(SessionID acceptorSessionID, SessionID initiatorSessionID, QuickfixjEngine quickfixjEngine) throws Exception { final List events = new ArrayList(); final CountDownLatch logonLatch = new CountDownLatch(2); QuickfixjEventListener logonListener = new QuickfixjEventListener() { -public synchronized void onEvent(QuickfixjEventCategory eventCategory, -SessionID sessionID, Message message) { +publi
svn commit: r1399664 - in /camel/trunk: parent/ tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/ tooling/archetypes/camel-archetype-blueprint/src/main/resources/arch
Author: jstrachan Date: Thu Oct 18 13:55:22 2012 New Revision: 1399664 URL: http://svn.apache.org/viewvc?rev=1399664&view=rev Log: added resources plugin to the archetypes to avoid eclipse m2e errors when importing the archetype genearted project Modified: camel/trunk/parent/pom.xml camel/trunk/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-component-scala/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/pom.xml camel/trunk/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/pom.xml Modified: camel/trunk/parent/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1399664&r1=1399663&r2=1399664&view=diff == --- camel/trunk/parent/pom.xml (original) +++ camel/trunk/parent/pom.xml Thu Oct 18 13:55:22 2012 @@ -223,6 +223,7 @@ 3.6.1 0.0.4 +2.4.3 2.2.1 2.0.5 2.0 @@ -2076,7 +2077,7 @@ org.apache.maven.plugins maven-resources-plugin - 2.4.3 + ${maven-resources-plugin-version} UTF-8 Modified: camel/trunk/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml?rev=1399664&r1=1399663&r2=1399664&view=diff == --- camel/trunk/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml (original) +++ camel/trunk/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml Thu Oct 18 13:55:22 2012 @@ -108,6 +108,14 @@ 1.6 + +org.apache.maven.plugins +maven-resources-plugin +${maven-resources-plugin-version} + + UTF-8 + + Modified: camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml?rev=1399664&r1=1399663&r2=1399664&view=diff == --- camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml (original) +++ camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml Thu Oct 18 13:55:22 2012 @@ -88,6 +88,14 @@ 1.6 + +org.apache.maven.plugins +maven-resources-plugin +${maven-resources-plugin-version} + + UTF-8 + + Modified: camel/trunk/tooling/archetypes/camel-archetype-component-scala/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-component-scala/src/main/resources/archetype-resources/pom.xml?rev=1399664&r1=1399663&r2=1399664&view=diff == --- camel/trunk/tooling/archetypes/camel-archetype-component-scala/src/main/resources/archetype-resources/pom.xml (original) +++ camel/trunk/tooling/archetypes/camel-archetype-component-scala/src/main/resources/archetype-resources/pom.xml Thu Oct 18 13:55:22 2012 @@ -97,6 +97,14 @@ 1.6 + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin-version} + +UTF-8 + + net.alchim31.maven Modified: camel/trunk/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/t
svn commit: r1399659 - /camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
Author: bvahdat Date: Thu Oct 18 13:22:51 2012 New Revision: 1399659 URL: http://svn.apache.org/viewvc?rev=1399659&view=rev Log: Polished. Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java?rev=1399659&r1=1399658&r2=1399659&view=diff == --- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java (original) +++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java Thu Oct 18 13:22:51 2012 @@ -535,7 +535,7 @@ public class QuickfixjEngineTest extends int result = 1; result = prime * result + ((eventCategory == null) ? 0 : eventCategory.hashCode()); result = prime * result + ((sessionID == null) ? 0 : sessionID.hashCode()); -// don't take message into the account as otherwise we would break the expected java.lang.Object.equals() contract +result = prime * result + (message == null ? 1231 : 1237); return result; } @@ -571,7 +571,7 @@ public class QuickfixjEngineTest extends assertThat(quickfixjEngine.getLogFactory(), instanceOf(ScreenLogFactory.class)); assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class)); MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); -Set names = mbeanServer.queryNames(new ObjectName("org.quickfixj:*"), null); +Set names = mbeanServer.queryNames(new ObjectName("org.quickfixj:type=Connector,role=Acceptor,*"), null); assertTrue("QFJ mbean should not have been registered", names.isEmpty()); }
svn commit: r1399655 - /camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java
Author: bvahdat Date: Thu Oct 18 13:11:40 2012 New Revision: 1399655 URL: http://svn.apache.org/viewvc?rev=1399655&view=rev Log: Polished. Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java?rev=1399655&r1=1399654&r2=1399655&view=diff == --- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java (original) +++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java Thu Oct 18 13:11:40 2012 @@ -25,12 +25,11 @@ import javax.management.JMException; import org.apache.camel.Exchange; import org.apache.camel.component.quickfixj.converter.QuickfixjConverters; -import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.DefaultExchange; +import org.apache.camel.test.junit4.CamelTestSupport; import org.apache.mina.common.TransportType; import org.junit.After; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import quickfix.Acceptor; @@ -49,12 +48,8 @@ import quickfix.fix44.Message.Header.NoH import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - -public class QuickfixjConvertersTest { -private static DefaultCamelContext camelContext; +public class QuickfixjConvertersTest extends CamelTestSupport { private File settingsFile; private ClassLoader contextClassLoader; private SessionSettings settings; @@ -62,13 +57,10 @@ public class QuickfixjConvertersTest { private QuickfixjEngine quickfixjEngine; -@BeforeClass -public static void classSetUp() throws Exception { -camelContext = new DefaultCamelContext(); -} - @Before public void setUp() throws Exception { +super.setUp(); + settingsFile = File.createTempFile("quickfixj_test_", ".cfg"); tempdir = settingsFile.getParentFile(); URL[] urls = new URL[] {tempdir.toURI().toURL()}; @@ -81,25 +73,26 @@ public class QuickfixjConvertersTest { settings.setString(Acceptor.SETTING_SOCKET_ACCEPT_PROTOCOL, TransportType.VM_PIPE.toString()); settings.setString(Initiator.SETTING_SOCKET_CONNECT_PROTOCOL, TransportType.VM_PIPE.toString()); } - + @After public void tearDown() throws Exception { -Thread.currentThread().setContextClassLoader(contextClassLoader); +Thread.currentThread().setContextClassLoader(contextClassLoader); + +super.tearDown(); } @Test public void convertSessionID() { -Object value = camelContext.getTypeConverter().convertTo(SessionID.class, "FIX.4.0:FOO->BAR"); +Object value = context.getTypeConverter().convertTo(SessionID.class, "FIX.4.0:FOO->BAR"); assertThat(value, instanceOf(SessionID.class)); assertThat((SessionID)value, is(new SessionID("FIX.4.0", "FOO", "BAR"))); } -@SuppressWarnings("deprecation") @Test public void convertToExchange() { SessionID sessionID = new SessionID("FIX.4.0", "FOO", "BAR"); -QuickfixjEndpoint endpoint = new QuickfixjEndpoint(null, "", camelContext); +QuickfixjEndpoint endpoint = new QuickfixjEndpoint(null, "", new QuickfixjComponent()); Message message = new Message(); message.getHeader().setString(MsgType.FIELD, MsgType.ORDER_SINGLE); @@ -114,11 +107,10 @@ public class QuickfixjConvertersTest { assertThat((String)exchange.getIn().getHeader(QuickfixjEndpoint.MESSAGE_TYPE_KEY), is(MsgType.ORDER_SINGLE)); } -@SuppressWarnings("deprecation") @Test public void convertToExchangeWithNullMessage() { SessionID sessionID = new SessionID("FIX.4.0", "FOO", "BAR"); -QuickfixjEndpoint endpoint = new QuickfixjEndpoint(null, "", camelContext); +QuickfixjEndpoint endpoint = new QuickfixjEndpoint(null, "", new QuickfixjComponent()); Exchange exchange = QuickfixjConverters.toExchange(endpoint, sessionID, null, QuickfixjEventCategory.AppMessageSent); @@ -135,8 +127,8 @@ public class QuickfixjConvertersTest { String data = "8=FIX.4.0\0019=100\00135=D\00134=2\00149=TW\00156=ISLD\00111=ID\00121=1\001" + "40=1\00154=1\00140=2\00138=200\00155=INTC\00110=160\001"; -Exchange exchange = new DefaultExchange(camelContext); -
svn commit: r1399634 - /camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
Author: bvahdat Date: Thu Oct 18 12:44:41 2012 New Revision: 1399634 URL: http://svn.apache.org/viewvc?rev=1399634&view=rev Log: Polished Modified: camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java Modified: camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java?rev=1399634&r1=1399633&r2=1399634&view=diff == --- camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java (original) +++ camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java Thu Oct 18 12:44:41 2012 @@ -96,7 +96,7 @@ public class QuickfixjEngine extends Ser private final MessageCorrelator messageCorrelator = new MessageCorrelator(); private List eventListeners = new CopyOnWriteArrayList(); private final String uri; -private ObjectName connectorObjectName; +private ObjectName initiatorObjectName; public enum ThreadModel { ThreadPerConnector, ThreadPerSession; @@ -228,7 +228,7 @@ public class QuickfixjEngine extends Ser if (initiator != null) { initiator.start(); if (jmxExporter != null) { -connectorObjectName = jmxExporter.register(initiator); +initiatorObjectName = jmxExporter.register(initiator); } } } @@ -241,8 +241,8 @@ public class QuickfixjEngine extends Ser if (initiator != null) { initiator.stop(); -if (jmxExporter != null && connectorObjectName != null) { - jmxExporter.getMBeanServer().unregisterMBean(connectorObjectName); +if (jmxExporter != null && initiatorObjectName != null) { + jmxExporter.getMBeanServer().unregisterMBean(initiatorObjectName); } } } @@ -462,10 +462,11 @@ public class QuickfixjEngine extends Ser throw new DispatcherException(e); } } - -@SuppressWarnings("unchecked") + private void rethrowIfType(Exception e, Class exceptionClass) throws T { -throw (T) e; +if (e.getClass() == exceptionClass) { +throw exceptionClass.cast(e); +} } private void dispatch(QuickfixjEventCategory quickfixjEventCategory, SessionID sessionID, Message message) throws Exception { @@ -477,15 +478,17 @@ public class QuickfixjEngine extends Ser listener.onEvent(quickfixjEventCategory, sessionID, message); } } - -@SuppressWarnings("serial") + private class DispatcherException extends RuntimeException { + +private static final long serialVersionUID = 1L; + public DispatcherException(Throwable cause) { super(cause); } } } - + public String getUri() { return uri; }