Hi Gert, Can you remove the JbiProducerTest.java.rej from the repository ? I think you did not mean to commit it.
Willem [EMAIL PROTECTED] wrote: > Author: gertv > Date: Tue Nov 4 00:55:42 2008 > New Revision: 711212 > > URL: http://svn.apache.org/viewvc?rev=711212&view=rev > Log: > SM-1673: improve error handling in servicemix-camel > > Added: > > servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiProducerTest.java.rej > Added: > servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiProducerTest.java.rej > URL: > http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiProducerTest.java.rej?rev=711212&view=auto > ============================================================================== > --- > servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiProducerTest.java.rej > (added) > +++ > servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiProducerTest.java.rej > Tue Nov 4 00:55:42 2008 > @@ -0,0 +1,54 @@ > +*************** > +*** 16,29 **** > + */ > + package org.apache.servicemix.camel; > + > + import javax.jbi.management.DeploymentException; > + > + import org.apache.camel.builder.RouteBuilder; > + > + /** > + * Test for [EMAIL PROTECTED] JbiEndpoint.JbiProducer} > + */ > +- public class JbiProducerTest extends JbiCamelErrorHandlingTestSupport { > + > + /* > + * Ensure that no exceptions get thrown when shutting down the routes > +--- 16,32 ---- > + */ > + package org.apache.servicemix.camel; > + > ++ import java.util.List; > ++ > + import javax.jbi.management.DeploymentException; > + > + import org.apache.camel.builder.RouteBuilder; > ++ import org.apache.servicemix.jbi.container.ActivationSpec; > + > + /** > + * Test for [EMAIL PROTECTED] JbiEndpoint.JbiProducer} > + */ > ++ public class JbiProducerTest extends JbiTestSupport { > + > + /* > + * Ensure that no exceptions get thrown when shutting down the routes > +*************** > +*** 41,46 **** > + protected void tearDown() throws Exception { > + // testing shutdown, so will do this manually > + } > + > + @Override > + protected RouteBuilder createRoutes() { > +--- 44,54 ---- > + protected void tearDown() throws Exception { > + // testing shutdown, so will do this manually > + } > ++ > ++ @Override > ++ protected void appendJbiActivationSpecs(List<ActivationSpec> > activationSpecList) { > ++ // no additional activation specs required > ++ } > + > + @Override > + protected RouteBuilder createRoutes() { > > Modified: > servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java > URL: > http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java?rev=711212&r1=711211&r2=711212&view=diff > ============================================================================== > --- > servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java > (original) > +++ > servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java > Tue Nov 4 00:55:42 2008 > @@ -22,6 +22,7 @@ > import java.util.concurrent.TimeUnit; > import java.util.concurrent.atomic.AtomicBoolean; > > +import javax.jbi.JBIException; > import javax.xml.namespace.QName; > > import org.apache.camel.AsyncCallback; > @@ -35,7 +36,10 @@ > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.component.mock.MockEndpoint; > import org.apache.camel.impl.DefaultCamelContext; > +import org.apache.servicemix.client.DefaultServiceMixClient; > +import org.apache.servicemix.client.ServiceMixClient; > import org.apache.servicemix.jbi.container.ActivationSpec; > +import org.apache.servicemix.jbi.container.JBIContainer; > import org.apache.servicemix.jbi.container.SpringJBIContainer; > import org.apache.servicemix.tck.ExchangeCompletedListener; > > @@ -43,6 +47,7 @@ > * @version $Revision: 563665 $ > */ > public abstract class JbiTestSupport extends TestSupport { > + > protected Exchange receivedExchange; > > protected CamelContext camelContext = new DefaultCamelContext(); > @@ -58,6 +63,8 @@ > protected String startEndpointUri = > "jbi:endpoint:serviceNamespace:serviceA:endpointA"; > > protected ProducerTemplate<Exchange> client = > camelContext.createProducerTemplate(); > + > + protected ServiceMixClient servicemixClient; > > /** > * Sends an exchange to the endpoint > @@ -108,42 +115,65 @@ > > @Override > protected void setUp() throws Exception { > - jbiContainer.setEmbedded(true); > - exchangeCompletedListener = new ExchangeCompletedListener(); > - > - CamelJbiComponent component = new CamelJbiComponent(); > - > + configureContainer(jbiContainer); > List<ActivationSpec> activationSpecList = new > ArrayList<ActivationSpec>(); > - > + > // lets add the Camel endpoint > - ActivationSpec activationSpec = new ActivationSpec(); > - activationSpec.setId("camel"); > - activationSpec.setService(new QName("camel", "camel")); > - activationSpec.setEndpoint("camelEndpoint"); > - activationSpec.setComponent(component); > - activationSpecList.add(activationSpec); > + CamelJbiComponent component = new CamelJbiComponent(); > + activationSpecList.add(createActivationSpec(component, new > QName("camel", "camel"), "camelEndpoint")); > > + // and provide a callback method for adding more services > appendJbiActivationSpecs(activationSpecList); > - > - ActivationSpec[] activationSpecs = activationSpecList > - .toArray(new ActivationSpec[activationSpecList.size()]); > - jbiContainer.setActivationSpecs(activationSpecs); > + jbiContainer.setActivationSpecs(activationSpecList.toArray(new > ActivationSpec[activationSpecList.size()])); > + > jbiContainer.afterPropertiesSet(); > + > + exchangeCompletedListener = new ExchangeCompletedListener(); > jbiContainer.addListener(exchangeCompletedListener); > > - // lets configure some componnets > - camelContext.addComponent("jbi", component); > - > + // allow for additional configuration of the compenent (e.g. > deploying SU) > + configureComponent(component); > + > // lets add some routes > - camelContext.addRoutes(createRoutes()); > + RouteBuilder builder = createRoutes(); > + if (builder != null) { > + camelContext.addRoutes(builder); > + } > endpoint = camelContext.getEndpoint(startEndpointUri); > - assertNotNull("No endpoint found!", endpoint); > > camelContext.start(); > } > > + protected void configureComponent(CamelJbiComponent component) throws > Exception { > + // add the ServiceMix Camel component to the CamelContext > + camelContext.addComponent("jbi", component); > + } > + > + protected void configureContainer(final JBIContainer container) throws > Exception { > + container.setEmbedded(true); > + } > + > + public ServiceMixClient getServicemixClient() throws JBIException { > + if (servicemixClient == null) { > + servicemixClient = new DefaultServiceMixClient(jbiContainer); > + } > + return servicemixClient; > + } > + > + protected ActivationSpec createActivationSpec(Object component, QName > service) { > + return createActivationSpec(component, service, "endpoint"); > + } > + > + protected ActivationSpec createActivationSpec(Object component, QName > service, String endpointName) { > + ActivationSpec spec = new ActivationSpec(component); > + spec.setService(service); > + spec.setEndpoint(endpointName); > + return spec; > + } > + > @Override > protected void tearDown() throws Exception { > + getServicemixClient().close(); > client.stop(); > camelContext.stop(); > super.tearDown(); > @@ -154,8 +184,7 @@ > } > > > - protected abstract void appendJbiActivationSpecs( > - List<ActivationSpec> activationSpecList); > + protected abstract void appendJbiActivationSpecs(List<ActivationSpec> > activationSpecList); > > protected abstract RouteBuilder createRoutes(); > } >
