Simple RSS unit Test

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Simple RSS unit Test

jpcook01
Hi,

I am trying to create a simple RSS unit test:

@Test
        public void testPictureGalleryRSS() throws Exception {
                MockEndpoint mock = getMockEndpoint("mock:result");
                mock.expectedMessageCount(1);
                mock.assertIsSatisfied();
                 
                Exchange exchange = mock.getExchanges().get(0);
                Message in = exchange.getIn();
                assertNotNull(in);
        }

        @Override
        protected RouteBuilder createRouteBuilder()  {
    return new RouteBuilder() {        
            public void configure() throws Exception {            
            from("rss:file:testfeeds/picture_gallery/rss10.xml")
                .convertBodyTo(String.class)                  
            .to("mock:result");                    
            }
        };        
    }

This is based on any one of the unit tests here:
http://svn.apache.org/viewvc/camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/

But when I run the test i just get:

java.lang.AssertionError: mock://result Received message count. Expected: <1> but was: <0>
        at org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:913)
        at org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:895)
        at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:230)
        at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:208)
        at com.bbc.newsi.feeds.feedaugmentor.dslroutes.PictureGalleryRouteBuilderTest.testPictureGalleryRSS(PictureGalleryRouteBuilderTest.java:16)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Simple RSS unit Test

jpcook01
Would it be something to do with these unregistered MBeans? It would be nice if this stuff was documented or a little easier to get working.

