Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/pr-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,26 @@ jobs:
runs-on: ubuntu-latest

services:

rabbitmq:
image: rabbitmq
image: cyrilix/rabbitmq-mqtt
ports:
- 5672:5672
- 15672:15672
- 1883:1883

mongodb:
image: mongo
ports:
- 27017:27017

redis:
image: redis
ports:
- 6379:6379

steps:

- uses: actions/checkout@v2

- name: Set up JDK 11
Expand Down
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=3239b5ed86c3838a37d983ac100573f64c1f3fd8e1eb6c89fa5f9529b5ec091d
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.springframework.messaging.MessageHandlingException;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.DisabledIf;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;

/**
Expand Down Expand Up @@ -90,8 +89,6 @@ void testReturnConfirmNoChannels(@Autowired IntegrationFlow flow2) throws Except
}

@Test
@DisabledIf("#{systemEnvironment['TRAVIS'] ?: false}")
// needs RabbitMQ 3.7
void testWithReject(@Autowired IntegrationFlow flow, @Autowired RabbitAdmin admin,
@Autowired RabbitTemplate template) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import org.apache.commons.net.ftp.FTPFile;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
Expand Down Expand Up @@ -73,8 +72,8 @@ public class RotatingServersTests extends FtpTestSupport {

private static String tmpDir = getLocalTempFolder().getAbsolutePath() + File.separator + "multiSF";

@BeforeAll
public static void setup() {
@BeforeEach
public void setup() {
FtpRemoteFileTemplate rft = new FtpRemoteFileTemplate(sessionFactory());
rft.execute(s -> {
s.mkdir("foo");
Expand Down Expand Up @@ -117,15 +116,18 @@ public void clean(TestInfo info) {

@AfterEach
public void extraCleanUp(TestInfo info) {
if (info.getTestMethod().get().getName().equals("testFairStreaming")) {
FtpRemoteFileTemplate rft = new FtpRemoteFileTemplate(sessionFactory());
rft.execute(s -> {
FtpRemoteFileTemplate rft = new FtpRemoteFileTemplate(sessionFactory());
rft.execute(s -> {
if (info.getTestMethod().get().getName().equals("testFairStreaming")) {
s.remove("foo/f4");
s.remove("baz/f5");
s.remove("fiz/f6");
return null;
});
}
}
s.remove("foo/f1");
s.remove("baz/f2");
s.remove("fiz/f3");
return null;
});
}

@Test
Expand Down Expand Up @@ -326,7 +328,7 @@ public IntegrationFlow flow() {
.filter(new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "rotate"))
.localDirectory(localDir())
.remoteDirectory("."),
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
.channel(MessageChannels.queue("files"))
.get();
}
Expand All @@ -349,6 +351,7 @@ protected RotatingServerAdvice theAdvice(List<RotationPolicy.KeyDirectory> keyDi
protected File localDir() {
return new File(tmpDir, "fair");
}

}

@Configuration
Expand All @@ -362,7 +365,7 @@ public IntegrationFlow flow() {
.localDirectory(new File(tmpDir, "variable"))
.localFilenameExpression("#remoteDirectory + T(java.io.File).separator + #root")
.remoteDirectory("."),
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
.channel(MessageChannels.queue("files"))
.get();
}
Expand All @@ -378,7 +381,7 @@ public IntegrationFlow flow() {
return IntegrationFlows.from(Ftp.inboundStreamingAdapter(new FtpRemoteFileTemplate(sf()))
.filter(new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "rotate"))
.remoteDirectory("."),
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
.channel(MessageChannels.queue("files"))
.get();
}
Expand All @@ -405,7 +408,7 @@ public IntegrationFlow flow() {
.filter(new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "rotate"))
.remoteDirectory(".")
.maxFetchSize(1),
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
e -> e.poller(Pollers.fixedDelay(1).advice(advice())))
.channel(MessageChannels.queue("files"))
.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,10 @@ public void testNlstAndWorkingDirExpression() throws IOException {
assertThat(files.size()).isEqualTo(3);
assertThat(files).contains("subFtpSource", " ftpSource1.txt", "ftpSource2.txt");

FTPFile[] ftpFiles = ftpSessionFactory.getSession().list(null);
FTPFile[] ftpFiles = ftpSessionFactory.getSession().list("ftpSource");
for (FTPFile ftpFile : ftpFiles) {
if (!ftpFile.isDirectory()) {
assertThat(files.contains(ftpFile.getName())).isTrue();
assertThat(files).contains(ftpFile.getName());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.support.ErrorMessage;
import org.springframework.messaging.support.GenericMessage;

/**
Expand Down Expand Up @@ -415,19 +416,22 @@ public void testNetClientAndServerSSLDifferentContexts() throws Exception {
.isThrownBy(() -> testNetClientAndServerSSLDifferentContexts(true));
}

private void testNetClientAndServerSSLDifferentContexts(boolean badClient) throws Exception {
private void testNetClientAndServerSSLDifferentContexts(boolean badServer) throws Exception {
System.setProperty("javax.net.debug", "all"); // SSL activity in the console
TcpNetServerConnectionFactory server = new TcpNetServerConnectionFactory(0);
TcpSSLContextSupport serverSslContextSupport = new DefaultTcpSSLContextSupport("server.ks",
TcpSSLContextSupport serverSslContextSupport = new DefaultTcpSSLContextSupport(
badServer ? "client.ks" : "server.ks",
"server.truststore.ks", "secret", "secret");
DefaultTcpNetSSLSocketFactorySupport serverTcpSocketFactorySupport =
new DefaultTcpNetSSLSocketFactorySupport(serverSslContextSupport);
server.setTcpSocketFactorySupport(serverTcpSocketFactorySupport);
final List<Message<?>> messages = new ArrayList<Message<?>>();
final CountDownLatch latch = new CountDownLatch(1);
server.registerListener(message -> {
messages.add(message);
latch.countDown();
if (!(message instanceof ErrorMessage)) {
messages.add(message);
latch.countDown();
}
return false;
});
server.setTcpSocketSupport(new DefaultTcpSocketSupport(false) {
Expand All @@ -442,8 +446,7 @@ public void postProcessServerSocket(ServerSocket serverSocket) {
TestingUtilities.waitListening(server, null);

TcpNetClientConnectionFactory client = new TcpNetClientConnectionFactory("localhost", server.getPort());
TcpSSLContextSupport clientSslContextSupport = new DefaultTcpSSLContextSupport(
badClient ? "server.ks" : "client.ks",
TcpSSLContextSupport clientSslContextSupport = new DefaultTcpSSLContextSupport("client.ks",
"client.truststore.ks", "secret", "secret");
DefaultTcpNetSSLSocketFactorySupport clientTcpSocketFactorySupport =
new DefaultTcpNetSSLSocketFactorySupport(clientSslContextSupport);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
}

@Test
@Disabled("Timing is too short for CI/Travis")
@Disabled("Timing is too short for CI")
public void testNoDelayOnClose() throws Exception {
TcpNioServerConnectionFactory cf = new TcpNioServerConnectionFactory(0);
final CountDownLatch reading = new CountDownLatch(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</channel>

<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<beans:property name="host" value="loclahost"/>
<beans:property name="host" value="localhost"/>
<beans:property name="knownHostsResource" value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/>
<beans:property name="privateKeyPassphrase" value="ghj"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<channel id="requestChannel"/>

<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<beans:property name="host" value="loclahost"/>
<beans:property name="host" value="localhost"/>
<beans:property name="knownHostsResource"
value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftpTest"/>
Expand All @@ -25,6 +25,7 @@
channel="requestChannel"
session-factory="sftpSessionFactory"
filter="filter"
auto-startup="false"
remote-directory="/foo"
local-directory="file:foo"
auto-create-local-directory="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,19 @@
xmlns="http://www.springframework.org/schema/integration"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:tool="http://www.springframework.org/schema/tool"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:sftp="http://www.springframework.org/schema/integration/sftp"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/tool https://www.springframework.org/schema/tool/spring-tool.xsd
http://www.springframework.org/schema/lang https://www.springframework.org/schema/lang/spring-lang.xsd




http://www.springframework.org/schema/integration/sftp https://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">

<channel id="requestChannel"/>

<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.SimpleSftpSessionFactory">
<beans:property name="host" value="loclahost"/>
<beans:property name="host" value="localhost"/>
<beans:property name="knownHostsResource" value="local, foo.com, bar.foo"/>
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftpTest"/>
<beans:property name="privateKeyPassphrase" value="ghj"/>
Expand All @@ -30,14 +25,15 @@
</beans:bean>

<sftp:inbound-channel-adapter id="sftpAdapterNoAutoCreate"
channel="requestChannel"
session-factory="sftpSessionFactory"
filter="filter"
filename-pattern="."
remote-directory="/foo"
local-directory="file:local-test-dir"
auto-create-local-directory="false"
auto-delete-remote-files-on-sync="false">
channel="requestChannel"
session-factory="sftpSessionFactory"
filter="filter"
filename-pattern="."
auto-startup="false"
remote-directory="/foo"
local-directory="file:local-test-dir"
auto-create-local-directory="false"
auto-delete-remote-files-on-sync="false">
<poller fixed-rate="1000"/>
</sftp:inbound-channel-adapter>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</beans:bean>

<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<beans:property name="host" value="loclahost"/>
<beans:property name="host" value="localhost"/>
<beans:property name="knownHostsResource"
value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/>
Expand Down Expand Up @@ -76,6 +76,7 @@
session-factory="sftpSessionFactory"
filter="filter"
remote-directory="/foo"
auto-startup="false"
local-directory="file:local-test-dir"
auto-create-local-directory="true"
delete-remote-files="false">
Expand All @@ -87,6 +88,7 @@
channel="requestChannel"
filename-pattern="pattern"
remote-directory="/foo"
auto-startup="false"
local-directory="file:local-test-dir"
auto-create-local-directory="false"
delete-remote-files="false">
Expand All @@ -99,6 +101,7 @@
filename-pattern="pattern"
remote-directory="/foo"
local-directory="file:foo"
auto-startup="false"
auto-create-local-directory="true"
delete-remote-files="false">
<poller fixed-rate="1000"/>
Expand All @@ -113,6 +116,7 @@
filter="filter"
remote-directory="/foo"
local-directory="file:foo"
auto-startup="false"
auto-create-local-directory="false"
delete-remote-files="false">
<poller fixed-rate="1000"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.Lifecycle;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.expression.Expression;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
Expand Down Expand Up @@ -97,6 +98,7 @@ public void testWithLocalFiles() {
assertThat(remoteFileSeparator).isNotNull();
assertThat(remoteFileSeparator).isEqualTo(".");
PollableChannel requestChannel = context.getBean("requestChannel", PollableChannel.class);
((Lifecycle) adapter).start();
assertThat(requestChannel.receive(10000)).isNotNull();
FileListFilter<?> acceptAllFilter = context.getBean("acceptAllFilter", FileListFilter.class);
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<channel id="inboundFilesChannel"/>

<beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<beans:property name="host" value="loclahost"/>
<beans:property name="host" value="localhost"/>
<beans:property name="knownHostsResource"
value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
<beans:property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftpTest"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
http://www.springframework.org/schema/integration/sftp https://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">

<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="loclahost"/>
<property name="host" value="localhost"/>
<property name="knownHostsResource"
value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
<property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/>
Expand Down