Honor Emission result in FluxMessageChannel

* Implement `Emission` handling in the `FluxMessageChannel` and `IntegrationReactiveUtils`
* Upgrade to Spring Kafka `2.6.0`
* Fix R2DBC components for deprecation in the Spring Data R2DBC
* Implement `StatementMapper.SelectSpec` for query expression
* Clean up for some sporadic test failures
This commit is contained in:
Artem Bilan
2020-08-21 14:57:56 -04:00
parent e4b8b32b01
commit af5bcdf4d7
9 changed files with 134 additions and 97 deletions

View File

@@ -1,62 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/integration
https://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/file
https://www.springframework.org/schema/integration/file/spring-integration-file.xsd">
<int:channel id="inputChannelSaveToBaseDir" />
<int:channel id="inputChannelSaveToBaseDirDeleteSource" />
<int:channel id="inputChannelSaveToSubDir" />
<int:channel id="inputChannelSaveToSubDirAutoCreateOff" />
<int:channel id="inputChannelSaveToSubDirWrongExpression" />
<int:channel id="inputChannelSaveToSubDirWithHeader" />
<int:channel id="inputChannelSaveToSubDirWithFile" />
<int:channel id="inputChannelSaveToSubDirEmptyStringExpression" />
<int:channel id="inputChannelSaveToBaseDir"/>
<int:channel id="inputChannelSaveToBaseDirDeleteSource"/>
<int:channel id="inputChannelSaveToSubDir"/>
<int:channel id="inputChannelSaveToSubDirAutoCreateOff"/>
<int:channel id="inputChannelSaveToSubDirWrongExpression"/>
<int:channel id="inputChannelSaveToSubDirWithHeader"/>
<int:channel id="inputChannelSaveToSubDirWithFile"/>
<int:channel id="inputChannelSaveToSubDirEmptyStringExpression"/>
<int-file:outbound-channel-adapter id="save-to-base-directory"
channel="inputChannelSaveToBaseDir" auto-create-directory="true"
filename-generator-expression="'foo.txt'" directory="target/base-directory" />
channel="inputChannelSaveToBaseDir" auto-create-directory="true"
filename-generator-expression="'foo.txt'" directory="target/base-directory"/>
<int-file:outbound-channel-adapter id="delete-source-files"
channel="inputChannelSaveToBaseDirDeleteSource" auto-create-directory="true"
delete-source-files="true" filename-generator-expression="'foo.txt'"
directory="target/base-directory" />
channel="inputChannelSaveToBaseDirDeleteSource" auto-create-directory="true"
delete-source-files="true" filename-generator-expression="'foo.txt'"
directory="target/base-directory"/>
<int-file:outbound-channel-adapter id="save-to-sub-directory-wrong-expression"
channel="inputChannelSaveToSubDirWrongExpression" auto-create-directory="true"
directory-expression="'target/base-directory/sub-directory/foo.txt'" />
channel="inputChannelSaveToSubDirWrongExpression" auto-create-directory="true"
directory-expression="'target/base-directory/sub-directory/foo.txt'"/>
<int-file:outbound-channel-adapter id="save-to-sub-directory-empty-string-expression"
channel="inputChannelSaveToSubDirEmptyStringExpression" auto-create-directory="true"
directory-expression="' '" />
channel="inputChannelSaveToSubDirEmptyStringExpression"
auto-create-directory="true"
directory-expression="' '"/>
<int-file:outbound-channel-adapter id="save-to-sub-directory"
channel="inputChannelSaveToSubDir" auto-create-directory="true"
directory-expression="'target/base-directory/sub-directory'"
filename-generator-expression="'foo.txt'" />
channel="inputChannelSaveToSubDir" auto-create-directory="true"
directory-expression="'target/base-directory/sub-directory'"
filename-generator-expression="'foo.txt'"/>
<int-file:outbound-channel-adapter id="save-to-sub-directory-with-header"
channel="inputChannelSaveToSubDirWithHeader" auto-create-directory="true"
directory-expression="headers['myFileLocation']"
filename-generator-expression="'foo.txt'" />
channel="inputChannelSaveToSubDirWithHeader" auto-create-directory="true"
directory-expression="headers['myFileLocation']"
filename-generator-expression="'foo.txt'"/>
<int-file:outbound-channel-adapter id="save-to-sub-directory-auto-create-off"
channel="inputChannelSaveToSubDirAutoCreateOff" auto-create-directory="false"
directory-expression="'target/base-directory2/sub-directory2'"
filename-generator-expression="'foo.txt'" />
channel="inputChannelSaveToSubDirAutoCreateOff" auto-create-directory="false"
directory-expression="'target/base-directory2/sub-directory2'"
filename-generator-expression="'foo.txt'"/>
<int-file:outbound-channel-adapter id="save-to-sub-directory-with-file-expression"
channel="inputChannelSaveToSubDirWithFile" auto-create-directory="true"
directory-expression="headers['subDirectory']"
filename-generator-expression="'foo.txt'" />
channel="inputChannelSaveToSubDirWithFile" auto-create-directory="true"
directory-expression="headers['subDirectory']"
filename-generator-expression="'foo.txt'"/>
</beans:beans>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.io.File;
import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -32,6 +33,7 @@ import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandlingException;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.util.FileCopyUtils;
@@ -41,10 +43,9 @@ import org.springframework.util.FileCopyUtils;
* @author Gary Russell
*/
@SpringJUnitConfig
@DirtiesContext
class FileOutboundChannelAdapterIntegrationTests {
static final String DEFAULT_ENCODING = "UTF-8";
static final String SAMPLE_CONTENT = "HelloWorld";
@Autowired
@@ -78,7 +79,7 @@ class FileOutboundChannelAdapterIntegrationTests {
@BeforeEach
void setUp(@TempDir File tmpDir) throws Exception {
sourceFile = new File(tmpDir, "anyFile.txt");
FileCopyUtils.copy(SAMPLE_CONTENT.getBytes(DEFAULT_ENCODING),
FileCopyUtils.copy(SAMPLE_CONTENT.getBytes(StandardCharsets.UTF_8),
new FileOutputStream(sourceFile, false));
message = MessageBuilder.withPayload(sourceFile).build();
}