This seems to work though, and does the same (while waiting for Camel Spring
Boot Test Runner ;)
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = Application.class, loader =
SpringApplicationContextLoader.class)
public class TestinGcamel extends CamelSpringTestSupport {
@Autowired
ApplicationContext ctx;
@Override
protected AbstractApplicationContext createApplicationContext() {
return (AbstractApplicationContext)ctx;
}
@Test
public void joopa() throws Exception {
MockEndpoint mockEndpoint = getMockEndpoint("mock:just.END");
mockEndpoint.setExpectedMessageCount(1);
String txtMsg = "justko joo ???";
template.sendBody("direct:just.joo", txtMsg);
assertMockEndpointsSatisfied();
mockEndpoint.message(0).body().isEqualTo(txtMsg);
}
________________________________
Lähettäjä: Claus Ibsen-2 [via Camel] [[email protected]]
Lähetetty: 31. elokuuta 2014 9:08
Vastaanottaja: Unto Valkonen
Aihe: Re: CamelSpringJUnit4ClassRunner with Spring Boot
The camel spring test is for regular spring. Spring boot does things a
bit differently, and we have not integrated with spring boot yet.
There is a related ticket here
https://issues.apache.org/jira/browse/CAMEL-7699
But as Willem says you are welcome to log a ticket about a
camel-spring-boot-test component.
On Sat, Aug 30, 2014 at 9:53 PM, user3152723
<[hidden email]<UrlBlockedError.aspx>> wrote:
> I’m been trying to use Camel with
> . Spring Boot,
> . test Routes with “@RunWith(CamelSpringJUnit4ClassRunner.class)”
> .with @Produce(uri = "direct:in")
> private ProducerTemplate producerTemplate;
> .and @EndpointInject(uri = "mock:out")
> private MockEndpoint out;
>
> I’m not an experienced Spring specialist (Spring Boot seems like endless
> labyrinth to me, with all of its @ContextConfiguration annotations).
>
> I’ve tested CamelSpringJUnit4ClassRunner using 2.14-SNAPSHOT version of
> Camel. Is it supposed to work, or is there something not completed in Spring
> 4 support?
>
> I wondered if anybody has working example code to share. It would be of lots
> of help – waiting for release of 2.14, because we have decided to use Spring
> Boot in our project – and hopefully Camel embedded.
>
> My last effort:
>
> @RunWith(CamelSpringJUnit4ClassRunner.class)
> //@ContextConfiguration(classes = Application.class)
> @ContextConfiguration(classes = {Application.class, MyRouteBuilder.class},
> loader = SpringApplicationContextLoader.class)
> public class TestinGcamel_2 {
>
>
> @Autowired
> ApplicationContext ctx;
>
> @Autowired
> CamelContext camelContext;
>
> @Produce(uri = "direct:in")
> private ProducerTemplate producerTemplate;
>
> @EndpointInject(uri = "mock:out")
> private MockEndpoint mockOut;
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/CamelSpringJUnit4ClassRunner-with-Spring-Boot-tp5755876.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]<UrlBlockedError.aspx>
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/CamelSpringJUnit4ClassRunner-with-Spring-Boot-tp5755876p5755885.html
To start a new topic under Camel - Users, email
[email protected]
To unsubscribe from Camel - Users, click
here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=dW50by52YWxrb25lbkBmaWZ0aGVsZW1lbnQuZml8NDY1NDI4fC0xNjkxNTczNjI4>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
--
View this message in context:
http://camel.465427.n5.nabble.com/VS-CamelSpringJUnit4ClassRunner-with-Spring-Boot-tp5755893.html
Sent from the Camel - Users mailing list archive at Nabble.com.