This file contains 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
# Install GraalVM and native-image, needed for a native Quarkus build | |
# ######################## | |
- run: | |
name: Install GraalVM | |
command: | | |
if [ "${CIRCLE_BRANCH}" == "master" ]; then | |
curl https://github.com/oracle/graal/releases/download/vm-19.1.1/graalvm-ce-linux-amd64-19.1.1.tar.gz -O -J -L && tar xfz graalvm-ce-linux-amd64-19.1.1.tar.gz && mv graalvm-ce-19.1.1 .graalvm && rm graalvm-ce-linux-amd64-19.1.1.tar.gz | |
fi | |
- run: | |
name: Install native-image |
This file contains 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
@Test | |
public void rollbackMovesFileToFailed() throws Exception { | |
final CountDownLatch stopLatch = new CountDownLatch(1); | |
filePollingChannel.addInterceptor(new ChannelInterceptor() { | |
@Override | |
public Message<?> preSend(Message<?> message, MessageChannel channel) { | |
stopLatch.countDown(); | |
throw new RuntimeException("Forcing an Exception to trigger rollback"); | |
} | |
}); |
This file contains 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
@Test | |
public void pollIgnoresFileAlreadySeen() throws Exception { | |
final CountDownLatch stopLatch = new CountDownLatch(1); | |
filePollingChannel.addInterceptor(new ChannelInterceptor() { | |
@Override | |
public void postSend(Message<?> message, MessageChannel channel, boolean sent) { | |
stopLatch.countDown(); | |
} | |
}); | |
copy(TestUtils.locateClasspathResource(TestUtils.FILE_FIXTURE_PATH), new File(inboundReadDirectory, TestUtils.FILE_FIXTURE_NAME )); |
This file contains 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
@Test | |
public void pollIgnoresInvalidFile() throws Exception { | |
copy(TestUtils.locateClasspathResource(TestUtils.FILE_FIXTURE_PATH), new File(inboundReadDirectory, TestUtils.FILE_FIXTURE_NAME + ".tmp" )); | |
Thread.sleep(2000); | |
assertThatDirectoryIsEmpty(inboundProcessedDirectory); | |
assertThatDirectoryIsEmpty(inboundFailedDirectory); | |
assertThatDirectoryIsEmpty(inboundOutDirectory); | |
assertThatDirectoryHasFiles(inboundReadDirectory, 1); | |
} |
This file contains 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
@Autowired | |
@Qualifier(ApplicationConfiguration.INBOUND_CHANNEL) | |
public DirectChannel filePollingChannel; | |
@Test | |
public void pollFindsValidFile() throws Exception { | |
final CountDownLatch latch = new CountDownLatch(1); | |
filePollingChannel.addInterceptor(new ChannelInterceptor() { | |
@Override | |
public void postSend(Message<?> message, MessageChannel channel, boolean sent) { |
This file contains 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
@Bean | |
public IntegrationFlow writeToFile(@Qualifier("fileWritingMessageHandler") MessageHandler fileWritingMessageHandler) { | |
return IntegrationFlows.from(ApplicationConfiguration.INBOUND_CHANNEL) | |
.transform(m -> new StringBuilder((String)m).reverse().toString()) | |
.handle(fileWritingMessageHandler) | |
.log(LoggingHandler.Level.INFO) | |
.get(); | |
} | |
This file contains 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
@Bean | |
public IntegrationFlow inboundFileIntegration(@Value("${inbound.file.poller.fixed.delay}") long period, | |
@Value("${inbound.file.poller.max.messages.per.poll}") int maxMessagesPerPoll, | |
TaskExecutor taskExecutor, | |
MessageSource<File> fileReadingMessageSource) { | |
return IntegrationFlows.from(fileReadingMessageSource, | |
c -> c.poller(Pollers.fixedDelay(period) | |
.taskExecutor(taskExecutor) | |
.maxMessagesPerPoll(maxMessagesPerPoll) | |
.transactionSynchronizationFactory(transactionSynchronizationFactory()) |
This file contains 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
@Bean | |
PseudoTransactionManager transactionManager() { | |
return new PseudoTransactionManager(); | |
} | |
@Bean | |
TransactionSynchronizationFactory transactionSynchronizationFactory() { | |
ExpressionParser parser = new SpelExpressionParser(); | |
ExpressionEvaluatingTransactionSynchronizationProcessor syncProcessor = | |
new ExpressionEvaluatingTransactionSynchronizationProcessor(); |
This file contains 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
@Bean | |
public FileReadingMessageSource fileReadingMessageSource(DirectoryScanner directoryScanner) { | |
FileReadingMessageSource source = new FileReadingMessageSource(); | |
source.setDirectory(this.inboundReadDirectory); | |
source.setScanner(directoryScanner); | |
source.setAutoCreateDirectory(true); | |
return source; | |
} |
This file contains 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
@Bean | |
public DirectoryScanner directoryScanner(@Value("${inbound.filename.regex}") String regex) { | |
DirectoryScanner scanner = new RecursiveDirectoryScanner(); | |
CompositeFileListFilter<File> filter = new CompositeFileListFilter<>( | |
Arrays.asList(new AcceptOnceFileListFilter<>(), | |
new RegexPatternFileListFilter(regex)) | |
); | |
scanner.setFilter(filter); | |
return scanner; | |
} |
NewerOlder