@Test public void testNotTooOldFilter() throws Exception { fakeFtpServer.start(); int port = fakeFtpServer.getServerControlPort(); context .getRouteDefinitions() .get(0) .adviceWith( context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith( "ftp://[email protected]:" + port + "?password=password&filter=#notTooOld&passiveMode=true"); weaveByType(ToDefinition.class).selectFirst().replace().to("mock:end"); } }); MockEndpoint end = context.getEndpoint("mock:end", MockEndpoint.class); end.expectedMessageCount(1); end.assertIsSatisfied(); // Make sure that the received file has the correct file name String fileName = (String) end.getReceivedExchanges().get(0).getIn().getHeader(Exchange.FILE_NAME_ONLY); assertEquals(fileName, "DMI1.nc"); fakeFtpServer.stop(); }
@After public void cleanUp() { if (mockFtpServer != null) { mockFtpServer.stop(); } }