Skip to content

Instantly share code, notes, and snippets.

@ullgren
Created August 22, 2012 17:35
Show Gist options
  • Save ullgren/3427801 to your computer and use it in GitHub Desktop.
Save ullgren/3427801 to your computer and use it in GitHub Desktop.
Testing polling of root directory
import org.apache.camel.CamelContext;
import org.apache.camel.EndpointInject;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class PollRootDirTest extends CamelTestSupport{
MockEndpoint mockResult;
/**
* Testing if polling root (file:///) is allowed.
*
* http://camel.465427.n5.nabble.com/Setting-root-folder-as-endpoint-Could-not-poll-endpoint-NPE-tp5717845.html
* @throws Exception
*/
@Test
public void pollRootDirectory() throws Exception {
MockEndpoint mockResult = (MockEndpoint) context().getEndpoint("mock:result");
context().addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("file:/?noop=true")
.log("File: ${in.header.CamelFileName}")
.to("mock:result");
}
});
mockResult.expectedMessageCount(10);
assertMockEndpointsSatisfied();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment