|
As of October 27th, please open all new issues in the Red Hat Customer Portal . |
|
[
Permlink
| « Hide
]
Claus Ibsen added a comment - 25/Jan/11 12:48 PM
btw I copied the camel-example-spring from the camel trunk to my eclipse workspace, and loaded it as a Maven project.
Ah if I typed the full path for the XML file src/main/resources/META-INF/spring/camel-context.xml then the Create Camel Test wizard, generated source code which loads the xml file
/** * */ package org.apache.camel.example.spring; import static org.junit.Assert.*; import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelSpringTestSupport; import org.junit.Before; import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * @author davsclaus * */ public class MyOtherCoolTest extends CamelSpringTestSupport { /* (non-Javadoc) * @see org.apache.camel.test.junit4.CamelSpringTestSupport#setUp() */ @Before public void setUp() throws Exception { super.setUp(); } @Test public void testCamelRoute() throws Exception { // define some expectations // TODO add some expectations here!! assertMockEndpointsSatisfied(); } @Override protected ClassPathXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext( "src/main/resources/META-INF/spring/camel-context.xml"); } } This is still a problem in 1.1.71.
The wizard asks about adding JUnit4, but it should also ask about camel-test artifact as well. Well in fact the wizard should only ask about adding camel-test as it got dependency on junit.
camel-test is now added as scope "test" dependency if not already there.
its looking great now thanks!
One minor nit - after hitting Finish on the wizard the test case is created; its got red squiggles due to missing imports - and the pom.xml is updated to reflect the new camel-test dependency. As soon as I double click on the pom.xml it recognises its changed & fires a build & the red squiggles go away. I wonder could we fire a build/refresh of pom.xml in the IDE when we've updated it? Then the red squiggles should automatically disappear without the user doing anything. i.e. after pressing "Finish" on the wizard the IDE should show the newly created test case and the red squiggles should disappear as the IDE does a refresh/build on pom.xml I just created a new camel-activemq project, created a test case from the camel-context.xml, then hit Finish - got the red squiggles, then I right clicked on the pom.xml and hit "refresh" and it noticed it'd changed and the red squiggles went. So I think just a refresh on pom.xml would do the trick.
Its a one liner, so I just added a refresh in there and it works perfectly now - thanks Lars!
|
|||||||||||||||||||||||||||||||||||||||