2010-02-10 10:49:05,737 DEBUG [main] impl.DefaultProducerServicePool - Starting service pool: org.apache.camel.impl.DefaultProducerServicePool@140c281
2010-02-10 10:49:05,768 DEBUG [main] impl.DefaultCamelContext - Adding routes from builder: Routes: []
2010-02-10 10:49:05,784 INFO [main] impl.DefaultCamelContext - Apache Camel 2.1.0 (CamelContext:camel-1) is starting
2010-02-10 10:49:05,784 INFO [main] impl.DefaultCamelContext - JMX enabled. Using DefaultManagedLifecycleStrategy.
2010-02-10 10:49:05,831 DEBUG [main] management.DefaultManagementAgent - Starting JMX agent on server: com.sun.jmx.mbeanserver.JmxMBeanServer@203c31
2010-02-10 10:49:05,893 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=context,name="camel-1"
2010-02-10 10:49:05,909 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=services,name=DefaultInflightRepository(0x50ca0c)
2010-02-10 10:49:05,924 DEBUG [main] impl.DefaultComponentResolver - Found component: rss via type: org.apache.camel.component.rss.RssComponent via: META-INF/services/org/apache/camel/component/rss
2010-02-10 10:49:05,924 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=components,name="rss"
2010-02-10 10:49:05,924 DEBUG [main] impl.DefaultComponent - Creating endpoint uri=[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0], path=[file:testfeeds/picture_gallery/rss20.xml], parameters=[{initialDelay=0}]
2010-02-10 10:49:05,924 DEBUG [main] impl.DefaultCamelContext - rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0 converted to endpoint: Endpoint[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0] by component: org.apache.camel.component.rss.RssComponent@d56b37
2010-02-10 10:49:05,940 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="rss://file:testfeeds/picture_gallery/rss20.xml\?initialDelay=0"
2010-02-10 10:49:05,940 DEBUG [main] impl.DefaultComponentResolver - Found component: log via type: org.apache.camel.component.log.LogComponent via: META-INF/services/org/apache/camel/component/log
2010-02-10 10:49:05,940 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=components,name="log"
2010-02-10 10:49:05,940 DEBUG [main] impl.DefaultComponent - Creating endpoint uri=[log://afterFetch], path=[afterFetch], parameters=[{}]
2010-02-10 10:49:05,940 DEBUG [main] impl.DefaultCamelContext - log://afterFetch converted to endpoint: Endpoint[log://afterFetch] by component: org.apache.camel.component.log.LogComponent@f593af
2010-02-10 10:49:05,940 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="log://afterFetch"
2010-02-10 10:49:05,987 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=tracer,name=Tracer(0x2db19d)
2010-02-10 10:49:06,002 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=errorhandlers,name="DefaultErrorHandlerBuilder(ref:CamelDefaultErrorHandlerBuilder)"
2010-02-10 10:49:06,002 DEBUG [main] impl.DefaultComponentResolver - Found component: mock via type: org.apache.camel.component.mock.MockComponent via: META-INF/services/org/apache/camel/component/mock
2010-02-10 10:49:06,002 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=components,name="mock"
2010-02-10 10:49:06,002 DEBUG [main] impl.DefaultComponent - Creating endpoint uri=[mock://result], path=[result], parameters=[{}]
2010-02-10 10:49:06,002 DEBUG [main] impl.DefaultCamelContext - mock://result converted to endpoint: Endpoint[mock://result] by component: org.apache.camel.component.mock.MockComponent@b7b3f9
2010-02-10 10:49:06,018 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="mock://result"
2010-02-10 10:49:06,018 DEBUG [main] impl.DefaultCamelContext - Starting routes...
2010-02-10 10:49:06,034 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=routes,name="route1"
2010-02-10 10:49:06,034 DEBUG [main] converter.DefaultTypeConverter - Loading type converters ...
2010-02-10 10:49:06,034 DEBUG [main] impl.DefaultPackageScanClassResolver - Searching for annotations of org.apache.camel.Converter in packages: [org.apache.camel.component.atom, org.apache.camel.dataformat.rss, org.apache.camel.component.file, org.apache.camel.component.bean, org.apache.camel.converter]
2010-02-10 10:49:06,221 DEBUG [main] impl.DefaultPackageScanClassResolver - Found: [class org.apache.camel.component.atom.AtomConverter, class org.apache.camel.dataformat.rss.RssConverter, class org.apache.camel.component.file.GenericFileConverter, class org.apache.camel.component.bean.BeanConverter, class org.apache.camel.converter.AsyncProcessorConverter, class org.apache.camel.converter.CamelConverter, class org.apache.camel.converter.CollectionConverter, class org.apache.camel.converter.IOConverter, class org.apache.camel.converter.NIOConverter, class org.apache.camel.converter.ObjectConverter, class org.apache.camel.converter.jaxp.DomConverter, class org.apache.camel.converter.jaxp.StaxConverter, class org.apache.camel.converter.jaxp.StreamSourceConverter, class org.apache.camel.converter.jaxp.XmlConverter, class org.apache.camel.converter.stream.StreamCacheConverter]
2010-02-10 10:49:06,221 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.component.atom.AtomConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.dataformat.rss.RssConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.component.file.GenericFileConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.component.bean.BeanConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.AsyncProcessorConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.CamelConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.CollectionConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.IOConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.NIOConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.ObjectConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.jaxp.DomConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.jaxp.StaxConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.jaxp.StreamSourceConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.jaxp.XmlConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader - Loading converter class: org.apache.camel.converter.stream.StreamCacheConverter
2010-02-10 10:49:06,237 DEBUG [main] converter.DefaultTypeConverter - Loading type converters done
2010-02-10 10:49:06,252 DEBUG [main] converter.DefaultTypeConverter - Adding fallback type converter as a known type converter to convert from: long to: java.lang.String
2010-02-10 10:49:06,268 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x1963b3e)
2010-02-10 10:49:06,268 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x1490eb5)
2010-02-10 10:49:06,268 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x186f247)
2010-02-10 10:49:06,284 DEBUG [main] management.DefaultManagementAgent - Registered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=consumers,name=RssEntryPollingConsumer(0x1e4a47e)
2010-02-10 10:49:06,284 DEBUG [main] rss.RssEntryPollingConsumer - Starting consumer: Consumer[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0]
2010-02-10 10:49:06,284 DEBUG [main] impl.DefaultCamelContext - Route 0: EventDrivenConsumerRoute[Endpoint[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0] -> Instrumentation:route[UnitOfWork(Pipeline[Channel[sendTo(Endpoint[log://afterFetch])], Channel[com.bbc.newsi.feeds.feedaugmentor.camel.processors.PictureGalleryRssWrangler@1e2befa], Channel[convertBodyTo[java.lang.String]], Channel[sendTo(Endpoint[mock://result])], Channel[sendTo(Endpoint[log://afterFetch])]])]]
2010-02-10 10:49:06,284 DEBUG [main] impl.DefaultCamelContext - ... Routes started
2010-02-10 10:49:06,284 INFO [main] impl.DefaultCamelContext - Apache Camel 2.1.0 (CamelContext:camel-1) started
2010-02-10 10:49:06,284 INFO [main] mock.MockEndpoint - Asserting: Endpoint[mock://result] is satisfied
2010-02-10 10:49:06,284 DEBUG [main] mock.MockEndpoint - Waiting on the latch for: 0 millis
2010-02-10 10:49:16,284 DEBUG [main] mock.MockEndpoint - Took 10000 millis to complete latch
2010-02-10 10:49:16,284 DEBUG [main] impl.DefaultProducerServicePool - Stopping service pool: org.apache.camel.impl.DefaultProducerServicePool@140c281
2010-02-10 10:49:16,284 INFO [main] impl.DefaultCamelContext - Apache Camel 2.1.0 (CamelContext:camel-1) is stopping
2010-02-10 10:49:16,284 DEBUG [main] rss.RssEntryPollingConsumer - Stopping consumer: Consumer[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0]
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=consumers,name=RssEntryPollingConsumer(0x1e4a47e)
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x1963b3e)
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x1490eb5)
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x186f247)
2010-02-10 10:49:16,284 INFO [main] impl.DefaultInflightRepository - Shutting down with no inflight exchanges.
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=components,name="log"
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="log://afterFetch"
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=tracer,name=Tracer(0x2db19d)
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="mock://result"
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=services,name=DefaultInflightRepository(0x50ca0c)
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=components,name="mock"
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=components,name="rss"
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=routes,name="route1"
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=context,name="camel-1"
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="rss://file:testfeeds/picture_gallery/rss20.xml\?initialDelay=0"
2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent - Unregistered MBean with objectname: org.apache.camel:context=PC-S052666/camel-1,type=errorhandlers,name="DefaultErrorHandlerBuilder(ref:CamelDefaultErrorHandlerBuilder)"
2010-02-10 10:49:16,284 INFO [main] impl.DefaultCamelContext - Apache Camel 2.1.0 (CamelContext:camel-1) stopped
jpcook wrote
Hi,

I am trying to create a simple RSS unit test:

@Test
        public void testPictureGalleryRSS() throws Exception {
                MockEndpoint mock = getMockEndpoint("mock:result");
                mock.expectedMessageCount(1);
                mock.assertIsSatisfied();
                 
                Exchange exchange = mock.getExchanges().get(0);
                Message in = exchange.getIn();
                assertNotNull(in);
        }

        @Override
        protected RouteBuilder createRouteBuilder()  {
    return new RouteBuilder() {        
            public void configure() throws Exception {            
            from("rss:file:testfeeds/picture_gallery/rss10.xml")
                .convertBodyTo(String.class)                  
            .to("mock:result");                    
            }
        };        
    }

This is based on any one of the unit tests here:
http://svn.apache.org/viewvc/camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/

But when I run the test i just get:

java.lang.AssertionError: mock://result Received message count. Expected: <1> but was: <0>
        at org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:913)
        at org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:895)
        at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:230)
        at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:208)
        at com.bbc.newsi.feeds.feedaugmentor.dslroutes.PictureGalleryRouteBuilderTest.testPictureGalleryRSS(PictureGalleryRouteBuilderTest.java:16)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Simple RSS unit Test

Claus Ibsen-2
On Wed, Feb 10, 2010 at 11:53 AM, jpcook <[hidden email]> wrote:
>
> Would it be something to do with these unregistered MBeans? It would be nice
> if this stuff was documented or a little easier to get working.
>

It has absolutely nothing to do with these unregistered mbeans. Its a
DEBUG log that tells the MBean are being removed (unregistered) from
JMX.

The unit test runs for 10 sec and then Camel stops.
And when it stops Camel cleanup stuff and in this process unregistering MBeans


> 2010-02-10 10:49:05,737 DEBUG [main] impl.DefaultProducerServicePool -
> Starting service pool:
> org.apache.camel.impl.DefaultProducerServicePool@140c281
> 2010-02-10 10:49:05,768 DEBUG [main] impl.DefaultCamelContext - Adding
> routes from builder: Routes: []
> 2010-02-10 10:49:05,784 INFO [main] impl.DefaultCamelContext - Apache Camel
> 2.1.0 (CamelContext:camel-1) is starting
> 2010-02-10 10:49:05,784 INFO [main] impl.DefaultCamelContext - JMX enabled.
> Using DefaultManagedLifecycleStrategy.
> 2010-02-10 10:49:05,831 DEBUG [main] management.DefaultManagementAgent -
> Starting JMX agent on server: com.sun.jmx.mbeanserver.JmxMBeanServer@203c31
> 2010-02-10 10:49:05,893 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=context,name="camel-1"
> 2010-02-10 10:49:05,909 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=services,name=DefaultInflightRepository(0x50ca0c)
> 2010-02-10 10:49:05,924 DEBUG [main] impl.DefaultComponentResolver - Found
> component: rss via type: org.apache.camel.component.rss.RssComponent via:
> META-INF/services/org/apache/camel/component/rss
> 2010-02-10 10:49:05,924 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=components,name="rss"
> 2010-02-10 10:49:05,924 DEBUG [main] impl.DefaultComponent - Creating
> endpoint
> uri=[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0],
> path=[file:testfeeds/picture_gallery/rss20.xml],
> parameters=[{initialDelay=0}]
> 2010-02-10 10:49:05,924 DEBUG [main] impl.DefaultCamelContext -
> rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0 converted to
> endpoint:
> Endpoint[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0] by
> component: org.apache.camel.component.rss.RssComponent@d56b37
> 2010-02-10 10:49:05,940 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="rss://file:testfeeds/picture_gallery/rss20.xml\?initialDelay=0"
> 2010-02-10 10:49:05,940 DEBUG [main] impl.DefaultComponentResolver - Found
> component: log via type: org.apache.camel.component.log.LogComponent via:
> META-INF/services/org/apache/camel/component/log
> 2010-02-10 10:49:05,940 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=components,name="log"
> 2010-02-10 10:49:05,940 DEBUG [main] impl.DefaultComponent - Creating
> endpoint uri=[log://afterFetch], path=[afterFetch], parameters=[{}]
> 2010-02-10 10:49:05,940 DEBUG [main] impl.DefaultCamelContext -
> log://afterFetch converted to endpoint: Endpoint[log://afterFetch] by
> component: org.apache.camel.component.log.LogComponent@f593af
> 2010-02-10 10:49:05,940 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="log://afterFetch"
> 2010-02-10 10:49:05,987 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=tracer,name=Tracer(0x2db19d)
> 2010-02-10 10:49:06,002 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=errorhandlers,name="DefaultErrorHandlerBuilder(ref:CamelDefaultErrorHandlerBuilder)"
> 2010-02-10 10:49:06,002 DEBUG [main] impl.DefaultComponentResolver - Found
> component: mock via type: org.apache.camel.component.mock.MockComponent via:
> META-INF/services/org/apache/camel/component/mock
> 2010-02-10 10:49:06,002 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=components,name="mock"
> 2010-02-10 10:49:06,002 DEBUG [main] impl.DefaultComponent - Creating
> endpoint uri=[mock://result], path=[result], parameters=[{}]
> 2010-02-10 10:49:06,002 DEBUG [main] impl.DefaultCamelContext -
> mock://result converted to endpoint: Endpoint[mock://result] by component:
> org.apache.camel.component.mock.MockComponent@b7b3f9
> 2010-02-10 10:49:06,018 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="mock://result"
> 2010-02-10 10:49:06,018 DEBUG [main] impl.DefaultCamelContext - Starting
> routes...
> 2010-02-10 10:49:06,034 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=routes,name="route1"
> 2010-02-10 10:49:06,034 DEBUG [main] converter.DefaultTypeConverter -
> Loading type converters ...
> 2010-02-10 10:49:06,034 DEBUG [main] impl.DefaultPackageScanClassResolver -
> Searching for annotations of org.apache.camel.Converter in packages:
> [org.apache.camel.component.atom, org.apache.camel.dataformat.rss,
> org.apache.camel.component.file, org.apache.camel.component.bean,
> org.apache.camel.converter]
> 2010-02-10 10:49:06,221 DEBUG [main] impl.DefaultPackageScanClassResolver -
> Found: [class org.apache.camel.component.atom.AtomConverter, class
> org.apache.camel.dataformat.rss.RssConverter, class
> org.apache.camel.component.file.GenericFileConverter, class
> org.apache.camel.component.bean.BeanConverter, class
> org.apache.camel.converter.AsyncProcessorConverter, class
> org.apache.camel.converter.CamelConverter, class
> org.apache.camel.converter.CollectionConverter, class
> org.apache.camel.converter.IOConverter, class
> org.apache.camel.converter.NIOConverter, class
> org.apache.camel.converter.ObjectConverter, class
> org.apache.camel.converter.jaxp.DomConverter, class
> org.apache.camel.converter.jaxp.StaxConverter, class
> org.apache.camel.converter.jaxp.StreamSourceConverter, class
> org.apache.camel.converter.jaxp.XmlConverter, class
> org.apache.camel.converter.stream.StreamCacheConverter]
> 2010-02-10 10:49:06,221 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.component.atom.AtomConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.dataformat.rss.RssConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class:
> org.apache.camel.component.file.GenericFileConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.component.bean.BeanConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class:
> org.apache.camel.converter.AsyncProcessorConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.converter.CamelConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.converter.CollectionConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.converter.IOConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.converter.NIOConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.converter.ObjectConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.converter.jaxp.DomConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.converter.jaxp.StaxConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class:
> org.apache.camel.converter.jaxp.StreamSourceConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class: org.apache.camel.converter.jaxp.XmlConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.AnnotationTypeConverterLoader
> - Loading converter class:
> org.apache.camel.converter.stream.StreamCacheConverter
> 2010-02-10 10:49:06,237 DEBUG [main] converter.DefaultTypeConverter -
> Loading type converters done
> 2010-02-10 10:49:06,252 DEBUG [main] converter.DefaultTypeConverter - Adding
> fallback type converter as a known type converter to convert from: long to:
> java.lang.String
> 2010-02-10 10:49:06,268 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x1963b3e)
> 2010-02-10 10:49:06,268 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x1490eb5)
> 2010-02-10 10:49:06,268 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x186f247)
> 2010-02-10 10:49:06,284 DEBUG [main] management.DefaultManagementAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=consumers,name=RssEntryPollingConsumer(0x1e4a47e)
> 2010-02-10 10:49:06,284 DEBUG [main] rss.RssEntryPollingConsumer - Starting
> consumer:
> Consumer[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0]
> 2010-02-10 10:49:06,284 DEBUG [main] impl.DefaultCamelContext - Route 0:
> EventDrivenConsumerRoute[Endpoint[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0]
> ->
> Instrumentation:route[UnitOfWork(Pipeline[Channel[sendTo(Endpoint[log://afterFetch])],
> Channel[com.bbc.newsi.feeds.feedaugmentor.camel.processors.PictureGalleryRssWrangler@1e2befa],
> Channel[convertBodyTo[java.lang.String]],
> Channel[sendTo(Endpoint[mock://result])],
> Channel[sendTo(Endpoint[log://afterFetch])]])]]
> 2010-02-10 10:49:06,284 DEBUG [main] impl.DefaultCamelContext - ... Routes
> started
> 2010-02-10 10:49:06,284 INFO [main] impl.DefaultCamelContext - Apache Camel
> 2.1.0 (CamelContext:camel-1) started
> 2010-02-10 10:49:06,284 INFO [main] mock.MockEndpoint - Asserting:
> Endpoint[mock://result] is satisfied
> 2010-02-10 10:49:06,284 DEBUG [main] mock.MockEndpoint - Waiting on the
> latch for: 0 millis
> 2010-02-10 10:49:16,284 DEBUG [main] mock.MockEndpoint - Took 10000 millis
> to complete latch
> 2010-02-10 10:49:16,284 DEBUG [main] impl.DefaultProducerServicePool -
> Stopping service pool:
> org.apache.camel.impl.DefaultProducerServicePool@140c281
> 2010-02-10 10:49:16,284 INFO [main] impl.DefaultCamelContext - Apache Camel
> 2.1.0 (CamelContext:camel-1) is stopping
> 2010-02-10 10:49:16,284 DEBUG [main] rss.RssEntryPollingConsumer - Stopping
> consumer:
> Consumer[rss://file:testfeeds/picture_gallery/rss20.xml?initialDelay=0]
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=consumers,name=RssEntryPollingConsumer(0x1e4a47e)
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x1963b3e)
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x1490eb5)
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=processors,name=SendProcessor(0x186f247)
> 2010-02-10 10:49:16,284 INFO [main] impl.DefaultInflightRepository -
> Shutting down with no inflight exchanges.
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=components,name="log"
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="log://afterFetch"
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=tracer,name=Tracer(0x2db19d)
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="mock://result"
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=services,name=DefaultInflightRepository(0x50ca0c)
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=components,name="mock"
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=components,name="rss"
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=routes,name="route1"
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=context,name="camel-1"
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=endpoints,name="rss://file:testfeeds/picture_gallery/rss20.xml\?initialDelay=0"
> 2010-02-10 10:49:16,284 DEBUG [main] management.DefaultManagementAgent -
> Unregistered MBean with objectname:
> org.apache.camel:context=PC-S052666/camel-1,type=errorhandlers,name="DefaultErrorHandlerBuilder(ref:CamelDefaultErrorHandlerBuilder)"
> 2010-02-10 10:49:16,284 INFO [main] impl.DefaultCamelContext - Apache Camel
> 2.1.0 (CamelContext:camel-1) stopped
>
> jpcook wrote:
>>
>> Hi,
>>
>> I am trying to create a simple RSS unit test:
>>
>> @Test
>>       public void testPictureGalleryRSS() throws Exception {
>>               MockEndpoint mock = getMockEndpoint("mock:result");
>>               mock.expectedMessageCount(1);
>>               mock.assertIsSatisfied();
>>
>>               Exchange exchange = mock.getExchanges().get(0);
>>               Message in = exchange.getIn();
>>               assertNotNull(in);
>>       }
>>
>>       @Override
>>       protected RouteBuilder createRouteBuilder()  {
>>       return new RouteBuilder() {
>>             public void configure() throws Exception {
>>               from("rss:file:testfeeds/picture_gallery/rss10.xml")
>>                       .convertBodyTo(String.class)
>>                               .to("mock:result");
>>             }
>>         };
>>     }
>>
>> This is based on any one of the unit tests here:
>> http://svn.apache.org/viewvc/camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/
>>
>> But when I run the test i just get:
>>
>> java.lang.AssertionError: mock://result Received message count. Expected:
>> <1> but was: <0>
>>       at
>> org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:913)
>>       at
>> org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:895)
>>       at
>> org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:230)
>>       at
>> org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:208)
>>       at
>> com.bbc.newsi.feeds.feedaugmentor.dslroutes.PictureGalleryRouteBuilderTest.testPictureGalleryRSS(PictureGalleryRouteBuilderTest.java:16)
>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>       at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>       at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>       at java.lang.reflect.Method.invoke(Method.java:597)
>>       at junit.framework.TestCase.runTest(TestCase.java:168)
>>       at junit.framework.TestCase.runBare(TestCase.java:134)
>>       at junit.framework.TestResult$1.protect(TestResult.java:110)
>>       at junit.framework.TestResult.runProtected(TestResult.java:128)
>>       at junit.framework.TestResult.run(TestResult.java:113)
>>       at junit.framework.TestCase.run(TestCase.java:124)
>>       at junit.framework.TestSuite.runTest(TestSuite.java:232)
>>       at junit.framework.TestSuite.run(TestSuite.java:227)
>>       at
>> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
>>       at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
>>       at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>       at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>>       at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>>       at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>>       at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>>
>> Thanks
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Simple-RSS-unit-Test-tp27520408p27527625.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Simple RSS unit Test

Claus Ibsen-2
In reply to this post by jpcook01
On Tue, Feb 9, 2010 at 8:07 PM, jpcook <[hidden email]> wrote:

>
> Hi,
>
> I am trying to create a simple RSS unit test:
>
> @Test
>        public void testPictureGalleryRSS() throws Exception {
>                MockEndpoint mock = getMockEndpoint("mock:result");
>                mock.expectedMessageCount(1);
>                mock.assertIsSatisfied();
>
>                Exchange exchange = mock.getExchanges().get(0);
>                Message in = exchange.getIn();
>                assertNotNull(in);
>        }
>
>        @Override
>        protected RouteBuilder createRouteBuilder()  {
>        return new RouteBuilder() {
>            public void configure() throws Exception {
>                from("rss:file:testfeeds/picture_gallery/rss10.xml")
>                        .convertBodyTo(String.class)
>                                .to("mock:result");
>            }
>        };
>    }
>

Have you actually checked there is a file in that location
     rss:file:testfeeds/picture_gallery/rss10.xml
Could very well be there are no files found.


> This is based on any one of the unit tests here:
> http://svn.apache.org/viewvc/camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/
>
> But when I run the test i just get:
>
> java.lang.AssertionError: mock://result Received message count. Expected:
> <1> but was: <0>
>        at org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:913)
>        at
> org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:895)
>        at
> org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:230)
>        at
> org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:208)
>        at
> com.bbc.newsi.feeds.feedaugmentor.dslroutes.PictureGalleryRouteBuilderTest.testPictureGalleryRSS(PictureGalleryRouteBuilderTest.java:16)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at junit.framework.TestCase.runTest(TestCase.java:168)
>        at junit.framework.TestCase.runBare(TestCase.java:134)
>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>        at junit.framework.TestResult.run(TestResult.java:113)
>        at junit.framework.TestCase.run(TestCase.java:124)
>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>        at junit.framework.TestSuite.run(TestSuite.java:227)
>        at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
>        at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
>        at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>
> Thanks
>
> --
> View this message in context: http://old.nabble.com/Simple-RSS-unit-Test-tp27520408p27520408.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Simple RSS unit Test

jpcook01
Yes of course there is a file :)

I found the problem after debugging camel, Rome has a dependency on jdom so I needed that jar as well.

Its just a shame camel swallows the exception and doesn't give you some more meaningful information.

Thanks for your reply.

Claus Ibsen-2 wrote
On Tue, Feb 9, 2010 at 8:07 PM, jpcook <jonathan.cook@erars.plus.com> wrote:
>
> Hi,
>
> I am trying to create a simple RSS unit test:
>
> @Test
>        public void testPictureGalleryRSS() throws Exception {
>                MockEndpoint mock = getMockEndpoint("mock:result");
>                mock.expectedMessageCount(1);
>                mock.assertIsSatisfied();
>
>                Exchange exchange = mock.getExchanges().get(0);
>                Message in = exchange.getIn();
>                assertNotNull(in);
>        }
>
>        @Override
>        protected RouteBuilder createRouteBuilder()  {
>        return new RouteBuilder() {
>            public void configure() throws Exception {
>                from("rss:file:testfeeds/picture_gallery/rss10.xml")
>                        .convertBodyTo(String.class)
>                                .to("mock:result");
>            }
>        };
>    }
>

Have you actually checked there is a file in that location
     rss:file:testfeeds/picture_gallery/rss10.xml
Could very well be there are no files found.


> This is based on any one of the unit tests here:
> http://svn.apache.org/viewvc/camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/
>
> But when I run the test i just get:
>
> java.lang.AssertionError: mock://result Received message count. Expected:
> <1> but was: <0>
>        at org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:913)
>        at
> org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:895)
>        at
> org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:230)
>        at
> org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:208)
>        at
> com.bbc.newsi.feeds.feedaugmentor.dslroutes.PictureGalleryRouteBuilderTest.testPictureGalleryRSS(PictureGalleryRouteBuilderTest.java:16)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at junit.framework.TestCase.runTest(TestCase.java:168)
>        at junit.framework.TestCase.runBare(TestCase.java:134)
>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>        at junit.framework.TestResult.run(TestResult.java:113)
>        at junit.framework.TestCase.run(TestCase.java:124)
>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>        at junit.framework.TestSuite.run(TestSuite.java:227)
>        at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
>        at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
>        at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>
> Thanks
>
> --
> View this message in context: http://old.nabble.com/Simple-RSS-unit-Test-tp27520408p27520408.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus