+ "\n For more information please visit: "
+ "\n http://www.springsource.org/spring-integration "
+ "\n "
+ "\n=========================================================" );
final AbstractApplicationContext context =
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/expression-advice-context.xml");
context.registerShutdownHook();
@SuppressWarnings("unchecked")
SessionFactory<FTPFile> sessionFactory = context.getBean(SessionFactory.class);
SourcePollingChannelAdapter fileInbound = context.getBean(SourcePollingChannelAdapter.class);
when(sessionFactory.getSession()).thenThrow(new RuntimeException("Force Failure"));
fileInbound.start();
LOGGER.info("\n========================================================="
+ "\n "
+ "\n This is the Expression Advice Sample - "
+ "\n "
+ "\n Press 'Enter' to terminate. "
+ "\n "
+ "\n Place a file in ${java.io.tmpdir}/adviceDemo ending "
+ "\n with .txt "
+ "\n The demo simulates a file transfer failure followed "
+ "\n by the Advice renaming the file; the result of the "
+ "\n rename is logged. "
+ "\n "
+ "\n=========================================================" );
System.in.read();
context.close();
System.exit(0);
}