Created
August 22, 2012 17:35
-
-
Save ullgren/3427801 to your computer and use it in GitHub Desktop.
Testing polling of root directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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