BTW you probably want to add your expectations before starting the context.

On 26/10/2007, bgoetzmann <[EMAIL PROTECTED]> wrote:
>
> Having installed Apache Camel 1.2.0 with Maven on my computer, all tests
> passed.
>
> So, what I try to achieve is something like the test in
> HttpPollingGetTest.java: you get a HTML from Google.
> Here the source code I use:
>
>
> public static void main(String[] args) throws Exception {
>
>                 CamelContext camelContext = new DefaultCamelContext();
>
>                 final MockEndpoint mep = (MockEndpoint)
> camelContext.getEndpoint("mock:test");
>
>                 camelContext.addRoutes(new RouteBuilder() {
>
>                     public void configure() {
>                         from("http://www.google.com";).to(mep);
>                     }
>
>                 });
>
>                 camelContext.start();
>
>                 mep.expectedMessageCount(1);
>
>                 try {
>                         mep.assertIsSatisfied();
>                 }
>                 finally {
>                         camelContext.stop();
>                 }
>         }
>
> The mock endpoint receives no exchange! I get the exception:
>
>
> 26 oct. 2007 15:58:28 org.apache.commons.httpclient.HttpClient <clinit>
> FIN: SunMSCAPI 1.6: Sun's Microsoft Crypto API provider
> 26 oct. 2007 15:58:28 org.apache.camel.component.mock.MockEndpoint
> assertIsSatisfied
> INFO: Asserting: Endpoint[mock:test] is satisfied
> 26 oct. 2007 15:58:28 org.apache.camel.component.mock.MockEndpoint
> waitForCompleteLatch
> FIN: Waiting on the latch for: 20000 millis
> Exception in thread "main" java.lang.AssertionError: mock:test Received
> message count. Expected: <1> but was: <0>
>         at 
> org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:531)
>         at
> org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:513)
>         at
> org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:168)
>         at
> org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:144)
>         at test.Test6.main(Test6.java:34)
>
> I appreciate any idea or suggestion!
>
> Bertrand.
>
>
>
> bgoetzmann wrote:
> >
> > No, this route does not work for me.
> > I also try the route:
> > from("http://www.google.com";).to("mock:results"), as used in the test
> > HttpPollingGetTest.java,
> > without success!
> >
> > I would like to do a simple use case where, with Camel, I would be able to
> > fetch a HTML document at a regular time interval.
> >
> > Bertrand.
> >
> >
> > Nicky Sandhu wrote:
> >>
> >> Then there is this test
> >> http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java?view=markup
> >>
> >> which uses something like
> >> from("direct:start").setHeader(HttpProducer.QUERY,constant("hl=en&q=activemq")).to("http://www.google.com/search";).to("mock:results")
> >>
> >> Would that work for you?
> >>
> >> gnodet wrote:
> >>>
> >>> I think the problem is that by default, if you use
> >>>   from("http://...";)
> >>> the component creates a web server and listens for request.
> >>> Or does it make a difference between a remote host and a local host ?
> >>> even, you may want to GET an html page from a local host.
> >>>
> >>> On 10/19/07, James Strachan <[EMAIL PROTECTED]> wrote:
> >>>> On 18/10/2007, bgoetzmann <[EMAIL PROTECTED]> wrote:
> >>>> >
> >>>> > Hi,
> >>>> >
> >>>> > This is a simple question: I thought that read a HTML/XML document
> >>>> from an
> >>>> > URL could be do in that way:
> >>>> >
> >>>> > from("http://www.odelia-technologies.com/";).to...
> >>>> >
> >>>> > but it doesn't work!
> >>>> >
> >>>> > How can one do this?
> >>>> >
> >>>> > Thank you.
> >>>>
> >>>> Would
> >>>>
> >>>> from("http://www.odelia-technologies.com/index.html";).to...
> >>>>
> >>>> help?
> >>>>
> >>>> We currently don't do a spider like
> >>>>
> >>>>   wget -r http://www.odelia-technologies.com/
> >>>>
> >>>> would; so you'd have to HTTP GET the exact URL you need for the HTML
> >>>> page.
> >>>>
> >>>> --
> >>>> James
> >>>> -------
> >>>> http://macstrac.blogspot.com/
> >>>>
> >>>> Open Source SOA
> >>>> http://open.iona.com
> >>>>
> >>>
> >>>
> >>> --
> >>> Cheers,
> >>> Guillaume Nodet
> >>> ------------------------
> >>> Blog: http://gnodet.blogspot.com/
> >>>
> >>>
> >>
> >>
> >
> >
>
> --
>
> View this message in context: 
> http://www.nabble.com/Reading-a-HTML-document-from-an-URL-tf4646579s22882.html#a13428041
>
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com

Reply via email to