diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy index b026457..0378b2d 100644 --- a/grails-app/conf/BuildConfig.groovy +++ b/grails-app/conf/BuildConfig.groovy @@ -22,6 +22,8 @@ grails.project.dependency.resolution = { excludes 'spring-context', 'spring-aop', 'spring-tx', 'groovy-all' } compile("org.apache.camel:camel-stream:${camelVersion}") + + test("org.apache.camel:camel-test:${camelVersion}") { excludes "junit" } } plugins { diff --git a/test/integration/grails/routing/RoutesTests.groovy b/test/integration/grails/routing/RoutesTests.groovy new file mode 100644 index 0000000..e8fb825 --- /dev/null +++ b/test/integration/grails/routing/RoutesTests.groovy @@ -0,0 +1,44 @@ +package grails.routing + +import static org.junit.Assert.* +import org.junit.* + +import org.apache.camel.test.junit4.CamelTestSupport +import org.apache.camel.builder.RouteBuilder + +class RoutesTests extends CamelTestSupport { + + def camelContext + def producerTemplate + + @Before + void setUp() { + super.setUp() + + camelContext.addRoutes( + new RouteBuilder(){ + @Override + void configure(){ + from('direct:foo').to('mock:bar') + } + }) + } + + @After + void tearDown() { + camelContext.stop() + } + + @Test + void testSimpleRoute() { + def mockEndpoint + mockEndpoint = camelContext.getEndpoint('mock:bar') + //mockEndpoint = getMockEndpoint('mock:bar') + + mockEndpoint.expectedMessageCount(1) + + producerTemplate.sendBody('direct:foo', 'Hello World') + + mockEndpoint.assertIsSatisfied() + } +}