INTEXT-87: Add local-filter attribute
JIRA: https://jira.spring.io/browse/INTEXT-87
This commit is contained in:
@@ -193,6 +193,26 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="local-filter" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type
|
||||
type="org.springframework.integration.file.filters.FileListFilter" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
<xsd:documentation>
|
||||
Allows you to specify a reference to a
|
||||
[org.springframework.integration.file.filters.FileListFilter]
|
||||
bean. This filter is applied to files after they have been
|
||||
retrieved. The default is an AcceptOnceFileListFilter which means that,
|
||||
even if a new instance of a file is retrieved from the remote server,
|
||||
a message won't be generated. The filter provided here is combined
|
||||
with a filter that prevents the message source from processing
|
||||
files that are currently being downloaded.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="local-directory" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-smb="http://www.springframework.org/schema/integration/smb"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-smb="http://www.springframework.org/schema/integration/smb"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
@@ -12,20 +11,24 @@
|
||||
http://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd">
|
||||
|
||||
<bean id="smbSessionFactory"
|
||||
class="org.springframework.integration.smb.config.SmbInboundChannelAdapterParserTests.TestSessionFactoryBean"/>
|
||||
class="org.springframework.integration.smb.config.SmbInboundChannelAdapterParserTests.TestSessionFactoryBean"/>
|
||||
|
||||
<bean id="acceptAllFilter" class="org.springframework.integration.file.filters.AcceptAllFileListFilter"/>
|
||||
|
||||
<int-smb:inbound-channel-adapter id="smbInbound"
|
||||
channel="smbChannel"
|
||||
session-factory="smbSessionFactory"
|
||||
charset="UTF-8"
|
||||
auto-create-local-directory="true"
|
||||
delete-remote-files="true"
|
||||
filename-pattern="*.txt"
|
||||
local-directory="file:test-temp/local-1"
|
||||
remote-file-separator=""
|
||||
comparator="comparator"
|
||||
temporary-file-suffix=".working.tmp"
|
||||
remote-directory="test-temp/remote-1">
|
||||
auto-startup="false"
|
||||
channel="smbChannel"
|
||||
session-factory="smbSessionFactory"
|
||||
charset="UTF-8"
|
||||
auto-create-local-directory="true"
|
||||
delete-remote-files="true"
|
||||
filename-pattern="*.txt"
|
||||
local-filter="acceptAllFilter"
|
||||
local-directory="file:test-temp/local-1"
|
||||
remote-file-separator=""
|
||||
comparator="comparator"
|
||||
temporary-file-suffix=".working.tmp"
|
||||
remote-directory="test-temp/remote-1">
|
||||
</int-smb:inbound-channel-adapter>
|
||||
|
||||
<bean id="comparator" class="org.mockito.Mockito" factory-method="mock">
|
||||
@@ -33,21 +36,23 @@
|
||||
</bean>
|
||||
|
||||
<int-smb:inbound-channel-adapter
|
||||
channel="smbChannel"
|
||||
session-factory="smbSessionFactory"
|
||||
charset="UTF-8"
|
||||
auto-create-local-directory="true"
|
||||
delete-remote-files="true"
|
||||
filter="entryListFilter"
|
||||
local-directory="file:test-temp/local-2"
|
||||
remote-directory="test-temp/remote-2">
|
||||
channel="smbChannel"
|
||||
auto-startup="false"
|
||||
session-factory="smbSessionFactory"
|
||||
charset="UTF-8"
|
||||
auto-create-local-directory="true"
|
||||
delete-remote-files="true"
|
||||
filter="entryListFilter"
|
||||
local-directory="file:test-temp/local-2"
|
||||
remote-directory="test-temp/remote-2">
|
||||
</int-smb:inbound-channel-adapter>
|
||||
|
||||
<int-smb:inbound-channel-adapter id="simpleAdapter"
|
||||
channel="smbChannel"
|
||||
session-factory="smbSessionFactory"
|
||||
local-directory="file:test-temp/local-3"
|
||||
remote-directory="test-temp/remote-3">
|
||||
channel="smbChannel"
|
||||
auto-startup="false"
|
||||
session-factory="smbSessionFactory"
|
||||
local-directory="file:test-temp/local-3"
|
||||
remote-directory="test-temp/remote-3">
|
||||
</int-smb:inbound-channel-adapter>
|
||||
|
||||
<int:channel id="smbChannel">
|
||||
|
||||
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -69,7 +70,6 @@ public class SmbInboundChannelAdapterParserTests {
|
||||
assertNotNull(queue.comparator());
|
||||
assertEquals("smbInbound", adapter.getComponentName());
|
||||
assertEquals("smb:inbound-channel-adapter", adapter.getComponentType());
|
||||
assertNotNull(TestUtils.getPropertyValue(adapter, "poller"));
|
||||
assertEquals(applicationContext.getBean("smbChannel"), TestUtils.getPropertyValue(adapter, "outputChannel"));
|
||||
SmbInboundFileSynchronizingMessageSource inbound =
|
||||
(SmbInboundFileSynchronizingMessageSource) TestUtils.getPropertyValue(adapter, "source");
|
||||
@@ -90,6 +90,10 @@ public class SmbInboundChannelAdapterParserTests {
|
||||
assertThat(filtersIterator.next(), instanceOf(SmbPersistentAcceptOnceFileListFilter.class));
|
||||
Object sessionFactory = TestUtils.getPropertyValue(fisync, "remoteFileTemplate.sessionFactory");
|
||||
assertTrue(SmbSessionFactory.class.isAssignableFrom(sessionFactory.getClass()));
|
||||
|
||||
FileListFilter<?> acceptAllFilter = this.applicationContext.getBean("acceptAllFilter", FileListFilter.class);
|
||||
assertTrue(TestUtils.getPropertyValue(inbound, "fileSource.scanner.filter.fileFilters", Collection.class)
|
||||
.contains(acceptAllFilter));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user