From 62879c91c3b77cbad4c9ef16ccb61cd3698e94c2 Mon Sep 17 00:00:00 2001 From: "Arsen A. Gutsal" Date: Thu, 3 Oct 2013 10:34:10 +0300 Subject: [PATCH] added test case, which explains the problem inside getMockEndpoint --- grails-app/conf/BuildConfig.groovy | 2 + .../grails/routing/RoutesTests.groovy | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 test/integration/grails/routing/RoutesTests.groovy 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() + } +}