Skip to content

Commit

Permalink
two tests moved into separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
Arsen A. Gutsal committed Feb 7, 2014
1 parent cf6b746 commit 4a06e38
Showing 1 changed file with 0 additions and 67 deletions.
67 changes: 0 additions & 67 deletions test/integration/gnutch/RouteTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -138,73 +138,6 @@ class RouteTests extends CamelTestSupport {
assertMockEndpointsSatisfied(1, TimeUnit.MINUTES)
}

@Test
@DirtiesContext
void testFullCycle() {
camelContext.
getRouteDefinition('aggregation').
adviceWith(camelContext,
new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
mockEndpointsAndSkip("direct:publish")
}
});
def mockEndpoint = getMockEndpoint("mock:direct:publish")

mockEndpoint.expectedMessageCount(1)
def expectation = {->
def ex = receivedExchanges[0]
assert ex.in.body.documentElement.nodeName == 'add'
assert ex.in.body.getElementsByTagName('doc').length > 0

} as Runnable
expectation.delegate = mockEndpoint
mockEndpoint.expects(expectation)

// saving file
def resourceStream = new ClassPathResource('xslt/localhost.xsl').inputStream
def destFile = new File(grailsApplication.config.gnutch.inputRoute.replace('file://', '') + '/localhost.xsl')
destFile.append(resourceStream)

assertMockEndpointsSatisfied(15, TimeUnit.SECONDS)
}

@Test
@DirtiesContext
void testStress() {
camelContext.
getRouteDefinition('aggregation').
adviceWith(camelContext,
new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
mockEndpointsAndSkip("direct:publish")
}
});
def xsltDir = new ClassPathResource('xslt').file
xsltDir.eachFile { file ->
def destFile = new File(grailsApplication.config.gnutch.inputRoute.replace('file://', '') + '/' + file.name)
destFile.append(file.newInputStream())
}

def mockEndpoint = getMockEndpoint("mock:direct:publish")

mockEndpoint.expectedMinimumMessageCount(1) // expecting some messages
def expectation = {->
def ex = receivedExchanges[0]
assert ex.in.body.documentElement.nodeName == 'add'
assert ex.in.body.getElementsByTagName('doc').length > 0
println "Commit happened"
} as Runnable
expectation.delegate = mockEndpoint
mockEndpoint.expects(expectation)

assertMockEndpointsSatisfied(15, TimeUnit.SECONDS) // let this test work for 15 seconds
}


// this test goes at the end as it use adviceWith for aggregate-documents
@Test
@DirtiesContext
void testProcessTika() {
Expand Down

0 comments on commit 4a06e38

Please sign in to comment.