You can define the route directly in the test file by extending
CamelTestSupport from the camel-test component.
As an example you can take the following test:
https://svn.apache.org/repos/asf/camel/trunk/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/SoapClientTest.java
Greetings
Christian
Am 15.03.2010 12:48, schrieb Tarjei Huse:
By the way we are pretty happy with this this ref-component. It allows
automated unit and system testing of a route way before integration tests!
Give it a try. I guess you will see the advantages pretty soon.
</qoute>
I do not disagree, I do have strong positive feelings regarding Camel :P
What I thought was possible was to create an endpoint with a given ref using
@EndpointInject so that I kept the endpoints I used within the unittest
class definition instead of having to define them in a separate
camel-context.xml file.
Regards,
Tarjei
Meise, Christoph wrote:
-----Ursprüngliche Nachricht-----
Von: Tarjei Huse [mailto:[email protected]]
Gesendet: Montag, 15. März 2010 10:35
An: [email protected]
Betreff: Re: Why isn't it possible to create a route from a endpoint id?
Do not have both uri and ref on @EndpointInject. Only one of them.
</qoute>
Ah,
but then I will have to define those endpoints outside the test - which it
was my goal not to.
Anyhow, thanks for helping me. I'll place the endpoint definitions in a
separate file.
Regards,
Tarjei
Claus Ibsen-2 wrote:
On Mon, Mar 15, 2010 at 10:21 AM, Tarjei Huse<[email protected]>
wrote:
Claus Ibsen-2 wrote:
Hi
Use the ref component
http://camel.apache.org/ref
from("ref:myRouteStart").process().to("ref:myRouteEnd");
</qoute>
Thanks. When I try this I get:
org.apache.camel.FailedToCreateRouteException: Failed to create route
Incomming to sourcechecker: Route[[From[ref:incoming]] ->
[process[null]]]
because of Failed to resolve endpoint: ref://incoming due to: No
component
found with scheme: ref
The test I created looks like this:
public class SourceCheckerRouteTest extends CamelTestSupport {
@EndpointInject(uri="mock:result", ref="outgoing")
protected MockEndpoint resultEndpoint;
@EndpointInject(uri="direct:start", ref="incoming")
protected Endpoint start;
@Produce(uri = "direct:start")
protected ProducerTemplate template;
@Test
public void testRunRoute() {
..
}
protected RouteBuilder createRouteBuilder() throws Exception {
SourceFinderRoute sf = new SourceFinderRoute();
return sf;
}
Any tips?
Regards,
Tarjei
On Mon, Mar 15, 2010 at 9:35 AM, Tarjei Huse<[email protected]>
wrote:
Hi,
if is possible to create a Route using from(Endpoint ep) or
from("uri"),
but
I want to be able to register different endpoints in different
situations
and let camel do the assigning for me. Is this possible?
The reason I want to do this, is to be able to create tests for routes
where
I do
@EndpointInject("ref"="myRouteStart", "uri"="direct:start")
Endpoint ep;
in the test and then have something like:
class MyRoute extends RouteBuilder {
public void configure() throws Exception {
ref("myRouteStart").process().to("myRouteEnd");
}
Is this possible or is the ref and the uri of an endpoint essentially
the
same and thus cannot be used for abstraction?
Regards,
Tarjei
--
View this message in context:
http://old.nabble.com/Why-isn%27t-it-possible-to-create-a-route-from-a-endpoint-id--tp27901495p27901495.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
--
View this message in context:
http://old.nabble.com/Why-isn%27t-it-possible-to-create-a-route-from-a-endpoint-id--tp27901495p27901883.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
--
View this message in context:
http://old.nabble.com/Why-isn%27t-it-possible-to-create-a-route-from-a-endpoint-id--tp27901495p27902004.html
Sent from the Camel - Users mailing list archive at Nabble.com.
--
Christian Schneider
---
http://www.liquid-reality.de