camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Tutorial Business Partners Test Failing
Date Mon, 27 Jun 2011 04:42:45 GMT
Which version of Camel are you using?
I guess you are still using Camel 1.x.

Can you check the log to see if the CamelContext is stared?

On 6/22/11 6:52 PM, pcroser wrote:
> Running on Linux with maven setup
> I am getting an error when tyring to run the testXMLCoversion method
> No getConsumers() available on Producer[direct:start] which leads to
> testXMLConversion(com.itt.ips.casex.cybervisor.cameljmsmailcomponent.XMLInputTest):
> mock:finish Received message count. Expected:<1>  but was:<0>
>
> Not sure what I have missed but I followed tutorial steps I believe
> correctly.
>
>
> I have double checked classpaths and test files are in the correct locaiton.
> The Test method is being run but fails.
>
> I am using the spring context file as shown XMLInputTest-context.xml
> <beans xsi:schemaLocation="http://www.springframework.org/schema/beans
>          http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>          http://activemq.apache.org/camel/schema/spring
>
> http://activemq.apache.org/camel/schema/spring/camel-spring-1.4.0.xsd">
>    <camelContext id="camel">
>      <route>
>        <from uri="direct:start"/>
>        <to uri="xslt:XMLConverter.xsl"/>
>        <to uri="mock:finish"/>
>      </route>
>    </camelContext>
> </beans>
>
> and XMLInputTest.java
>
> import java.io.InputStream;
> import org.apache.camel.CamelContext;
> import org.apache.camel.Exchange;
> import org.apache.camel.ProducerTemplate;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.springframework.beans.factory.annotation.Autowired;
> import org.springframework.test.context.ContextConfiguration;
> import
> org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
>
> @ContextConfiguration(locations="classpath:/XMLInputTest-context.xml")
> public class XMLInputTest extends AbstractJUnit38SpringContextTests {
>
>    @Autowired
>    protected CamelContext camelContext;
>
>    protected ProducerTemplate<Exchange>  template;
>
>    public XMLInputTest(String testName) {
>      super(testName);
>    }
>
>    @Override
>    protected void tearDown() throws Exception {
>      super.tearDown();
>    }
>
>    protected void setUp() throws Exception {
>      super.setUp();
>      template = camelContext.createProducerTemplate();
>    }
>    // TODO add test methods here. The name must begin with 'test'. For
> example:
>    public void testNothing() {
>    System.out.println("Test CASE is being run");
>    }
>
>
>    public void testXMLConversion() throws InterruptedException {
>
>      MockEndpoint finish = MockEndpoint.resolve(camelContext, "mock:finish");
>      finish.setExpectedMessageCount(1);
>      InputStream in =
> XMLInputTest.class.getResourceAsStream("/input-customer1.xml");
>      assertNotNull( in );
>      template.sendBody("direct:start", in );
>      System.out.println(" Cannot get testXMLConversion to work commented
> out");
>      MockEndpoint.assertIsSatisfied(camelContext);
>      System.err.println(finish.getExchanges().get(0).getIn().getBody() );
>    }
> }
>
> Thanks for any help in advance.
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Tutorial-Business-Partners-Test-Failing-tp4513630p4513630.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Mime
View raw message