You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/09/07 10:48:38 UTC
[camel] 02/02: (chores) camel-ftp: test cleanups
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3ce8a39d031fcd41ed39773a6628fb724a013127
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Sep 7 11:14:56 2022 +0200
(chores) camel-ftp: test cleanups
- remove unnecessary code
- ensure increments are atomic
- ensure resources are closed
- use static inner classes
- remove unused throws declarations
- remove redundant toString calls
- use standard charsets constants instead of strings
- use final where possible/relevant
- remove commented test code
---
.../FileToFtpsWithFtpClientConfigRefIT.java | 4 +--
.../integration/FromFilePasswordBeanRefIT.java | 2 +-
.../remote/integration/FromFtpAsyncProcessIT.java | 4 +--
.../file/remote/integration/FromFtpFilterIT.java | 4 +--
.../FromFtpRemoteFileFilterDirectoryIT.java | 4 +--
.../integration/FromFtpRemoteFileFilterIT.java | 4 +--
.../integration/FromFtpRemoteFileSorterIT.java | 4 +--
.../FromFtpSimulateNetworkIssueRecoverIT.java | 4 +--
.../remote/integration/FromFtpThirdPoolOkIT.java | 2 +-
.../integration/FtpBadLoginConnectionLeakIT.java | 4 +--
.../FtpBadLoginInProducerConnectionLeakIT.java | 4 +--
.../FtpBadLoginMockNoopConnectionLeakIT.java | 4 +--
.../integration/FtpConsumerAsyncStressIT.java | 2 +-
.../FtpConsumerDeleteNoWritePermissionIT.java | 22 ++++++++-------
.../integration/FtpConsumerIdempotentRefIT.java | 5 ++--
...ConsumerLocalWorkDirectoryAsAbsolutePathIT.java | 2 +-
.../integration/FtpConsumerMoveExpressionIT.java | 4 +--
.../FtpConsumerPostProcessingOnDisconnectIT.java | 4 +--
.../integration/FtpConsumerProcessStrategyIT.java | 10 ++++---
.../FtpConsumerThrowExceptionOnLoginFailedIT.java | 4 +--
.../integration/FtpConsumerWithCharsetIT.java | 12 ++++----
.../integration/FtpEndpointURISanitizedIT.java | 2 +-
.../FtpPollEnrichBridgeErrorHandlerIT.java | 6 ++--
.../remote/integration/FtpPollingConsumerIT.java | 33 +++++++++++-----------
.../integration/FtpProducerExpressionIT.java | 4 +--
.../integration/FtpProducerFileWithCharsetIT.java | 14 ++++-----
.../FtpProducerMultipleSiteCommandIT.java | 2 +-
.../FtpSimpleConsumeStreamingStepwiseFalseIT.java | 2 +-
.../integration/SftpConsumerProcessStrategyIT.java | 10 ++++---
.../sftp/integration/SftpKeyPairECConsumeIT.java | 11 ++------
.../integration/SftpMoveWithOutMessageTest.java | 8 +++---
31 files changed, 101 insertions(+), 100 deletions(-)
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithFtpClientConfigRefIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithFtpClientConfigRefIT.java
index 7b1c9cc75b4..5cc8421ed0c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithFtpClientConfigRefIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithFtpClientConfigRefIT.java
@@ -31,10 +31,10 @@ import org.junit.jupiter.api.condition.EnabledIf;
public class FileToFtpsWithFtpClientConfigRefIT extends FtpsServerExplicitSSLWithoutClientAuthTestSupport {
@BindToRegistry("ftpsClient")
- private FTPSClient client = new FTPSClient("SSLv3");
+ private final FTPSClient client = new FTPSClient("SSLv3");
@BindToRegistry("ftpsClientIn")
- private FTPSClient client1 = new FTPSClient("SSLv3");
+ private final FTPSClient client1 = new FTPSClient("SSLv3");
private String getFtpUrl(boolean in) {
return "ftps://admin@localhost:{{ftp.server.port}}/tmp2/camel?password=admin&initialDelay=2000&ftpClient=#ftpsClient"
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFilePasswordBeanRefIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFilePasswordBeanRefIT.java
index 2e3906be6a6..215e13af956 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFilePasswordBeanRefIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFilePasswordBeanRefIT.java
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
public class FromFilePasswordBeanRefIT extends FtpServerTestSupport {
@BindToRegistry("myPass")
- private String somename = "t%st";
+ private final String somename = "t%st";
protected String getFtpUrl() {
return "ftp://localhost:{{ftp.server.port}}/tmp3/camel?username=us@r&password=#bean:myPass&initialDelay=3000";
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpAsyncProcessIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpAsyncProcessIT.java
index da45220fa07..7db5a895b65 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpAsyncProcessIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpAsyncProcessIT.java
@@ -78,9 +78,9 @@ public class FromFtpAsyncProcessIT extends FtpServerTestSupport {
};
}
- private class MyAsyncProcessor extends AsyncProcessorSupport {
+ private static class MyAsyncProcessor extends AsyncProcessorSupport {
- private ExecutorService executor = Executors.newSingleThreadExecutor();
+ private final ExecutorService executor = Executors.newSingleThreadExecutor();
@Override
public boolean process(final Exchange exchange, final AsyncCallback callback) {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpFilterIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpFilterIT.java
index 2fb073a592d..f6112ae4f7f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpFilterIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpFilterIT.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
public class FromFtpFilterIT extends FtpServerTestSupport {
@BindToRegistry("myFilter")
- private MyFileFilter filter = new MyFileFilter<>();
+ private final MyFileFilter filter = new MyFileFilter<>();
protected String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/filter?password=admin&binary=false&filter=#myFilter";
@@ -69,7 +69,7 @@ public class FromFtpFilterIT extends FtpServerTestSupport {
}
// START SNIPPET: e1
- public class MyFileFilter<T> implements GenericFileFilter<T> {
+ public static class MyFileFilter<T> implements GenericFileFilter<T> {
@Override
public boolean accept(GenericFile<T> file) {
// we don't accept any files starting with skip in the name
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileFilterDirectoryIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileFilterDirectoryIT.java
index 060b4c7aec5..d2700dd88e9 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileFilterDirectoryIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileFilterDirectoryIT.java
@@ -32,7 +32,7 @@ import org.junit.jupiter.api.condition.OS;
public class FromFtpRemoteFileFilterDirectoryIT extends FtpServerTestSupport {
@BindToRegistry("myFilter")
- private MyFileFilter filter = new MyFileFilter<>();
+ private final MyFileFilter filter = new MyFileFilter<>();
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/filefilter?password=admin&recursive=true&filter=#myFilter";
@@ -77,7 +77,7 @@ public class FromFtpRemoteFileFilterDirectoryIT extends FtpServerTestSupport {
}
// START SNIPPET: e1
- public class MyFileFilter<T> implements GenericFileFilter<T> {
+ public static class MyFileFilter<T> implements GenericFileFilter<T> {
@Override
public boolean accept(GenericFile<T> file) {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileFilterIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileFilterIT.java
index 3c72513abee..672da316bf8 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileFilterIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileFilterIT.java
@@ -32,7 +32,7 @@ import org.junit.jupiter.api.condition.OS;
public class FromFtpRemoteFileFilterIT extends FtpServerTestSupport {
@BindToRegistry("myFilter")
- private MyFileFilter filter = new MyFileFilter<>();
+ private final MyFileFilter filter = new MyFileFilter<>();
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/filefilter?password=admin&filter=#myFilter";
@@ -78,7 +78,7 @@ public class FromFtpRemoteFileFilterIT extends FtpServerTestSupport {
}
// START SNIPPET: e1
- public class MyFileFilter<T> implements GenericFileFilter<T> {
+ public static class MyFileFilter<T> implements GenericFileFilter<T> {
@Override
public boolean accept(GenericFile<T> file) {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileSorterIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileSorterIT.java
index 81d6935dffa..eaa144e0ba4 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileSorterIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpRemoteFileSorterIT.java
@@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
public class FromFtpRemoteFileSorterIT extends FtpServerTestSupport {
@BindToRegistry("mySorter")
- private MyRemoteFileSorter sorter = new MyRemoteFileSorter();
+ private final MyRemoteFileSorter sorter = new MyRemoteFileSorter();
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/sorter?password=admin&sorter=#mySorter";
@@ -71,7 +71,7 @@ public class FromFtpRemoteFileSorterIT extends FtpServerTestSupport {
}
// START SNIPPET: e1
- public class MyRemoteFileSorter implements Comparator<RemoteFile<?>> {
+ public static class MyRemoteFileSorter implements Comparator<RemoteFile<?>> {
@Override
public int compare(RemoteFile<?> o1, RemoteFile<?> o2) {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpSimulateNetworkIssueRecoverIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpSimulateNetworkIssueRecoverIT.java
index 9be57fc0dbb..bf3a452f2d5 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpSimulateNetworkIssueRecoverIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpSimulateNetworkIssueRecoverIT.java
@@ -39,7 +39,7 @@ public class FromFtpSimulateNetworkIssueRecoverIT extends FtpServerTestSupport {
private static int rollback;
@BindToRegistry("myPoll")
- private MyPollStrategy strategy = new MyPollStrategy();
+ private final MyPollStrategy strategy = new MyPollStrategy();
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/recover?password=admin&pollStrategy=#myPoll";
@@ -69,7 +69,7 @@ public class FromFtpSimulateNetworkIssueRecoverIT extends FtpServerTestSupport {
};
}
- public class MyPollStrategy extends RemoteFilePollingConsumerPollStrategy {
+ public static class MyPollStrategy extends RemoteFilePollingConsumerPollStrategy {
@Override
public void commit(Consumer consumer, Endpoint endpoint, int polledMessages) {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpThirdPoolOkIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpThirdPoolOkIT.java
index 23c2f1fc940..84b2eaef7a4 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpThirdPoolOkIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FromFtpThirdPoolOkIT.java
@@ -32,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class FromFtpThirdPoolOkIT extends FtpServerTestSupport {
private static int counter;
- private String body = "Hello World this file will be deleted";
+ private final String body = "Hello World this file will be deleted";
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/thirdpool?password=admin&delete=true";
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginConnectionLeakIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginConnectionLeakIT.java
index 34a4fa69fe0..0cc9cfd1f8d 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginConnectionLeakIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginConnectionLeakIT.java
@@ -40,10 +40,10 @@ public class FtpBadLoginConnectionLeakIT extends FtpServerTestSupport {
/**
* Mapping of socket hashcode to two element tab ([connect() called, close() called])
*/
- private Map<Integer, boolean[]> socketAudits = new HashMap<>();
+ private final Map<Integer, boolean[]> socketAudits = new HashMap<>();
@BindToRegistry("sf")
- private SocketFactory sf = new AuditingSocketFactory();
+ private final SocketFactory sf = new AuditingSocketFactory();
private String getFtpUrl() {
return "ftp://dummy@localhost:{{ftp.server.port}}/badlogin?password=cantremeber"
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginInProducerConnectionLeakIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginInProducerConnectionLeakIT.java
index ed4ea11d35d..fee91293681 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginInProducerConnectionLeakIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginInProducerConnectionLeakIT.java
@@ -36,10 +36,10 @@ public class FtpBadLoginInProducerConnectionLeakIT extends FtpServerTestSupport
/**
* Mapping of socket hashcode to two element tab ([connect() called, close() called])
*/
- private Map<Integer, boolean[]> socketAudits = new HashMap<>();
+ private final Map<Integer, boolean[]> socketAudits = new HashMap<>();
@BindToRegistry("sf")
- private SocketFactory sf = new AuditingSocketFactory();
+ private final SocketFactory sf = new AuditingSocketFactory();
private String getFtpUrl() {
return "ftp://dummy@localhost:{{ftp.server.port}}/badlogin?password=cantremeber&maximumReconnectAttempts=3"
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginMockNoopConnectionLeakIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginMockNoopConnectionLeakIT.java
index decf07d2bb9..8d0eed5c706 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginMockNoopConnectionLeakIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpBadLoginMockNoopConnectionLeakIT.java
@@ -50,10 +50,10 @@ public class FtpBadLoginMockNoopConnectionLeakIT extends FtpServerTestSupport {
/**
* Mapping of socket hashcode to two element tab ([connect() called, close() called])
*/
- private Map<Integer, boolean[]> socketAudits = new HashMap<>();
+ private final Map<Integer, boolean[]> socketAudits = new HashMap<>();
@BindToRegistry("sf")
- private SocketFactory sf = new AuditingSocketFactory();
+ private final SocketFactory sf = new AuditingSocketFactory();
private String getFtpUrl() {
return "ftp://dummy@localhost:{{ftp.server.port}}/badlogin?password=cantremeber&maximumReconnectAttempts=3"
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerAsyncStressIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerAsyncStressIT.java
index 133f2b4c13b..739bfbc85db 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerAsyncStressIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerAsyncStressIT.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
public class FtpConsumerAsyncStressIT extends FtpServerTestSupport {
- private int files = 100;
+ private final int files = 100;
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/filestress/?password=admin&maxMessagesPerPoll=25";
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerDeleteNoWritePermissionIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerDeleteNoWritePermissionIT.java
index 56023913f1f..1f6409eb235 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerDeleteNoWritePermissionIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerDeleteNoWritePermissionIT.java
@@ -42,17 +42,19 @@ public class FtpConsumerDeleteNoWritePermissionIT extends FtpServerTestSupport {
@Test
public void testConsumerDeleteNoWritePermission() throws Exception {
- PollingConsumer consumer = context.getEndpoint(getFtpUrl()).createPollingConsumer();
- consumer.start();
- Exchange out = consumer.receive(3000);
- assertNotNull(out, "Should get the file");
- try {
- // give consumer time to try to delete the file
- Thread.sleep(1000);
- consumer.stop();
- } catch (GenericFileOperationFailedException fofe) {
- // expected, ignore
+ try (PollingConsumer consumer = context.getEndpoint(getFtpUrl()).createPollingConsumer()) {
+ consumer.start();
+ Exchange out = consumer.receive(3000);
+ assertNotNull(out, "Should get the file");
+
+ try {
+ // give consumer time to try to delete the file
+ Thread.sleep(1000);
+ consumer.stop();
+ } catch (GenericFileOperationFailedException fofe) {
+ // expected, ignore
+ }
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerIdempotentRefIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerIdempotentRefIT.java
index 97528ee7f77..71782b04a6d 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerIdempotentRefIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerIdempotentRefIT.java
@@ -33,7 +33,7 @@ public class FtpConsumerIdempotentRefIT extends FtpServerTestSupport {
private static boolean invoked;
@BindToRegistry("myIdempotentRepo")
- private MyIdempotentRepository myIdempotentRepo = new MyIdempotentRepository();
+ private final MyIdempotentRepository myIdempotentRepo = new MyIdempotentRepository();
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}"
@@ -77,7 +77,7 @@ public class FtpConsumerIdempotentRefIT extends FtpServerTestSupport {
};
}
- public class MyIdempotentRepository implements IdempotentRepository {
+ public static class MyIdempotentRepository implements IdempotentRepository {
@Override
public boolean add(String messageId) {
@@ -105,7 +105,6 @@ public class FtpConsumerIdempotentRefIT extends FtpServerTestSupport {
@Override
public void clear() {
- return;
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerLocalWorkDirectoryAsAbsolutePathIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerLocalWorkDirectoryAsAbsolutePathIT.java
index 5e6e29b806a..b8383521147 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerLocalWorkDirectoryAsAbsolutePathIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerLocalWorkDirectoryAsAbsolutePathIT.java
@@ -44,7 +44,7 @@ public class FtpConsumerLocalWorkDirectoryAsAbsolutePathIT extends FtpServerTest
protected String getFtpUrl() {
base = testDirectory("lwd").toAbsolutePath();
return "ftp://admin@localhost:{{ftp.server.port}}/lwd/?password=admin&delay=5000&noop=true&localWorkDirectory="
- + base.toString();
+ + base;
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerMoveExpressionIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerMoveExpressionIT.java
index 1430f5a1c24..2580c854154 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerMoveExpressionIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerMoveExpressionIT.java
@@ -34,7 +34,7 @@ import static org.awaitility.Awaitility.await;
public class FtpConsumerMoveExpressionIT extends FtpServerTestSupport {
@BindToRegistry("myguidgenerator")
- private MyGuidGenerator guid = new MyGuidGenerator();
+ private final MyGuidGenerator guid = new MyGuidGenerator();
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/filelanguage?password=admin&delay=5000";
@@ -65,7 +65,7 @@ public class FtpConsumerMoveExpressionIT extends FtpServerTestSupport {
};
}
- public class MyGuidGenerator {
+ public static class MyGuidGenerator {
public String guid() {
return "123";
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerPostProcessingOnDisconnectIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerPostProcessingOnDisconnectIT.java
index f16e8ec5284..7004a0b889a 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerPostProcessingOnDisconnectIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerPostProcessingOnDisconnectIT.java
@@ -87,7 +87,7 @@ public class FtpConsumerPostProcessingOnDisconnectIT extends FtpServerTestSuppor
from("ftp://admin@localhost:{{ftp.server.port}}?password=admin&delete=true").routeId("foo").noAutoStartup()
.process(new Processor() {
@Override
- public void process(Exchange exchange) throws Exception {
+ public void process(Exchange exchange) {
service.disconnectAllSessions(); // disconnect all Sessions on FTP server
}
}).to("mock:result");
@@ -95,7 +95,7 @@ public class FtpConsumerPostProcessingOnDisconnectIT extends FtpServerTestSuppor
.noAutoStartup()
.process(new Processor() {
@Override
- public void process(Exchange exchange) throws Exception {
+ public void process(Exchange exchange) {
service.disconnectAllSessions(); // disconnect all Sessions on FTP server
}
}).to("mock:result");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerProcessStrategyIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerProcessStrategyIT.java
index f7c4a12a5cc..34d94432c50 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerProcessStrategyIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerProcessStrategyIT.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.file.remote.integration;
+import java.util.concurrent.atomic.LongAdder;
+
import org.apache.camel.BindToRegistry;
import org.apache.camel.Exchange;
import org.apache.camel.component.file.GenericFile;
@@ -31,7 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpConsumerProcessStrategyIT extends FtpServerTestSupport {
@BindToRegistry("myStrategy")
- private MyStrategy myStrategy = new MyStrategy();
+ private final MyStrategy myStrategy = new MyStrategy();
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/{{ftp.root.dir}}"
@@ -50,7 +52,7 @@ public class FtpConsumerProcessStrategyIT extends FtpServerTestSupport {
private static class MyStrategy implements GenericFileProcessStrategy {
- private volatile int invoked;
+ private final LongAdder invoked = new LongAdder();
@Override
public void prepareOnStartup(GenericFileOperations operations, GenericFileEndpoint endpoint) {
@@ -71,7 +73,7 @@ public class FtpConsumerProcessStrategyIT extends FtpServerTestSupport {
@Override
public void commit(
GenericFileOperations operations, GenericFileEndpoint endpoint, Exchange exchange, GenericFile file) {
- invoked++;
+ invoked.increment();
}
@Override
@@ -81,7 +83,7 @@ public class FtpConsumerProcessStrategyIT extends FtpServerTestSupport {
}
int getInvoked() {
- return invoked;
+ return invoked.intValue();
}
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerThrowExceptionOnLoginFailedIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerThrowExceptionOnLoginFailedIT.java
index 87d68f38043..9ad8149a99d 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerThrowExceptionOnLoginFailedIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerThrowExceptionOnLoginFailedIT.java
@@ -38,10 +38,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public class FtpConsumerThrowExceptionOnLoginFailedIT extends FtpServerTestSupport {
- private CountDownLatch latch = new CountDownLatch(1);
+ private final CountDownLatch latch = new CountDownLatch(1);
@BindToRegistry("myPoll")
- private MyPoll poll = new MyPoll();
+ private final MyPoll poll = new MyPoll();
private String getFtpUrl() {
return "ftp://dummy@localhost:{{ftp.server.port}}/badlogin?password=cantremember"
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerWithCharsetIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerWithCharsetIT.java
index 05c84a4f9d7..70748ed8e34 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerWithCharsetIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpConsumerWithCharsetIT.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote.integration;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
@@ -51,11 +51,11 @@ public class FtpConsumerWithCharsetIT extends FtpServerTestSupport {
@BeforeEach
public void setUp() throws Exception {
super.setUp();
- byte[] iso = payload.getBytes("iso-8859-1");
- byte[] utf = payload.getBytes("utf-8");
+ byte[] iso = payload.getBytes(StandardCharsets.ISO_8859_1);
+ byte[] utf = payload.getBytes(StandardCharsets.UTF_8);
- LOG.debug("iso: {}", new String(iso, Charset.forName("iso-8859-1")));
- LOG.debug("utf: {}", new String(utf, Charset.forName("utf-8")));
+ LOG.debug("iso: {}", new String(iso, StandardCharsets.ISO_8859_1));
+ LOG.debug("utf: {}", new String(utf, StandardCharsets.UTF_8));
for (byte b : iso) {
LOG.debug("iso byte: {}", b);
@@ -101,7 +101,7 @@ public class FtpConsumerWithCharsetIT extends FtpServerTestSupport {
assertNotNull(file);
assertEquals("iso-8859-1", file.getCharset());
// The String will be encoded with UTF-8 by default
- byte[] data = exchange.getIn().getBody(String.class).getBytes("UTF-8");
+ byte[] data = exchange.getIn().getBody(String.class).getBytes(StandardCharsets.UTF_8);
// data should be in iso, where the danish ae is -61 -90, oe is -61 -72
// aa is -61 -91
// and copyright is -62 -87
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpEndpointURISanitizedIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpEndpointURISanitizedIT.java
index 2e73d1dc1c6..ed40eb7aec4 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpEndpointURISanitizedIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpEndpointURISanitizedIT.java
@@ -31,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
*/
public class FtpEndpointURISanitizedIT extends FtpServerTestSupport {
- private String password = "secret";
+ private final String password = "secret";
protected String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/////foo?password=" + password + "&delay=5000";
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollEnrichBridgeErrorHandlerIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollEnrichBridgeErrorHandlerIT.java
index dfde3005876..6d54fe33b68 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollEnrichBridgeErrorHandlerIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollEnrichBridgeErrorHandlerIT.java
@@ -39,8 +39,8 @@ public class FtpPollEnrichBridgeErrorHandlerIT extends BaseServerTestSupport {
// and turn of auto create as that will pre-login to check if the directory
// exists
// and in case of connection error then throw that as an exception
- private String uri = "ftp://admin@localhost:" + service.getPort() + "/unknown/?password=admin"
- + "&maximumReconnectAttempts=0&autoCreate=false&throwExceptionOnConnectFailed=true&bridgeErrorHandler=true";
+ private final String uri = "ftp://admin@localhost:" + service.getPort() + "/unknown/?password=admin"
+ + "&maximumReconnectAttempts=0&autoCreate=false&throwExceptionOnConnectFailed=true&bridgeErrorHandler=true";
@Test
public void testPollEnrich() throws Exception {
@@ -78,7 +78,7 @@ public class FtpPollEnrichBridgeErrorHandlerIT extends BaseServerTestSupport {
};
}
- private class MyAggregationStrategy implements AggregationStrategy {
+ private static class MyAggregationStrategy implements AggregationStrategy {
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollingConsumerIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollingConsumerIT.java
index 7ffbdd6746b..86bcba60fdd 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollingConsumerIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollingConsumerIT.java
@@ -41,26 +41,27 @@ public class FtpPollingConsumerIT extends FtpServerTestSupport {
public void testPollingConsumer() throws Exception {
template.sendBodyAndHeader(getFtpUrl(), "Hello World", Exchange.FILE_NAME, "hello.txt");
- PollingConsumer consumer = context.getEndpoint(getFtpUrl()).createPollingConsumer();
- consumer.start();
- Exchange exchange = consumer.receive(5000);
- assertNotNull(exchange);
- assertEquals("Hello World", exchange.getIn().getBody(String.class));
+ try (PollingConsumer consumer = context.getEndpoint(getFtpUrl()).createPollingConsumer()) {
+ consumer.start();
+ Exchange exchange = consumer.receive(5000);
+ assertNotNull(exchange);
+ assertEquals("Hello World", exchange.getIn().getBody(String.class));
- // sleep a bit to ensure polling consumer would be suspended after we
- // have used it
- Thread.sleep(1000);
+ // sleep a bit to ensure polling consumer would be suspended after we
+ // have used it
+ Thread.sleep(1000);
- // drop a new file which should not be picked up by the consumer
- template.sendBodyAndHeader(getFtpUrl(), "Bye World", Exchange.FILE_NAME, "bye.txt");
+ // drop a new file which should not be picked up by the consumer
+ template.sendBodyAndHeader(getFtpUrl(), "Bye World", Exchange.FILE_NAME, "bye.txt");
- // sleep a bit to ensure polling consumer would not have picked up that
- // file
- File file = service.ftpFile("polling/bye.txt").toFile();
- await().atMost(1, TimeUnit.SECONDS)
- .untilAsserted(() -> assertTrue(file.exists(), "File should exist " + file));
+ // sleep a bit to ensure polling consumer would not have picked up that
+ // file
+ File file = service.ftpFile("polling/bye.txt").toFile();
+ await().atMost(1, TimeUnit.SECONDS)
+ .untilAsserted(() -> assertTrue(file.exists(), "File should exist " + file));
+ consumer.stop();
+ }
- consumer.stop();
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerExpressionIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerExpressionIT.java
index 60a1aa0b6b4..692de2795c2 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerExpressionIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerExpressionIT.java
@@ -31,7 +31,7 @@ import static org.apache.camel.test.junit5.TestSupport.assertFileExists;
public class FtpProducerExpressionIT extends FtpServerTestSupport {
@BindToRegistry("myguidgenerator")
- private MyGuidGenerator guid = new MyGuidGenerator();
+ private final MyGuidGenerator guid = new MyGuidGenerator();
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/filelanguage?password=admin";
@@ -99,7 +99,7 @@ public class FtpProducerExpressionIT extends FtpServerTestSupport {
assertFileExists(service.ftpFile("filelanguage/mybirthday-19740420.txt"));
}
- public class MyGuidGenerator {
+ public static class MyGuidGenerator {
public String guid() {
return "123";
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerFileWithCharsetIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerFileWithCharsetIT.java
index 9d1f8ef2b2b..5892b664156 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerFileWithCharsetIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerFileWithCharsetIT.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote.integration;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import org.apache.camel.converter.IOConverter;
import org.apache.camel.util.IOHelper;
@@ -36,7 +36,7 @@ public class FtpProducerFileWithCharsetIT extends FtpServerTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(FtpProducerFileWithCharsetIT.class);
- private String payload = "\u00e6\u00f8\u00e5 \u00a9";
+ private final String payload = "\u00e6\u00f8\u00e5 \u00a9";
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/upload?charset=iso-8859-1&password=admin";
@@ -45,11 +45,11 @@ public class FtpProducerFileWithCharsetIT extends FtpServerTestSupport {
@Override
@BeforeEach
public void setUp() throws Exception {
- byte[] utf = payload.getBytes("utf-8");
- byte[] iso = payload.getBytes("iso-8859-1");
+ byte[] utf = payload.getBytes(StandardCharsets.UTF_8);
+ byte[] iso = payload.getBytes(StandardCharsets.ISO_8859_1);
- LOG.debug("utf: {}", new String(utf, Charset.forName("utf-8")));
- LOG.debug("iso: {}", new String(iso, Charset.forName("iso-8859-1")));
+ LOG.debug("utf: {}", new String(utf, StandardCharsets.UTF_8));
+ LOG.debug("iso: {}", new String(iso, StandardCharsets.ISO_8859_1));
for (byte b : utf) {
LOG.debug("utf byte: {}", b);
@@ -66,7 +66,7 @@ public class FtpProducerFileWithCharsetIT extends FtpServerTestSupport {
File file = service.ftpFile("upload/charset/iso.txt").toFile();
assertTrue(file.exists(), "The uploaded file should exists");
- String fileContent = new String(IOConverter.toByteArray(file), "iso-8859-1");
+ String fileContent = new String(IOConverter.toByteArray(file), StandardCharsets.ISO_8859_1);
assertEquals(fileContent, payload);
// Lets also test byte wise
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerMultipleSiteCommandIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerMultipleSiteCommandIT.java
index b2e7fabc378..82292c4f673 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerMultipleSiteCommandIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerMultipleSiteCommandIT.java
@@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerMultipleSiteCommandIT extends FtpServerTestSupport {
@BindToRegistry("site")
- private String site = "help site\nhelp site";
+ private final String site = "help site\nhelp site";
private String getFtpUrl() {
return "ftp://admin@localhost:{{ftp.server.port}}/site?password=admin&siteCommand=#site";
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpSimpleConsumeStreamingStepwiseFalseIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpSimpleConsumeStreamingStepwiseFalseIT.java
index 07e204045cc..12b43bc0170 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpSimpleConsumeStreamingStepwiseFalseIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpSimpleConsumeStreamingStepwiseFalseIT.java
@@ -68,7 +68,7 @@ public class FtpSimpleConsumeStreamingStepwiseFalseIT extends FtpServerTestSuppo
public void configure() {
from("ftp://localhost:{{ftp.server.port}}"
+ "/tmp/mytemp?username=admin&password=admin&delay=10000&disconnect=true&streamDownload=true&stepwise="
- + String.valueOf(isStepwise())).routeId("foo").noAutoStartup()
+ + isStepwise()).routeId("foo").noAutoStartup()
.to("mock:result");
}
};
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpConsumerProcessStrategyIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpConsumerProcessStrategyIT.java
index 7a6e2136934..48f9e1a5877 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpConsumerProcessStrategyIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpConsumerProcessStrategyIT.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.file.remote.sftp.integration;
+import java.util.concurrent.atomic.LongAdder;
+
import org.apache.camel.BindToRegistry;
import org.apache.camel.Exchange;
import org.apache.camel.component.file.GenericFile;
@@ -33,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpConsumerProcessStrategyIT extends SftpServerTestSupport {
@BindToRegistry("myStrategy")
- private MyStrategy myStrategy = new MyStrategy();
+ private final MyStrategy myStrategy = new MyStrategy();
@Test
public void testSftpConsume() {
@@ -51,7 +53,7 @@ public class SftpConsumerProcessStrategyIT extends SftpServerTestSupport {
private static class MyStrategy implements GenericFileProcessStrategy {
- private volatile int invoked;
+ private final LongAdder invoked = new LongAdder();
@Override
public void prepareOnStartup(GenericFileOperations operations, GenericFileEndpoint endpoint) {
@@ -72,7 +74,7 @@ public class SftpConsumerProcessStrategyIT extends SftpServerTestSupport {
@Override
public void commit(
GenericFileOperations operations, GenericFileEndpoint endpoint, Exchange exchange, GenericFile file) {
- invoked++;
+ invoked.increment();
}
@Override
@@ -82,7 +84,7 @@ public class SftpConsumerProcessStrategyIT extends SftpServerTestSupport {
}
int getInvoked() {
- return invoked;
+ return invoked.intValue();
}
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpKeyPairECConsumeIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpKeyPairECConsumeIT.java
index e483959fb77..ddcdc33b426 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpKeyPairECConsumeIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpKeyPairECConsumeIT.java
@@ -31,8 +31,8 @@ import org.junit.jupiter.api.condition.EnabledIf;
@EnabledIf(value = "org.apache.camel.test.infra.ftp.services.embedded.SftpUtil#hasRequiredAlgorithms('src/test/resources/hostkey.pem')")
public class SftpKeyPairECConsumeIT extends SftpServerTestSupport {
+ private static final ByteArrayOutputStream PRIVATE_KEY = new ByteArrayOutputStream();
private static KeyPair keyPair;
- private static ByteArrayOutputStream privateKey = new ByteArrayOutputStream();
@BeforeAll
public static void createKeys() throws Exception {
@@ -85,7 +85,7 @@ public class SftpKeyPairECConsumeIT extends SftpServerTestSupport {
// 86:d=2 hl=3 l= 134 prim: BIT STRING
// and a key with "-----BEGIN EC PRIVATE KEY-----"
com.jcraft.jsch.KeyPair kp = com.jcraft.jsch.KeyPair.genKeyPair(null, com.jcraft.jsch.KeyPair.ECDSA, 521);
- kp.writePrivateKey(privateKey);
+ kp.writePrivateKey(PRIVATE_KEY);
}
@Test
@@ -107,12 +107,7 @@ public class SftpKeyPairECConsumeIT extends SftpServerTestSupport {
@Override
protected RouteBuilder createRouteBuilder() {
- // StringBuilder sb = new StringBuilder(256);
- // sb.append("-----BEGIN EC PRIVATE KEY-----").append("\n");
- // sb.append(Base64.getEncoder().encodeToString(keyPair.getPrivate().getEncoded())).append("\n");
- // sb.append("-----END EC PRIVATE KEY-----").append("\n");
-
- context.getRegistry().bind("privateKey", privateKey.toByteArray());
+ context.getRegistry().bind("privateKey", PRIVATE_KEY.toByteArray());
context.getRegistry().bind("knownHosts", service.buildKnownHosts());
return new RouteBuilder() {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpMoveWithOutMessageTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpMoveWithOutMessageTest.java
index f92cda7ed94..663ca0c0031 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpMoveWithOutMessageTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpMoveWithOutMessageTest.java
@@ -40,7 +40,7 @@ public class SftpMoveWithOutMessageTest extends SftpServerTestSupport {
@Timeout(value = 30)
@Test
- public void testMoveFileForMultiplePollEnrich() throws Exception {
+ public void testMoveFileForMultiplePollEnrich() {
String expected = "Hello World";
// create two files using regular file
@@ -68,11 +68,11 @@ public class SftpMoveWithOutMessageTest extends SftpServerTestSupport {
}
@Override
- protected RouteBuilder[] createRouteBuilders() throws Exception {
+ protected RouteBuilder[] createRouteBuilders() {
TestProcessor processor = new TestProcessor();
return new RouteBuilder[] { new RouteBuilder() {
@Override
- public void configure() throws Exception {
+ public void configure() {
from("vm:trigger")
.pollEnrich(
"sftp://localhost:{{ftp.server.port}}/{{ftp.root.dir}}?username=admin&password=admin&delay=10000&disconnect=true&move=archive")
@@ -85,7 +85,7 @@ public class SftpMoveWithOutMessageTest extends SftpServerTestSupport {
private static class TestProcessor implements Processor {
@Override
- public void process(Exchange exchange) throws Exception {
+ public void process(Exchange exchange) {
DefaultMessage msg = new DefaultMessage(exchange);
msg.setBody(exchange.getIn().getBody());
msg.setHeaders(exchange.getIn().getHeaders());