You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2019/11/30 15:36:53 UTC
[camel] 01/01: CAMEL-11807: Migrated camel-ftp tests to JUnit 5
This is an automated email from the ASF dual-hosted git repository.
aldettinger pushed a commit to branch CAMEL-11807
in repository https://gitbox.apache.org/repos/asf/camel.git
commit c599845d81c8bd6bdfdc6b4a284d9531e794a243
Author: aldettinger <al...@gmail.com>
AuthorDate: Sat Nov 30 12:26:32 2019 +0100
CAMEL-11807: Migrated camel-ftp tests to JUnit 5
---
components/camel-ftp/pom.xml | 13 ++++++-
.../file/remote/BaseServerTestSupport.java | 9 +++--
.../remote/ConsumerTemplateFtpShutdownTest.java | 4 ++-
.../file/remote/FileToFtpTempFileNameTest.java | 6 ++--
.../FileToFtpsExplicitSSLWithClientAuthTest.java | 2 +-
...FileToFtpsExplicitSSLWithoutClientAuthTest.java | 2 +-
.../FileToFtpsExplicitTLSWithClientAuthTest.java | 2 +-
...FileToFtpsExplicitTLSWithoutClientAuthTest.java | 2 +-
.../FileToFtpsImplicitSSLWithClientAuthTest.java | 2 +-
...FileToFtpsImplicitSSLWithoutClientAuthTest.java | 2 +-
.../FileToFtpsImplicitTLSWithClientAuthTest.java | 2 +-
...FileToFtpsImplicitTLSWithoutClientAuthTest.java | 2 +-
...psWithCustomKeyAndTrustStorePropertiesTest.java | 2 +-
...leToFtpsWithCustomTrustStorePropertiesTest.java | 2 +-
.../FileToFtpsWithDefaultSettingsIPV6Test.java | 6 ++--
.../remote/FileToFtpsWithDefaultSettingsTest.java | 2 +-
.../FileToFtpsWithFtpClientConfigRefTest.java | 2 +-
.../remote/FromFilePercentSignInPasswordTest.java | 2 +-
...FromFileToFtpDefaultRootRenameStrategyTest.java | 8 +++--
.../file/remote/FromFileToFtpDeleteTest.java | 9 +++--
.../component/file/remote/FromFileToFtpTest.java | 2 +-
.../file/remote/FromFileToFtpWithChmodTest.java | 2 +-
.../remote/FromFileTransferLoggingLevelTest.java | 2 +-
.../FromFileTransferLoggingLevelVerboseTest.java | 2 +-
.../file/remote/FromFtpActivePortRangeTest.java | 6 ++--
.../file/remote/FromFtpAsyncProcessTest.java | 8 +++--
.../file/remote/FromFtpClientConfigRefTest.java | 6 ++--
.../file/remote/FromFtpClientDataTimeoutTest.java | 6 ++--
.../file/remote/FromFtpClientSoTimeout2Test.java | 6 ++--
.../file/remote/FromFtpClientSoTimeout3Test.java | 6 ++--
.../file/remote/FromFtpClientSoTimeoutTest.java | 6 ++--
.../FromFtpConsumerTemplateRollbackTest.java | 13 ++++---
.../file/remote/FromFtpConsumerTemplateTest.java | 14 +++++---
.../file/remote/FromFtpDeleteFileTest.java | 13 ++++---
.../remote/FromFtpDirectoryToBinaryFilesTest.java | 18 +++++-----
.../FromFtpDoNotDeleteFileIfProcessFailsTest.java | 12 ++++---
.../FromFtpExclusiveReadNoneStrategyTest.java | 16 +++++----
.../component/file/remote/FromFtpFilterTest.java | 2 +-
.../file/remote/FromFtpKeepLastModifiedTest.java | 15 ++++----
...FromFtpMoveFileAbsoluteFolderRecursiveTest.java | 6 ++--
.../file/remote/FromFtpMoveFilePostfixTest.java | 10 +++---
.../file/remote/FromFtpMoveFilePrefixTest.java | 10 +++---
.../file/remote/FromFtpMoveFileRecursiveTest.java | 6 ++--
.../component/file/remote/FromFtpMoveFileTest.java | 10 +++---
...FromFtpMoveFileToHiddenFolderRecursiveTest.java | 6 ++--
...tpNoEndpointPathRelativeMoveToAbsoluteTest.java | 6 ++--
.../component/file/remote/FromFtpNoFilesTest.java | 5 ++-
.../remote/FromFtpNoopIdempotentFalseTest.java | 10 +++---
.../component/file/remote/FromFtpNoopTest.java | 10 +++---
.../file/remote/FromFtpNotDownloadTest.java | 11 +++---
.../file/remote/FromFtpPassiveModeTest.java | 6 ++--
.../file/remote/FromFtpPollFileOnlyTest.java | 6 ++--
.../file/remote/FromFtpPreMoveDeleteTest.java | 13 ++++---
.../remote/FromFtpPreMoveFileExpressionTest.java | 12 ++++---
.../file/remote/FromFtpPreMoveFilePostfixTest.java | 12 ++++---
.../file/remote/FromFtpPreMoveFilePrefixTest.java | 12 ++++---
.../file/remote/FromFtpPreMoveNoopTest.java | 12 ++++---
.../file/remote/FromFtpRecursiveNoopTest.java | 6 ++--
.../FromFtpRecursiveNotStepwiseNoBasePathTest.java | 6 ++--
.../file/remote/FromFtpRegexPatternTest.java | 6 ++--
.../FromFtpRemoteFileFilterDirectoryTest.java | 15 ++++----
.../file/remote/FromFtpRemoteFileFilterTest.java | 15 ++++----
.../FromFtpRemoteFileSortByExpressionTest.java | 6 ++--
...tpRemoteFileSortByIgnoreCaseExpressionTest.java | 6 ++--
...romFtpRemoteFileSortByNestedExpressionTest.java | 6 ++--
.../file/remote/FromFtpRemoteFileSorterTest.java | 6 ++--
.../file/remote/FromFtpSedaDeleteFileTest.java | 13 ++++---
.../FromFtpServerLanguageCodeAndTimeoutTest.java | 6 ++--
.../file/remote/FromFtpServerLanguageCodeTest.java | 6 ++--
.../FromFtpSetNamesWithMultiDirectoriesTest.java | 19 +++++-----
...leNoEndpointPathRelativeMoveToAbsoluteTest.java | 6 ++--
...leNoEndpointPathRelativeMoveToRelativeTest.java | 6 ++--
.../FromFtpSimpleRelativeMoveToAbsoluteTest.java | 6 ++--
.../FromFtpSimpleRelativeMoveToRelativeTest.java | 6 ++--
.../FromFtpSimulateNetworkIssueRecoverTest.java | 7 ++--
.../FromFtpStartingDirAndFileNameClashTest.java | 6 ++--
.../file/remote/FromFtpThirdPoolOkTest.java | 15 +++++---
.../FromFtpToAsciiFileNoBodyConversionTest.java | 6 ++--
.../file/remote/FromFtpToAsciiFileTest.java | 12 ++++---
.../file/remote/FromFtpToBinaryFileTest.java | 14 ++++----
.../file/remote/FromFtpToBinaryFilesTest.java | 18 +++++-----
.../file/remote/FromFtpToBinarySampleTest.java | 4 +--
.../remote/FromFtpToFileNoFileNameHeaderTest.java | 6 ++--
.../component/file/remote/FromFtpToMockTest.java | 2 +-
.../file/remote/FromFtpTwoSlashesIssueTest.java | 10 +++---
.../file/remote/FromFtpUseListFalseTest.java | 6 ++--
.../remote/FromQueueThenConsumeFtpToMockTest.java | 6 ++--
.../component/file/remote/FtpAnonymousTest.java | 6 ++--
.../file/remote/FtpBadLoginConnectionLeakTest.java | 9 +++--
.../FtpBadLoginInProducerConnectionLeakTest.java | 11 +++---
.../FtpBadLoginMockNoopConnectionLeakTest.java | 22 ++++++++----
.../file/remote/FtpBrowsableEndpointTest.java | 19 ++++++----
.../file/remote/FtpChangedReadLockTest.java | 7 ++--
.../file/remote/FtpChangedRootDirReadLockTest.java | 7 ++--
.../remote/FtpChangedZeroLengthReadLockTest.java | 4 ++-
.../file/remote/FtpConnectTimeoutTest.java | 2 +-
.../file/remote/FtpConsumerAbsolutePathTest.java | 9 +++--
.../file/remote/FtpConsumerAsyncStressTest.java | 6 ++--
.../file/remote/FtpConsumerAutoCreateTest.java | 9 +++--
.../file/remote/FtpConsumerBodyAsStringTest.java | 9 +++--
.../FtpConsumerDeleteNoWritePermissionTest.java | 10 +++---
.../FtpConsumerDirectoriesNotMatchedTest.java | 6 ++--
.../file/remote/FtpConsumerDisconnectTest.java | 13 ++++---
.../remote/FtpConsumerDoneFileNameFixedTest.java | 6 ++--
.../file/remote/FtpConsumerDoneFileNameTest.java | 6 ++--
.../remote/FtpConsumerDualDoneFileNameTest.java | 2 +-
.../file/remote/FtpConsumerExcludeNameTest.java | 6 ++--
.../file/remote/FtpConsumerFileSplitTest.java | 2 +-
.../remote/FtpConsumerIPV6BodyAsStringTest.java | 13 ++++---
.../FtpConsumerIdempotentKeyChangedIssueTest.java | 2 +-
.../remote/FtpConsumerIdempotentMemoryRefTest.java | 5 ++-
.../file/remote/FtpConsumerIdempotentRefTest.java | 7 ++--
.../file/remote/FtpConsumerIdempotentTest.java | 2 +-
.../file/remote/FtpConsumerIncludeNameTest.java | 6 ++--
...nsumerLocalWorkDirectoryAsAbsolutePathTest.java | 20 +++++++----
.../FtpConsumerLocalWorkDirectoryDirectTest.java | 17 +++++----
.../remote/FtpConsumerLocalWorkDirectoryTest.java | 18 ++++++----
.../remote/FtpConsumerMaxMessagesPerPollTest.java | 6 ++--
.../file/remote/FtpConsumerMoveExpressionTest.java | 11 +++---
.../remote/FtpConsumerMultipleDirectoriesTest.java | 10 ++++--
.../FtpConsumerNotEagerMaxMessagesPerPollTest.java | 6 ++--
.../remote/FtpConsumerProcessStrategyTest.java | 8 +++--
.../remote/FtpConsumerRelativeFileNameTest.java | 8 +++--
.../file/remote/FtpConsumerReplyStringTest.java | 2 +-
.../file/remote/FtpConsumerResumeDownloadTest.java | 18 ++++++----
.../file/remote/FtpConsumerSkipDotFilesTest.java | 6 ++--
.../file/remote/FtpConsumerTemplateTest.java | 17 +++++----
.../FtpConsumerTemplateUseListFalseTest.java | 13 ++++---
...FtpConsumerThrowExceptionOnLoginFailedTest.java | 8 +++--
.../FtpConsumerUsingFTPClientConfigTest.java | 6 ++--
.../file/remote/FtpConsumerWithCharsetTest.java | 26 +++++++++-----
.../remote/FtpConsumerWithNoFileOptionTest.java | 9 +++--
.../file/remote/FtpEndpointURISanitizedTest.java | 4 ++-
.../file/remote/FtpIllegalOptionsTest.java | 6 ++--
.../component/file/remote/FtpLoginNoRetryTest.java | 8 +++--
.../camel/component/file/remote/FtpLoginTest.java | 11 ++++--
.../FtpNoReconnectAttemptUnknownHostTest.java | 2 +-
.../FtpPollEnrichBridgeErrorHandlerTest.java | 5 +--
...llEnrichConsumeWithDisconnectAndDeleteTest.java | 12 +++++--
.../remote/FtpPollingConsumerIdleMessageTest.java | 8 +++--
.../file/remote/FtpPollingConsumerTest.java | 8 +++--
...pProducerAllowNullBodyFileAlreadyExistTest.java | 6 ++--
.../file/remote/FtpProducerAllowNullBodyTest.java | 10 ++++--
.../file/remote/FtpProducerBuildDirectoryTest.java | 7 ++--
.../FtpProducerBuildPartOfDirectoryTest.java | 9 +++--
.../file/remote/FtpProducerConcurrentTest.java | 6 ++--
.../remote/FtpProducerConnectErrorsHeaderTest.java | 2 +-
.../FtpProducerDisconnectOnBatchCompleteTest.java | 12 ++++---
.../file/remote/FtpProducerDisconnectTest.java | 13 ++++---
.../file/remote/FtpProducerDoneFileNameTest.java | 27 +++++++++------
.../file/remote/FtpProducerExpressionTest.java | 9 +++--
...FtpProducerFileExistAppendNoFileBeforeTest.java | 8 +++--
.../remote/FtpProducerFileExistAppendTest.java | 8 +++--
.../file/remote/FtpProducerFileExistFailTest.java | 13 ++++---
.../remote/FtpProducerFileExistIgnoreTest.java | 8 +++--
...pProducerFileExistOverrideNoFileBeforeTest.java | 8 +++--
.../remote/FtpProducerFileExistOverrideTest.java | 6 ++--
.../FtpProducerFileExistOverrideTwoUploadTest.java | 5 ++-
.../remote/FtpProducerFileWithCharsetTest.java | 26 +++++++++-----
.../FtpProducerFileWithPathNoStepwiseTest.java | 7 ++--
...ileWithPathPathSeparatorAutoNoStepwiseTest.java | 8 +++--
...ileWithPathPathSeparatorUnixNoStepwiseTest.java | 8 +++--
...WithPathPathSeparatorWindowsNoStepwiseTest.java | 8 +++--
.../file/remote/FtpProducerFileWithPathTest.java | 7 ++--
.../FtpProducerJailStartingDirectoryTest.java | 6 +++-
.../file/remote/FtpProducerMoveExistingTest.java | 9 ++++-
.../remote/FtpProducerMultipleSiteCommandTest.java | 7 ++--
.../file/remote/FtpProducerRawPasswordTest.java | 7 ++--
...tpProducerRecipientListParallelTimeoutTest.java | 6 ++--
.../file/remote/FtpProducerRecipientListTest.java | 10 +++---
.../file/remote/FtpProducerReplyStringTest.java | 2 +-
.../remote/FtpProducerRootFileExistFailTest.java | 13 ++++---
.../file/remote/FtpProducerSendNoopFalseTest.java | 7 ++--
.../file/remote/FtpProducerSiteCommandTest.java | 7 ++--
.../remote/FtpProducerTempFileExistIssueTest.java | 7 +++-
.../file/remote/FtpProducerTempPrefixTest.java | 7 ++--
.../remote/FtpProducerToDMoveExistingTest.java | 4 ++-
.../FtpReconnectAttemptServerStoppedTest.java | 2 +-
.../remote/FtpReconnectAttemptUnknownHostTest.java | 2 +-
.../file/remote/FtpRecursiveDepth2Test.java | 2 +-
.../file/remote/FtpRecursiveDepth3Test.java | 2 +-
.../file/remote/FtpRecursiveDepthTest.java | 2 +-
.../file/remote/FtpServerTestSupport.java | 18 ++++++----
.../remote/FtpShutdownCompleteAllTasksTest.java | 10 +++---
.../FtpShutdownCompleteCurrentTaskOnlyTest.java | 10 +++---
.../file/remote/FtpSimpleConsumeAbsoluteTest.java | 2 +-
...ectoryParseWithAbsoluteDepthNoStepwiseTest.java | 2 +-
.../FtpSimpleConsumeStreamingPartialReadTest.java | 5 ++-
.../file/remote/FtpSimpleConsumeStreamingTest.java | 4 ++-
...impleConsumeStreamingWithMultipleFilesTest.java | 4 ++-
.../component/file/remote/FtpSoTimeoutTest.java | 40 ++++++++++++++--------
.../file/remote/FtpStreamingMoveTest.java | 11 +++---
.../FtpThrowExceptionOnConnectionFailedTest.java | 8 +++--
...FtpUtilsExtractDirNameFromAbsolutePathTest.java | 4 +--
.../file/remote/FtpsServerTestSupport.java | 10 ++++--
.../file/remote/OsgiParserFactoryTest.java | 15 ++++----
.../component/file/remote/PaddyRouteTest.java | 5 ++-
.../RecipientListErrorHandlingIssueTest.java | 2 +-
...tRemoteFilePollingConsumerPollStrategyTest.java | 6 ++--
.../remote/RemoteFileIgnoreDoPollErrorTest.java | 20 ++++++-----
.../RemoteFileProduceOverruleOnlyOnceTest.java | 8 +++--
...llEnrichConsumeWithDisconnectAndDeleteTest.java | 12 +++++--
.../remote/ToFtpTempFileTargetFileExistTest.java | 10 +++---
.../file/remote/UriConfigurationTest.java | 15 +++++---
.../remote/manual/FtpConsumerCamelManualTest.java | 14 ++++----
.../FtpConsumerCamelRecursiveManualTest.java | 14 ++++----
...ConsumerCamelRecursiveToAbsoluteManualTest.java | 14 ++++----
.../FtpConsumerNotStepwiseCamelManualTest.java | 14 ++++----
...onsumerNotStepwiseCamelRecursiveManualTest.java | 14 ++++----
...StepwiseCamelRecursiveToAbsoluteManualTest.java | 14 ++++----
.../remote/manual/FtpConsumerScottManualTest.java | 14 ++++----
.../FtpConsumerScottRecursiveManualTest.java | 14 ++++----
...FromSftpRecursiveNotStepwiseNoBasePathTest.java | 6 ++--
.../file/remote/sftp/SftpChangedReadLockTest.java | 12 ++++---
.../component/file/remote/sftp/SftpChmodTest.java | 13 ++++---
.../file/remote/sftp/SftpConsumeTemplateTest.java | 5 ++-
.../remote/sftp/SftpConsumerAutoCreateTest.java | 9 +++--
.../remote/sftp/SftpConsumerDisconnectTest.java | 10 +++---
.../sftp/SftpConsumerProcessStrategyTest.java | 8 +++--
.../remote/sftp/SftpConsumerWithCharsetTest.java | 5 ++-
.../file/remote/sftp/SftpECKeyFileConsumeTest.java | 2 +-
.../remote/sftp/SftpFromSedaDeleteFileTest.java | 10 +++---
.../file/remote/sftp/SftpKeyConsumeTest.java | 2 +-
.../file/remote/sftp/SftpKeyFileConsumeTest.java | 2 +-
.../remote/sftp/SftpKeyPairDSAConsumeTest.java | 6 ++--
.../remote/sftp/SftpKeyPairRSAConsumeTest.java | 6 ++--
.../sftp/SftpKeyUriConsumeFromClasspathTest.java | 2 +-
.../file/remote/sftp/SftpKeyUriConsumeTest.java | 2 +-
.../file/remote/sftp/SftpProduceTempFileTest.java | 9 +++--
.../SftpProducerFileWithPathNoStepwiseTest.java | 7 ++--
.../remote/sftp/SftpProducerFileWithPathTest.java | 7 ++--
.../remote/sftp/SftpProducerMoveExistingTest.java | 9 ++++-
.../remote/sftp/SftpProducerWithCharsetTest.java | 7 ++--
.../file/remote/sftp/SftpServerTestSupport.java | 16 ++++++---
.../file/remote/sftp/SftpSetCipherTest.java | 7 ++--
.../file/remote/sftp/SftpSetOperationsTest.java | 7 ++--
.../sftp/SftpSimpleConsumeRecursiveTest.java | 2 +-
.../SftpSimpleConsumeStreamingPartialReadTest.java | 5 ++-
.../sftp/SftpSimpleConsumeStreamingTest.java | 4 ++-
...impleConsumeStreamingWithMultipleFilesTest.java | 4 ++-
.../file/remote/sftp/SftpSimpleConsumeTest.java | 2 +-
.../sftp/SftpSimpleConsumeThroughProxyTest.java | 2 +-
.../remote/sftp/SftpSimpleIPV6ConsumeTest.java | 6 ++--
.../sftp/SftpSimpleProduceDisconnectTest.java | 9 +++--
.../sftp/SftpSimpleProduceNotStepwiseTest.java | 11 +++---
.../file/remote/sftp/SftpSimpleProduceTest.java | 11 +++---
.../sftp/SftpSimpleProduceThroughProxyTest.java | 11 +++---
.../file/remote/sftp/SftpUseListFalseTest.java | 2 +-
.../src/main/docs/test-junit5.adoc | 2 ++
249 files changed, 1261 insertions(+), 765 deletions(-)
diff --git a/components/camel-ftp/pom.xml b/components/camel-ftp/pom.xml
index 9d1b88f..89855e4 100644
--- a/components/camel-ftp/pom.xml
+++ b/components/camel-ftp/pom.xml
@@ -56,7 +56,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
+ <artifactId>camel-test-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -65,6 +65,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>test</scope>
@@ -155,6 +160,12 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <version>${mockito-version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/BaseServerTestSupport.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/BaseServerTestSupport.java
index b14d58f..e32fa8e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/BaseServerTestSupport.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/BaseServerTestSupport.java
@@ -17,15 +17,18 @@
package org.apache.camel.component.file.remote;
import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
public class BaseServerTestSupport extends CamelTestSupport {
+
+ protected static final String LS = System.lineSeparator();
+
protected int port;
private boolean portInitialized;
- @Before
+ @BeforeEach
public void initPort() throws Exception {
if (!portInitialized) {
// call only once per test method (Some tests can call this method manually in setUp method,
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/ConsumerTemplateFtpShutdownTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/ConsumerTemplateFtpShutdownTest.java
index 336063e..314beff 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/ConsumerTemplateFtpShutdownTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/ConsumerTemplateFtpShutdownTest.java
@@ -17,7 +17,9 @@
package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
*
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpTempFileNameTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpTempFileNameTest.java
index 9133180..d041e01 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpTempFileNameTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpTempFileNameTest.java
@@ -21,7 +21,9 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
*
@@ -37,7 +39,7 @@ public class FileToFtpTempFileNameTest extends FtpServerTestSupport {
assertTrue(notify.matchesMockWaitTime());
File file = new File(FTP_ROOT_DIR + "/out/sub/hello.txt");
- assertTrue("File should exists " + file, file.exists());
+ assertTrue(file.exists(), "File should exists " + file);
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitSSLWithClientAuthTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitSSLWithClientAuthTest.java
index d0dfb9d..9c46711 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitSSLWithClientAuthTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitSSLWithClientAuthTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over SSL (explicit) with client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitSSLWithoutClientAuthTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitSSLWithoutClientAuthTest.java
index 72c68e2..df72e92 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitSSLWithoutClientAuthTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitSSLWithoutClientAuthTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over SSL (explicit) without client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitTLSWithClientAuthTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitTLSWithClientAuthTest.java
index 6175c27..f801a47 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitTLSWithClientAuthTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitTLSWithClientAuthTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over TLS (explicit) with client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitTLSWithoutClientAuthTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitTLSWithoutClientAuthTest.java
index 71d04cd..07b6608 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitTLSWithoutClientAuthTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsExplicitTLSWithoutClientAuthTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over TLS (explicit) without client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitSSLWithClientAuthTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitSSLWithClientAuthTest.java
index e71182a..afb0aa6 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitSSLWithClientAuthTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitSSLWithClientAuthTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over SSL (implicit) with client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitSSLWithoutClientAuthTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitSSLWithoutClientAuthTest.java
index 4b28c23..81dde79 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitSSLWithoutClientAuthTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitSSLWithoutClientAuthTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over SSL (implicit) without client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitTLSWithClientAuthTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitTLSWithClientAuthTest.java
index 5301d96..274cb23 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitTLSWithClientAuthTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitTLSWithClientAuthTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over TLS (implicit) with client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitTLSWithoutClientAuthTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitTLSWithoutClientAuthTest.java
index 5f0a92f..639ccb9 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitTLSWithoutClientAuthTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsImplicitTLSWithoutClientAuthTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over TLS (implicit) without client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithCustomKeyAndTrustStorePropertiesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithCustomKeyAndTrustStorePropertiesTest.java
index b7dfca3..cff8b4c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithCustomKeyAndTrustStorePropertiesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithCustomKeyAndTrustStorePropertiesTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over SSL (explicit) and without client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithCustomTrustStorePropertiesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithCustomTrustStorePropertiesTest.java
index 568800c..bc3ccc1 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithCustomTrustStorePropertiesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithCustomTrustStorePropertiesTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over SSL (explicit) and without client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithDefaultSettingsIPV6Test.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithDefaultSettingsIPV6Test.java
index e0599ad..d00260a 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithDefaultSettingsIPV6Test.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithDefaultSettingsIPV6Test.java
@@ -18,13 +18,13 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over TLS (explicit) and without client authentication
*/
-@Ignore
+@Disabled
public class FileToFtpsWithDefaultSettingsIPV6Test extends FtpsServerExplicitTLSWithoutClientAuthTestSupport {
private String getFtpUrl() {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithDefaultSettingsTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithDefaultSettingsTest.java
index 8e4ab70..f243c40 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithDefaultSettingsTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithDefaultSettingsTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over TLS (explicit) and without client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithFtpClientConfigRefTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithFtpClientConfigRefTest.java
index 40db73e..9c84452 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithFtpClientConfigRefTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FileToFtpsWithFtpClientConfigRefTest.java
@@ -20,7 +20,7 @@ import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.commons.net.ftp.FTPSClient;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the ftps component over SSL (explicit) and without client authentication
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFilePercentSignInPasswordTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFilePercentSignInPasswordTest.java
index 8bef48d..0b047b6 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFilePercentSignInPasswordTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFilePercentSignInPasswordTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FromFilePercentSignInPasswordTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDefaultRootRenameStrategyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDefaultRootRenameStrategyTest.java
index 8467aaf..059201e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDefaultRootRenameStrategyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDefaultRootRenameStrategyTest.java
@@ -24,13 +24,15 @@ import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FromFileToFtpDefaultRootRenameStrategyTest extends FtpServerTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java
index a28fcbf..47ac0d0 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java
@@ -22,7 +22,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FromFileToFtpDeleteTest extends FtpServerTestSupport {
@@ -44,11 +47,11 @@ public class FromFileToFtpDeleteTest extends FtpServerTestSupport {
// file should be deleted
File file = new File("target/delete/hello.txt");
- assertFalse("File should be deleted", file.exists());
+ assertFalse(file.exists(), "File should be deleted");
// file should exists on ftp server
file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("File should exist on ftp server", file.exists());
+ assertTrue(file.exists(), "File should exist on ftp server");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpTest.java
index 3bf5ff9..ac22df6 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FromFileToFtpTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpWithChmodTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpWithChmodTest.java
index 2b86289..c95158f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpWithChmodTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpWithChmodTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FromFileToFtpWithChmodTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileTransferLoggingLevelTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileTransferLoggingLevelTest.java
index e18274cd..dd9ee72 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileTransferLoggingLevelTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileTransferLoggingLevelTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FromFileTransferLoggingLevelTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileTransferLoggingLevelVerboseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileTransferLoggingLevelVerboseTest.java
index babdf07..dbe6870 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileTransferLoggingLevelVerboseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileTransferLoggingLevelVerboseTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FromFileTransferLoggingLevelVerboseTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpActivePortRangeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpActivePortRangeTest.java
index f026768..cd091ae 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpActivePortRangeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpActivePortRangeTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpActivePortRangeTest extends FtpServerTestSupport {
@@ -31,7 +31,7 @@ public class FromFtpActivePortRangeTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpAsyncProcessTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpAsyncProcessTest.java
index ccc9342..aefa3d1 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpAsyncProcessTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpAsyncProcessTest.java
@@ -24,7 +24,9 @@ import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.support.AsyncProcessorSupport;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
/**
*
@@ -54,10 +56,10 @@ public class FromFtpAsyncProcessTest extends FtpServerTestSupport {
Thread.sleep(1000);
File hello = new File(FTP_ROOT_DIR + "/async/hello.txt");
- assertFalse("File should not exist " + hello, hello.exists());
+ assertFalse(hello.exists(), "File should not exist " + hello);
File bye = new File(FTP_ROOT_DIR + "/async/bye.txt");
- assertFalse("File should not exist " + bye, bye.exists());
+ assertFalse(bye.exists(), "File should not exist " + bye);
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientConfigRefTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientConfigRefTest.java
index c3b09cc..a309cdf 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientConfigRefTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientConfigRefTest.java
@@ -23,8 +23,8 @@ import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.commons.net.ftp.FTPClientConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpClientConfigRefTest extends FtpServerTestSupport {
@@ -43,7 +43,7 @@ public class FromFtpClientConfigRefTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientDataTimeoutTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientDataTimeoutTest.java
index fb56682..9e85058 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientDataTimeoutTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientDataTimeoutTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpClientDataTimeoutTest extends FtpServerTestSupport {
@@ -31,7 +31,7 @@ public class FromFtpClientDataTimeoutTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeout2Test.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeout2Test.java
index aee18c5..6eac7d7 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeout2Test.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeout2Test.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpClientSoTimeout2Test extends FtpServerTestSupport {
@@ -31,7 +31,7 @@ public class FromFtpClientSoTimeout2Test extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeout3Test.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeout3Test.java
index 40bdb6b..794772f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeout3Test.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeout3Test.java
@@ -20,9 +20,11 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
import org.apache.commons.net.ftp.FTPFile;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Test re-creating operations
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeoutTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeoutTest.java
index 90cb2f6..2f3119c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeoutTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpClientSoTimeoutTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpClientSoTimeoutTest extends FtpServerTestSupport {
@@ -31,7 +31,7 @@ public class FromFtpClientSoTimeoutTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpConsumerTemplateRollbackTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpConsumerTemplateRollbackTest.java
index 91eae9b..660b37f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpConsumerTemplateRollbackTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpConsumerTemplateRollbackTest.java
@@ -22,8 +22,13 @@ import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
public class FromFtpConsumerTemplateRollbackTest extends FtpServerTestSupport {
@@ -37,7 +42,7 @@ public class FromFtpConsumerTemplateRollbackTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -68,7 +73,7 @@ public class FromFtpConsumerTemplateRollbackTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpConsumerTemplateTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpConsumerTemplateTest.java
index 442385a..667e03a 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpConsumerTemplateTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpConsumerTemplateTest.java
@@ -21,8 +21,12 @@ import java.io.File;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Producer;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FromFtpConsumerTemplateTest extends FtpServerTestSupport {
@@ -31,7 +35,7 @@ public class FromFtpConsumerTemplateTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -44,7 +48,7 @@ public class FromFtpConsumerTemplateTest extends FtpServerTestSupport {
// assert the file is deleted
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
- assertFalse("The file should have been deleted", file.exists());
+ assertFalse(file.exists(), "The file should have been deleted");
}
private void prepareFtpServer() throws Exception {
@@ -61,7 +65,7 @@ public class FromFtpConsumerTemplateTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDeleteFileTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDeleteFileTest.java
index 09c35a7..1a79103 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDeleteFileTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDeleteFileTest.java
@@ -23,8 +23,11 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test delete option.
@@ -36,7 +39,7 @@ public class FromFtpDeleteFileTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -54,7 +57,7 @@ public class FromFtpDeleteFileTest extends FtpServerTestSupport {
// assert the file is deleted
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
- assertFalse("The file should have been deleted", file.exists());
+ assertFalse(file.exists(), "The file should have been deleted");
}
private void prepareFtpServer() throws Exception {
@@ -71,7 +74,7 @@ public class FromFtpDeleteFileTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java
index 9f7819b..4e7a1da 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java
@@ -22,8 +22,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to verify that we can pool a BINARY file in a directory from the
@@ -37,7 +39,7 @@ public class FromFtpDirectoryToBinaryFilesTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -51,17 +53,17 @@ public class FromFtpDirectoryToBinaryFilesTest extends FtpServerTestSupport {
Exchange ex = resultEndpoint.getExchanges().get(0);
byte[] bytes = ex.getIn().getBody(byte[].class);
- assertTrue("Logo size wrong", bytes.length > 10000);
+ assertTrue(bytes.length > 10000, "Logo size wrong");
// assert the file
File file = new File("target/ftptest/logo1.jpeg");
- assertTrue("The binary file should exists", file.exists());
- assertTrue("Logo size wrong", file.length() > 10000);
+ assertTrue(file.exists(), "The binary file should exists");
+ assertTrue(file.length() > 10000, "Logo size wrong");
// assert the file
file = new File("target/ftptest/logo.jpeg");
- assertTrue(" The binary file should exists", file.exists());
- assertTrue("Logo size wrong", file.length() > 10000);
+ assertTrue(file.exists(), " The binary file should exists");
+ assertTrue(file.length() > 10000, "Logo size wrong");
}
private void prepareFtpServer() throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDoNotDeleteFileIfProcessFailsTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDoNotDeleteFileIfProcessFailsTest.java
index e1175e1..b7ffaed 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDoNotDeleteFileIfProcessFailsTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDoNotDeleteFileIfProcessFailsTest.java
@@ -24,8 +24,10 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FromFtpDoNotDeleteFileIfProcessFailsTest extends FtpServerTestSupport {
@@ -34,7 +36,7 @@ public class FromFtpDoNotDeleteFileIfProcessFailsTest extends FtpServerTestSuppo
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -53,7 +55,7 @@ public class FromFtpDoNotDeleteFileIfProcessFailsTest extends FtpServerTestSuppo
// assert the file is deleted
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
- assertTrue("The file should NOT have been deleted", file.exists());
+ assertTrue(file.exists(), "The file should NOT have been deleted");
}
private void prepareFtpServer() throws Exception {
@@ -70,7 +72,7 @@ public class FromFtpDoNotDeleteFileIfProcessFailsTest extends FtpServerTestSuppo
// assert file is created
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpExclusiveReadNoneStrategyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpExclusiveReadNoneStrategyTest.java
index edd870c..bba9bfc 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpExclusiveReadNoneStrategyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpExclusiveReadNoneStrategyTest.java
@@ -24,10 +24,16 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.apache.camel.test.junit5.TestSupport.createDirectory;
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
/**
* Unit test to verify *NON* exclusive read.
*/
@@ -40,12 +46,10 @@ public class FromFtpExclusiveReadNoneStrategyTest extends FtpServerTestSupport {
+ "&readLock=none&delay=500";
}
+ // Cannot test on windows due file system works differently with file locks
+ @DisabledOnOs(OS.WINDOWS)
@Test
public void testPollFileWhileSlowFileIsBeingWrittenUsingNonExclusiveRead() throws Exception {
- // cannot test on windows due file system works differently with file locks
- if (isPlatform("windows")) {
- return;
- }
context.addRoutes(new RouteBuilder() {
@Override
@@ -70,7 +74,7 @@ public class FromFtpExclusiveReadNoneStrategyTest extends FtpServerTestSupport {
// file currently in progress of being written - so we get only the Hello World part
String body = mock.getReceivedExchanges().get(0).getIn().getBody(String.class);
LOG.debug("Body is: " + body);
- assertFalse("Should not wait and read the entire file", body.endsWith("Bye World"));
+ assertFalse(body.endsWith("Bye World"), "Should not wait and read the entire file");
}
private static class MySlowFileProcessor implements Processor {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpFilterTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpFilterTest.java
index 97350fe..0f6e5f6 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpFilterTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpFilterTest.java
@@ -21,7 +21,7 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.file.GenericFileFilter;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Unit test to test filter option.
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpKeepLastModifiedTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpKeepLastModifiedTest.java
index 53f9a7d..212f510 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpKeepLastModifiedTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpKeepLastModifiedTest.java
@@ -21,8 +21,11 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
/**
* Unit test to test keepLastModified option.
@@ -34,7 +37,7 @@ public class FromFtpKeepLastModifiedTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
template.sendBodyAndHeader(getFtpUrl(), "Hello World", "CamelFileName", "hello.txt");
@@ -61,7 +64,7 @@ public class FromFtpKeepLastModifiedTest extends FtpServerTestSupport {
long t1 = mock.getReceivedExchanges().get(0).getIn().getHeader(Exchange.FILE_LAST_MODIFIED, long.class);
long t2 = new File("target/keep/out/hello.txt").lastModified();
- assertEquals("Timestamp should have been kept", t1, t2);
+ assertEquals(t1, t2, "Timestamp should have been kept");
}
@Test
@@ -85,7 +88,7 @@ public class FromFtpKeepLastModifiedTest extends FtpServerTestSupport {
long t1 = mock.getReceivedExchanges().get(0).getIn().getHeader(Exchange.FILE_LAST_MODIFIED, long.class);
long t2 = new File("target/keep/out/hello.txt").lastModified();
- assertNotSame("Timestamp should NOT have been kept", t1, t2);
+ assertNotSame(t1, t2, "Timestamp should NOT have been kept");
}
@Test
@@ -109,6 +112,6 @@ public class FromFtpKeepLastModifiedTest extends FtpServerTestSupport {
long t1 = mock.getReceivedExchanges().get(0).getIn().getHeader(Exchange.FILE_LAST_MODIFIED, long.class);
long t2 = new File("target/keep/out/hello.txt").lastModified();
- assertNotSame("Timestamp should NOT have been kept", t1, t2);
+ assertNotSame(t1, t2, "Timestamp should NOT have been kept");
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileAbsoluteFolderRecursiveTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileAbsoluteFolderRecursiveTest.java
index 77a2e5d..98d4af3 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileAbsoluteFolderRecursiveTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileAbsoluteFolderRecursiveTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test based on end user problem with SFTP on Windows
@@ -33,7 +33,7 @@ public class FromFtpMoveFileAbsoluteFolderRecursiveTest extends FtpServerTestSup
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFilePostfixTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFilePostfixTest.java
index 3a04d3a..60be9f7 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFilePostfixTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFilePostfixTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test consumer.moveNamePostfix option.
@@ -37,7 +39,7 @@ public class FromFtpMoveFilePostfixTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -67,7 +69,7 @@ public class FromFtpMoveFilePostfixTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/movefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFilePrefixTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFilePrefixTest.java
index 8123094..347ebba 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFilePrefixTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFilePrefixTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test consumer.moveNamePrefix option.
@@ -37,7 +39,7 @@ public class FromFtpMoveFilePrefixTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -67,7 +69,7 @@ public class FromFtpMoveFilePrefixTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/movefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileRecursiveTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileRecursiveTest.java
index ea64260..1b4196f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileRecursiveTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileRecursiveTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test based on end user problem with SFTP on Windows
@@ -33,7 +33,7 @@ public class FromFtpMoveFileRecursiveTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileTest.java
index 5c2d550..5462071 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test both consumer.moveNamePrefix and consumer.moveNamePostfix options.
@@ -37,7 +39,7 @@ public class FromFtpMoveFileTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -67,7 +69,7 @@ public class FromFtpMoveFileTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/movefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileToHiddenFolderRecursiveTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileToHiddenFolderRecursiveTest.java
index 9b19985..221fc89 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileToHiddenFolderRecursiveTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpMoveFileToHiddenFolderRecursiveTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test based on end user problem with SFTP on Windows
@@ -33,7 +33,7 @@ public class FromFtpMoveFileToHiddenFolderRecursiveTest extends FtpServerTestSup
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoEndpointPathRelativeMoveToAbsoluteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoEndpointPathRelativeMoveToAbsoluteTest.java
index 407d4a7..80b9ded 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoEndpointPathRelativeMoveToAbsoluteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoEndpointPathRelativeMoveToAbsoluteTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpNoEndpointPathRelativeMoveToAbsoluteTest extends FtpServerTestSupport {
@@ -30,7 +30,7 @@ public class FromFtpNoEndpointPathRelativeMoveToAbsoluteTest extends FtpServerTe
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoFilesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoFilesTest.java
index a211559..2a07821 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoFilesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoFilesTest.java
@@ -18,7 +18,10 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.createDirectory;
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
/**
* Unit test to verify polling a server with no files to poll.
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoopIdempotentFalseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoopIdempotentFalseTest.java
index 82e534d..7e09e55 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoopIdempotentFalseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoopIdempotentFalseTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test noop and idempotent option.
@@ -36,7 +38,7 @@ public class FromFtpNoopIdempotentFalseTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -52,7 +54,7 @@ public class FromFtpNoopIdempotentFalseTest extends FtpServerTestSupport {
// assert the file is still there
File file = new File(FTP_ROOT_DIR + "/noop/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
private void prepareFtpServer() throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoopTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoopTest.java
index d0005a8..58a79bc 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoopTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNoopTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test noop option.
@@ -36,7 +38,7 @@ public class FromFtpNoopTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -52,7 +54,7 @@ public class FromFtpNoopTest extends FtpServerTestSupport {
// assert the file is still there
File file = new File(FTP_ROOT_DIR + "/noop/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
private void prepareFtpServer() throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNotDownloadTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNotDownloadTest.java
index ed55a38..4b4c887 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNotDownloadTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpNotDownloadTest.java
@@ -22,8 +22,11 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
*
@@ -35,7 +38,7 @@ public class FromFtpNotDownloadTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -68,7 +71,7 @@ public class FromFtpNotDownloadTest extends FtpServerTestSupport {
public void configure() throws Exception {
from(getFtpUrl()).process(new Processor() {
public void process(Exchange exchange) throws Exception {
- assertNull("Should not download the file", exchange.getIn().getBody());
+ assertNull(exchange.getIn().getBody(), "Should not download the file");
assertEquals("hello.txt", exchange.getIn().getHeader(Exchange.FILE_NAME));
}
}).to("mock:result");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPassiveModeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPassiveModeTest.java
index 6456902..4f560495 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPassiveModeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPassiveModeTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpPassiveModeTest extends FtpServerTestSupport {
@@ -31,7 +31,7 @@ public class FromFtpPassiveModeTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPollFileOnlyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPollFileOnlyTest.java
index c351848..d1f8ccd 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPollFileOnlyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPollFileOnlyTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test to poll a file from the FTP server and not a folder as most test is.
@@ -34,7 +34,7 @@ public class FromFtpPollFileOnlyTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveDeleteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveDeleteTest.java
index 7412671..8968bc9 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveDeleteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveDeleteTest.java
@@ -24,8 +24,11 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test preMove with delete option.
@@ -37,7 +40,7 @@ public class FromFtpPreMoveDeleteTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -54,7 +57,7 @@ public class FromFtpPreMoveDeleteTest extends FtpServerTestSupport {
// and file should be deleted
Thread.sleep(1000);
File file = new File(FTP_ROOT_DIR + "/movefile/work/hello.txt");
- assertFalse("The file should have been deleted", file.exists());
+ assertFalse(file.exists(), "The file should have been deleted");
}
private void prepareFtpServer() throws Exception {
@@ -78,7 +81,7 @@ public class FromFtpPreMoveDeleteTest extends FtpServerTestSupport {
public void process(Exchange exchange) throws Exception {
// assert the file is pre moved
File file = new File(FTP_ROOT_DIR + "/movefile/work/hello.txt");
- assertTrue("The file should have been moved", file.exists());
+ assertTrue(file.exists(), "The file should have been moved");
}
}).to("mock:result");
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFileExpressionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFileExpressionTest.java
index a95eda9..e0fe1bc 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFileExpressionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFileExpressionTest.java
@@ -24,8 +24,10 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test preMove option.
@@ -38,7 +40,7 @@ public class FromFtpPreMoveFileExpressionTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -67,7 +69,7 @@ public class FromFtpPreMoveFileExpressionTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/movefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
@@ -78,7 +80,7 @@ public class FromFtpPreMoveFileExpressionTest extends FtpServerTestSupport {
public void process(Exchange exchange) throws Exception {
// assert the file is pre moved
File file = new File(FTP_ROOT_DIR + "/inprogress/hello.bak");
- assertTrue("The file should have been moved", file.exists());
+ assertTrue(file.exists(), "The file should have been moved");
}
}).to("mock:result");
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFilePostfixTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFilePostfixTest.java
index 9eec421..9f02382 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFilePostfixTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFilePostfixTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test preMoveNamePostfix option.
@@ -37,7 +39,7 @@ public class FromFtpPreMoveFilePostfixTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -53,7 +55,7 @@ public class FromFtpPreMoveFilePostfixTest extends FtpServerTestSupport {
// assert the file is moved
File file = new File(FTP_ROOT_DIR + "/movefile/hello.txt.old");
- assertTrue("The file should have been moved", file.exists());
+ assertTrue(file.exists(), "The file should have been moved");
}
private void prepareFtpServer() throws Exception {
@@ -70,7 +72,7 @@ public class FromFtpPreMoveFilePostfixTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/movefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFilePrefixTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFilePrefixTest.java
index 4c99511..5ce7295 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFilePrefixTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFilePrefixTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test preMoveNamePrefix option.
@@ -37,7 +39,7 @@ public class FromFtpPreMoveFilePrefixTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -53,7 +55,7 @@ public class FromFtpPreMoveFilePrefixTest extends FtpServerTestSupport {
// assert the file is moved
File file = new File(FTP_ROOT_DIR + "/movefile/done/hello.txt");
- assertTrue("The file should have been moved", file.exists());
+ assertTrue(file.exists(), "The file should have been moved");
}
private void prepareFtpServer() throws Exception {
@@ -70,7 +72,7 @@ public class FromFtpPreMoveFilePrefixTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/movefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveNoopTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveNoopTest.java
index 35235a4..d60397b 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveNoopTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveNoopTest.java
@@ -24,8 +24,10 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test preMove with noop option.
@@ -37,7 +39,7 @@ public class FromFtpPreMoveNoopTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -54,7 +56,7 @@ public class FromFtpPreMoveNoopTest extends FtpServerTestSupport {
// and file should be kept there
Thread.sleep(1000);
File file = new File(FTP_ROOT_DIR + "/movefile/work/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
private void prepareFtpServer() throws Exception {
@@ -78,7 +80,7 @@ public class FromFtpPreMoveNoopTest extends FtpServerTestSupport {
public void process(Exchange exchange) throws Exception {
// assert the file is pre moved
File file = new File(FTP_ROOT_DIR + "/movefile/work/hello.txt");
- assertTrue("The file should have been moved", file.exists());
+ assertTrue(file.exists(), "The file should have been moved");
}
}).to("mock:result");
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNoopTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNoopTest.java
index 28f05ff..f39944f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNoopTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNoopTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpRecursiveNoopTest extends FtpServerTestSupport {
@@ -30,7 +30,7 @@ public class FromFtpRecursiveNoopTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePathTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePathTest.java
index e8e91f9..e70a81a 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePathTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePathTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpRecursiveNotStepwiseNoBasePathTest extends FtpServerTestSupport {
@@ -29,7 +29,7 @@ public class FromFtpRecursiveNotStepwiseNoBasePathTest extends FtpServerTestSupp
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRegexPatternTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRegexPatternTest.java
index e333f35..ec14659 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRegexPatternTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRegexPatternTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test to verify regexPattern option.
@@ -32,7 +32,7 @@ public class FromFtpRegexPatternTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterDirectoryTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterDirectoryTest.java
index 8dc69da..75bcc66 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterDirectoryTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterDirectoryTest.java
@@ -21,8 +21,10 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.file.GenericFileFilter;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
/**
* Unit test to verify FTP filter option.
@@ -37,19 +39,16 @@ public class FromFtpRemoteFileFilterDirectoryTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
}
+ // Skip testing on AIX as it have an issue with this test with the file filter
+ @DisabledOnOs(OS.AIX)
@Test
public void testFtpFilter() throws Exception {
- if (isPlatform("aix")) {
- // skip testing on AIX as it have an issue with this test with the
- // file filter
- return;
- }
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterTest.java
index 9ca16d6..a6cee87 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterTest.java
@@ -21,8 +21,10 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.file.GenericFileFilter;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
/**
* Unit test to verify FTP filter option.
@@ -37,19 +39,16 @@ public class FromFtpRemoteFileFilterTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
}
+ // Skip testing on AIX as it have an issue with this test with the file filter
+ @DisabledOnOs(OS.AIX)
@Test
public void testFtpFilter() throws Exception {
- if (isPlatform("aix")) {
- // skip testing on AIX as it have an issue with this test with the
- // file filter
- return;
- }
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(2);
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByExpressionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByExpressionTest.java
index 5d2bf26..ca35748 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByExpressionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByExpressionTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test to verify remotefile sortby option.
@@ -31,7 +31,7 @@ public class FromFtpRemoteFileSortByExpressionTest extends FtpServerTestSupport
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByIgnoreCaseExpressionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByIgnoreCaseExpressionTest.java
index e6bec50..d4866bb 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByIgnoreCaseExpressionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByIgnoreCaseExpressionTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test to verify remotefile sortby option.
@@ -31,7 +31,7 @@ public class FromFtpRemoteFileSortByIgnoreCaseExpressionTest extends FtpServerTe
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByNestedExpressionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByNestedExpressionTest.java
index 813b9a3..7051461 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByNestedExpressionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByNestedExpressionTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test to verify remotefile sort by option.
@@ -31,7 +31,7 @@ public class FromFtpRemoteFileSortByNestedExpressionTest extends FtpServerTestSu
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java
index 6bf1acb..1365cdc 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java
@@ -21,8 +21,8 @@ import java.util.Comparator;
import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test to verify remotefile sorter option.
@@ -37,7 +37,7 @@ public class FromFtpRemoteFileSorterTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSedaDeleteFileTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSedaDeleteFileTest.java
index b452e2b..193abf9 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSedaDeleteFileTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSedaDeleteFileTest.java
@@ -23,8 +23,11 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to test delete option.
@@ -36,7 +39,7 @@ public class FromFtpSedaDeleteFileTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -54,7 +57,7 @@ public class FromFtpSedaDeleteFileTest extends FtpServerTestSupport {
// assert the file is deleted
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
- assertFalse("The file should have been deleted", file.exists());
+ assertFalse(file.exists(), "The file should have been deleted");
}
private void prepareFtpServer() throws Exception {
@@ -71,7 +74,7 @@ public class FromFtpSedaDeleteFileTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpServerLanguageCodeAndTimeoutTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpServerLanguageCodeAndTimeoutTest.java
index 655ee47..1e7e492 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpServerLanguageCodeAndTimeoutTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpServerLanguageCodeAndTimeoutTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpServerLanguageCodeAndTimeoutTest extends FtpServerTestSupport {
@@ -32,7 +32,7 @@ public class FromFtpServerLanguageCodeAndTimeoutTest extends FtpServerTestSuppor
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpServerLanguageCodeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpServerLanguageCodeTest.java
index e692f50..0c2dd21 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpServerLanguageCodeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpServerLanguageCodeTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpServerLanguageCodeTest extends FtpServerTestSupport {
@@ -31,7 +31,7 @@ public class FromFtpServerLanguageCodeTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSetNamesWithMultiDirectoriesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSetNamesWithMultiDirectoriesTest.java
index 44e29fa..61ec51c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSetNamesWithMultiDirectoriesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSetNamesWithMultiDirectoriesTest.java
@@ -25,8 +25,11 @@ import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to verify that using option setNames and having multi remote directories the files
@@ -39,7 +42,7 @@ public class FromFtpSetNamesWithMultiDirectoriesTest extends FtpServerTestSuppor
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/ftpsetnamestest");
super.setUp();
@@ -60,17 +63,17 @@ public class FromFtpSetNamesWithMultiDirectoriesTest extends FtpServerTestSuppor
Exchange ex = resultEndpoint.getExchanges().get(0);
byte[] bytes = ex.getIn().getBody(byte[].class);
- assertTrue("Logo size wrong", bytes.length > 10000);
+ assertTrue(bytes.length > 10000, "Logo size wrong");
// assert the file
File file = new File("target/ftpsetnamestest/data1/logo1.jpeg");
- assertTrue("The binary file should exists", file.exists());
- assertTrue("Logo size wrong", file.length() > 10000);
+ assertTrue(file.exists(), "The binary file should exists");
+ assertTrue(file.length() > 10000, "Logo size wrong");
// assert the file
file = new File("target/ftpsetnamestest/data2/logo2.png");
- assertTrue(" The binary file should exists", file.exists());
- assertTrue("Logo size wrong", file.length() > 50000);
+ assertTrue(file.exists(), " The binary file should exists");
+ assertTrue(file.length() > 50000, "Logo size wrong");
}
private void prepareFtpServer() throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleNoEndpointPathRelativeMoveToAbsoluteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleNoEndpointPathRelativeMoveToAbsoluteTest.java
index 74c811e..2476e41 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleNoEndpointPathRelativeMoveToAbsoluteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleNoEndpointPathRelativeMoveToAbsoluteTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpSimpleNoEndpointPathRelativeMoveToAbsoluteTest extends FtpServerTestSupport {
@@ -30,7 +30,7 @@ public class FromFtpSimpleNoEndpointPathRelativeMoveToAbsoluteTest extends FtpSe
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleNoEndpointPathRelativeMoveToRelativeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleNoEndpointPathRelativeMoveToRelativeTest.java
index 952e407..6c04429 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleNoEndpointPathRelativeMoveToRelativeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleNoEndpointPathRelativeMoveToRelativeTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpSimpleNoEndpointPathRelativeMoveToRelativeTest extends FtpServerTestSupport {
@@ -30,7 +30,7 @@ public class FromFtpSimpleNoEndpointPathRelativeMoveToRelativeTest extends FtpSe
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleRelativeMoveToAbsoluteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleRelativeMoveToAbsoluteTest.java
index 4e6427e..3bd1fdd 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleRelativeMoveToAbsoluteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleRelativeMoveToAbsoluteTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpSimpleRelativeMoveToAbsoluteTest extends FtpServerTestSupport {
@@ -30,7 +30,7 @@ public class FromFtpSimpleRelativeMoveToAbsoluteTest extends FtpServerTestSuppor
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleRelativeMoveToRelativeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleRelativeMoveToRelativeTest.java
index 1bef554..fe704cf 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleRelativeMoveToRelativeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimpleRelativeMoveToRelativeTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpSimpleRelativeMoveToRelativeTest extends FtpServerTestSupport {
@@ -30,7 +30,7 @@ public class FromFtpSimpleRelativeMoveToRelativeTest extends FtpServerTestSuppor
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimulateNetworkIssueRecoverTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimulateNetworkIssueRecoverTest.java
index 352845b..5b03234 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimulateNetworkIssueRecoverTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSimulateNetworkIssueRecoverTest.java
@@ -21,7 +21,10 @@ import org.apache.camel.Consumer;
import org.apache.camel.Endpoint;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Simulate network issues by using a custom poll strategy to force exceptions
@@ -51,7 +54,7 @@ public class FromFtpSimulateNetworkIssueRecoverTest extends FtpServerTestSupport
Thread.sleep(2000);
- assertTrue("Should have tried at least 3 times was " + counter, counter >= 3);
+ assertTrue(counter >= 3, "Should have tried at least 3 times was " + counter);
assertEquals(2, rollback);
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpStartingDirAndFileNameClashTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpStartingDirAndFileNameClashTest.java
index c2f558e..d1a53f2 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpStartingDirAndFileNameClashTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpStartingDirAndFileNameClashTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromFtpStartingDirAndFileNameClashTest extends FtpServerTestSupport {
@@ -31,7 +31,7 @@ public class FromFtpStartingDirAndFileNameClashTest extends FtpServerTestSupport
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpThirdPoolOkTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpThirdPoolOkTest.java
index 70d2206..9ef4ede 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpThirdPoolOkTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpThirdPoolOkTest.java
@@ -21,8 +21,13 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FromFtpThirdPoolOkTest extends FtpServerTestSupport {
@@ -34,7 +39,7 @@ public class FromFtpThirdPoolOkTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/thirdpool");
super.setUp();
@@ -57,7 +62,7 @@ public class FromFtpThirdPoolOkTest extends FtpServerTestSupport {
// assert the file is deleted
File file = new File(FTP_ROOT_DIR + "/thirdpool/hello.txt");
- assertFalse("The file should have been deleted", file.exists());
+ assertFalse(file.exists(), "The file should have been deleted");
}
@Override
@@ -76,7 +81,7 @@ public class FromFtpThirdPoolOkTest extends FtpServerTestSupport {
if (counter < 3) {
// file should exists
File file = new File(FTP_ROOT_DIR + "/thirdpool/hello.txt");
- assertTrue("The file should NOT have been deleted", file.exists());
+ assertTrue(file.exists(), "The file should NOT have been deleted");
throw new IllegalArgumentException("Forced by unittest");
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileNoBodyConversionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileNoBodyConversionTest.java
index e7be6c9..ea77665 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileNoBodyConversionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileNoBodyConversionTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit testing a FTP ASCII transfer that Camel provides the needed conversion to String from
@@ -35,7 +35,7 @@ public class FromFtpToAsciiFileNoBodyConversionTest extends FtpServerTestSupport
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileTest.java
index aadb093..5e8cb98 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to verify that we can pool an ASCII file from the FTP Server and store it on a local file path
@@ -36,7 +38,7 @@ public class FromFtpToAsciiFileTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -52,8 +54,8 @@ public class FromFtpToAsciiFileTest extends FtpServerTestSupport {
// assert the file
File file = new File("target/ftptest/deleteme.txt");
- assertTrue("The ASCII file should exists", file.exists());
- assertTrue("File size wrong", file.length() > 10);
+ assertTrue(file.exists(), "The ASCII file should exists");
+ assertTrue(file.length() > 10, "File size wrong");
}
private void prepareFtpServer() throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFileTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFileTest.java
index c3fdf44..5efddb4 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFileTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFileTest.java
@@ -24,8 +24,10 @@ import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to verify that we can pool a BINARY file from the FTP Server and store it on a local file path
@@ -39,7 +41,7 @@ public class FromFtpToBinaryFileTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -52,12 +54,12 @@ public class FromFtpToBinaryFileTest extends FtpServerTestSupport {
resultEndpoint.assertIsSatisfied();
Exchange ex = resultEndpoint.getExchanges().get(0);
byte[] bytes = ex.getIn().getBody(byte[].class);
- assertTrue("Logo size wrong", bytes.length > 10000);
+ assertTrue(bytes.length > 10000, "Logo size wrong");
// assert the file
File file = new File("target/ftptest/deleteme.jpg");
- assertTrue("The binary file should exists", file.exists());
- assertTrue("Logo size wrong", file.length() > 10000);
+ assertTrue(file.exists(), "The binary file should exists");
+ assertTrue(file.length() > 10000, "Logo size wrong");
}
private void prepareFtpServer() throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFilesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFilesTest.java
index 1beabe6..f0c9c4d 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFilesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFilesTest.java
@@ -24,8 +24,10 @@ import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to verify that we can pool a BINARY file from the FTP Server and store it on a local file path
@@ -39,7 +41,7 @@ public class FromFtpToBinaryFilesTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -52,17 +54,17 @@ public class FromFtpToBinaryFilesTest extends FtpServerTestSupport {
resultEndpoint.assertIsSatisfied();
Exchange ex = resultEndpoint.getExchanges().get(0);
byte[] bytes = ex.getIn().getBody(byte[].class);
- assertTrue("Logo size wrong", bytes.length > 10000);
+ assertTrue(bytes.length > 10000, "Logo size wrong");
// assert the file
File file = new File("target/ftptest/logo.jpeg");
- assertTrue(" The binary file should exists", file.exists());
- assertTrue("Logo size wrong", file.length() > 10000);
+ assertTrue(file.exists(), " The binary file should exists");
+ assertTrue(file.length() > 10000, "Logo size wrong");
// assert the file
file = new File("target/ftptest/a/logo1.jpeg");
- assertTrue("The binary file should exists", file.exists());
- assertTrue("Logo size wrong", file.length() > 10000);
+ assertTrue(file.exists(), "The binary file should exists");
+ assertTrue(file.length() > 10000, "Logo size wrong");
}
private void prepareFtpServer() throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
index f1321ef..9a35052 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
@@ -17,8 +17,8 @@
package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
/**
* Unit test used for FTP wiki documentation
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java
index 3aa0362..feb641e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test for consuming files from a FTP Server to files where we want to use the filename
@@ -35,7 +35,7 @@ public class FromFtpToFileNoFileNameHeaderTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToMockTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToMockTest.java
index a44a7c0..63bd499 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToMockTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToMockTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FromFtpToMockTest extends FtpServerTestSupport {
protected String expectedBody = "Hello there!";
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpTwoSlashesIssueTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpTwoSlashesIssueTest.java
index 2d9ef75..786a57c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpTwoSlashesIssueTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpTwoSlashesIssueTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Issue with using 2 slashes
@@ -36,7 +38,7 @@ public class FromFtpTwoSlashesIssueTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -64,7 +66,7 @@ public class FromFtpTwoSlashesIssueTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpUseListFalseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpUseListFalseTest.java
index 60fd0c3..3fd530c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpUseListFalseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpUseListFalseTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test to poll a fixed file from the FTP server without using the list command.
@@ -35,7 +35,7 @@ public class FromFtpUseListFalseTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromQueueThenConsumeFtpToMockTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromQueueThenConsumeFtpToMockTest.java
index b79275d..fae0216 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromQueueThenConsumeFtpToMockTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromQueueThenConsumeFtpToMockTest.java
@@ -23,8 +23,8 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test based on user forum question
@@ -44,7 +44,7 @@ public class FromQueueThenConsumeFtpToMockTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpAnonymousTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpAnonymousTest.java
index 9d400c1..aa73421 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpAnonymousTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpAnonymousTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test that ftp consumer for anonymous login
@@ -35,7 +35,7 @@ public class FtpAnonymousTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java
index dfc8baf..8a3d3d1 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java
@@ -28,7 +28,10 @@ import javax.net.SocketFactory;
import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpBadLoginConnectionLeakTest extends FtpServerTestSupport {
@@ -56,8 +59,8 @@ public class FtpBadLoginConnectionLeakTest extends FtpServerTestSupport {
stopCamelContext();
for (Map.Entry<Integer, boolean[]> socketStats : socketAudits.entrySet()) {
- assertTrue("Socket should be connected", socketStats.getValue()[0]);
- assertEquals("Socket should be closed", socketStats.getValue()[0], socketStats.getValue()[1]);
+ assertTrue(socketStats.getValue()[0], "Socket should be connected");
+ assertEquals(socketStats.getValue()[0], socketStats.getValue()[1], "Socket should be closed");
}
mock.assertIsSatisfied();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java
index 3c24cbf..5127fcc 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java
@@ -26,7 +26,10 @@ import java.util.Map;
import javax.net.SocketFactory;
import org.apache.camel.BindToRegistry;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpBadLoginInProducerConnectionLeakTest extends FtpServerTestSupport {
@@ -53,11 +56,11 @@ public class FtpBadLoginInProducerConnectionLeakTest extends FtpServerTestSuppor
}
}
- assertEquals("Expected 2 socket connections to be created", 2, socketAudits.size());
+ assertEquals(2, socketAudits.size(), "Expected 2 socket connections to be created");
for (Map.Entry<Integer, boolean[]> socketStats : socketAudits.entrySet()) {
- assertTrue("Socket should be connected", socketStats.getValue()[0]);
- assertEquals("Socket should be closed", socketStats.getValue()[0], socketStats.getValue()[1]);
+ assertTrue(socketStats.getValue()[0], "Socket should be connected");
+ assertEquals(socketStats.getValue()[0], socketStats.getValue()[1], "Socket should be closed");
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java
index 909399d..faedfcf 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java
@@ -29,13 +29,21 @@ import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.commons.net.ftp.FTPClient;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test which checks leaking connections when FTP server returns correct status for NOOP operation.
*/
public class FtpBadLoginMockNoopConnectionLeakTest extends FtpServerTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(FtpBadLoginMockNoopConnectionLeakTest.class);
+
/**
* Mapping of socket hashcode to two element tab ([connect() called, close() called])
*/
@@ -50,7 +58,7 @@ public class FtpBadLoginMockNoopConnectionLeakTest extends FtpServerTestSupport
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
@@ -75,8 +83,8 @@ public class FtpBadLoginMockNoopConnectionLeakTest extends FtpServerTestSupport
stopCamelContext();
for (Map.Entry<Integer, boolean[]> socketStats : socketAudits.entrySet()) {
- assertTrue("Socket should be connected", socketStats.getValue()[0]);
- assertEquals("Socket should be closed", socketStats.getValue()[0], socketStats.getValue()[1]);
+ assertTrue(socketStats.getValue()[0], "Socket should be connected");
+ assertEquals(socketStats.getValue()[0], socketStats.getValue()[1], "Socket should be closed");
}
mock.assertIsSatisfied();
@@ -132,7 +140,7 @@ public class FtpBadLoginMockNoopConnectionLeakTest extends FtpServerTestSupport
@Override
public void connect(SocketAddress endpoint, int timeout) throws IOException {
- log.info("Connecting socket {}", System.identityHashCode(this));
+ LOG.info("Connecting socket {}", System.identityHashCode(this));
super.connect(endpoint, timeout);
boolean[] value = socketAudits.get(System.identityHashCode(this));
value[0] = true;
@@ -140,7 +148,7 @@ public class FtpBadLoginMockNoopConnectionLeakTest extends FtpServerTestSupport
@Override
public synchronized void close() throws IOException {
- log.info("Disconnecting socket {}", System.identityHashCode(this));
+ LOG.info("Disconnecting socket {}", System.identityHashCode(this));
super.close();
boolean[] value = socketAudits.get(System.identityHashCode(this));
value[1] = true;
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBrowsableEndpointTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBrowsableEndpointTest.java
index e7e3714..3d9202e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBrowsableEndpointTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBrowsableEndpointTest.java
@@ -22,7 +22,12 @@ import java.util.List;
import org.apache.camel.Exchange;
import org.apache.camel.spi.BrowsableEndpoint;
import org.apache.camel.support.processor.idempotent.MemoryIdempotentRepository;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.createDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpBrowsableEndpointTest extends FtpServerTestSupport {
@@ -64,7 +69,7 @@ public class FtpBrowsableEndpointTest extends FtpServerTestSupport {
// and the file is still there
File file = new File(FTP_ROOT_DIR + "/browse/a.txt");
- assertTrue("File should exist " + file, file.exists());
+ assertTrue(file.exists(), "File should exist " + file);
}
@Test
@@ -90,9 +95,9 @@ public class FtpBrowsableEndpointTest extends FtpServerTestSupport {
// and the files is still there
File fileA = new File(FTP_ROOT_DIR + "/browse/a.txt");
- assertTrue("File should exist " + fileA, fileA.exists());
+ assertTrue(fileA.exists(), "File should exist " + fileA);
File fileB = new File(FTP_ROOT_DIR + "/browse/b.txt");
- assertTrue("File should exist " + fileB, fileB.exists());
+ assertTrue(fileB.exists(), "File should exist " + fileB);
}
@Test
@@ -120,10 +125,10 @@ public class FtpBrowsableEndpointTest extends FtpServerTestSupport {
// and the files is still there
File fileA = new File(FTP_ROOT_DIR + "/browse/a.txt");
- assertTrue("File should exist " + fileA, fileA.exists());
+ assertTrue(fileA.exists(), "File should exist " + fileA);
File fileB = new File(FTP_ROOT_DIR + "/browse/foo/b.txt");
- assertTrue("File should exist " + fileB, fileB.exists());
+ assertTrue(fileB.exists(), "File should exist " + fileB);
File fileC = new File(FTP_ROOT_DIR + "/browse/bar/c.txt");
- assertTrue("File should exist " + fileC, fileC.exists());
+ assertTrue(fileC.exists(), "File should exist " + fileC);
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedReadLockTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedReadLockTest.java
index 039f3eed..2da08f1 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedReadLockTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedReadLockTest.java
@@ -21,10 +21,13 @@ import java.io.FileOutputStream;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.apache.camel.test.junit5.TestSupport.createDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
*
*/
@@ -48,7 +51,7 @@ public class FtpChangedReadLockTest extends FtpServerTestSupport {
String content = context.getTypeConverter().convertTo(String.class, new File("target/changed/out/slowfile.dat"));
String[] lines = content.split(LS);
- assertEquals("There should be 20 lines in the file", 20, lines.length);
+ assertEquals(20, lines.length, "There should be 20 lines in the file");
for (int i = 0; i < 20; i++) {
assertEquals("Line " + i, lines[i]);
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedRootDirReadLockTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedRootDirReadLockTest.java
index 7c4db98..b5a8bb1 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedRootDirReadLockTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedRootDirReadLockTest.java
@@ -21,10 +21,13 @@ import java.io.FileOutputStream;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.apache.camel.test.junit5.TestSupport.createDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
*
*/
@@ -48,7 +51,7 @@ public class FtpChangedRootDirReadLockTest extends FtpServerTestSupport {
String content = context.getTypeConverter().convertTo(String.class, new File("target/out/slowfile.dat"));
String[] lines = content.split(LS);
- assertEquals("There should be 20 lines in the file", 20, lines.length);
+ assertEquals(20, lines.length, "There should be 20 lines in the file");
for (int i = 0; i < 20; i++) {
assertEquals("Line " + i, lines[i]);
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedZeroLengthReadLockTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedZeroLengthReadLockTest.java
index ca21b54..66393dd 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedZeroLengthReadLockTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpChangedZeroLengthReadLockTest.java
@@ -20,7 +20,9 @@ import java.io.FileOutputStream;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.createDirectory;
/**
*
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConnectTimeoutTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConnectTimeoutTest.java
index aba2784..0f16dd3 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConnectTimeoutTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConnectTimeoutTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpConnectTimeoutTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAbsolutePathTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAbsolutePathTest.java
index bc04816..a68bf61 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAbsolutePathTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAbsolutePathTest.java
@@ -22,8 +22,11 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class FtpConsumerAbsolutePathTest extends FtpServerTestSupport {
@@ -32,7 +35,7 @@ public class FtpConsumerAbsolutePathTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/lwd");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAsyncStressTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAsyncStressTest.java
index 9fc8924..70ddc3f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAsyncStressTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAsyncStressTest.java
@@ -22,8 +22,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FtpConsumerAsyncStressTest extends FtpServerTestSupport {
@@ -34,7 +34,7 @@ public class FtpConsumerAsyncStressTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
for (int i = 0; i < files; i++) {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAutoCreateTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAutoCreateTest.java
index e663879..2b84c26 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAutoCreateTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerAutoCreateTest.java
@@ -19,10 +19,13 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class FtpConsumerAutoCreateTest extends FtpServerTestSupport {
@@ -31,7 +34,7 @@ public class FtpConsumerAutoCreateTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerBodyAsStringTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerBodyAsStringTest.java
index 8d9c50b..b2bf235 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerBodyAsStringTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerBodyAsStringTest.java
@@ -22,8 +22,11 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
public class FtpConsumerBodyAsStringTest extends FtpServerTestSupport {
@@ -32,7 +35,7 @@ public class FtpConsumerBodyAsStringTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDeleteNoWritePermissionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDeleteNoWritePermissionTest.java
index 22f2f6b..f3c96e7 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDeleteNoWritePermissionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDeleteNoWritePermissionTest.java
@@ -19,8 +19,10 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.PollingConsumer;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* User does not have write permissions so can't deleted consumed file.
@@ -33,7 +35,7 @@ public class FtpConsumerDeleteNoWritePermissionTest extends FtpServerTestSupport
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -44,7 +46,7 @@ public class FtpConsumerDeleteNoWritePermissionTest extends FtpServerTestSupport
PollingConsumer consumer = context.getEndpoint(getFtpUrl()).createPollingConsumer();
consumer.start();
Exchange out = consumer.receive(3000);
- assertNotNull("Should get the file", out);
+ assertNotNull(out, "Should get the file");
try {
// give consumer time to try to delete the file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDirectoriesNotMatchedTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDirectoriesNotMatchedTest.java
index 4840df6..46b8ead 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDirectoriesNotMatchedTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDirectoriesNotMatchedTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test that ftp consumer will not match directories (CAMEL-920)
@@ -32,7 +32,7 @@ public class FtpConsumerDirectoriesNotMatchedTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDisconnectTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDisconnectTest.java
index 05091f4..c1ff883 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDisconnectTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDisconnectTest.java
@@ -18,8 +18,11 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.commons.net.ftp.FTPClient;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpConsumerDisconnectTest extends FtpServerTestSupport {
@@ -28,7 +31,7 @@ public class FtpConsumerDisconnectTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
@@ -61,8 +64,8 @@ public class FtpConsumerDisconnectTest extends FtpServerTestSupport {
Thread.sleep(2000);
FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
- assertFalse("The FTPClient should be already disconnected", endpoint.getFtpClient().isConnected());
- assertTrue("The FtpEndpoint should be configured to disconnect", endpoint.isDisconnect());
+ assertFalse(endpoint.getFtpClient().isConnected(), "The FTPClient should be already disconnected");
+ assertTrue(endpoint.isDisconnect(), "The FtpEndpoint should be configured to disconnect");
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDoneFileNameFixedTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDoneFileNameFixedTest.java
index ad96f79..bcd88d4 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDoneFileNameFixedTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDoneFileNameFixedTest.java
@@ -20,7 +20,9 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
public class FtpConsumerDoneFileNameFixedTest extends FtpServerTestSupport {
@@ -53,7 +55,7 @@ public class FtpConsumerDoneFileNameFixedTest extends FtpServerTestSupport {
// done file should be deleted now
File file = new File(FTP_ROOT_DIR + "done/fin.dat");
- assertFalse("Done file should be deleted: " + file, file.exists());
+ assertFalse(file.exists(), "Done file should be deleted: " + file);
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDoneFileNameTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDoneFileNameTest.java
index 2517e4b..16fe3aa 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDoneFileNameTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDoneFileNameTest.java
@@ -20,7 +20,9 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
public class FtpConsumerDoneFileNameTest extends FtpServerTestSupport {
@@ -53,7 +55,7 @@ public class FtpConsumerDoneFileNameTest extends FtpServerTestSupport {
// done file should be deleted now
File file = new File(FTP_ROOT_DIR + "done/hello.dat");
- assertFalse("Done file should be deleted: " + file, file.exists());
+ assertFalse(file.exists(), "Done file should be deleted: " + file);
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDualDoneFileNameTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDualDoneFileNameTest.java
index 74b2ae1..97fd4bf 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDualDoneFileNameTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDualDoneFileNameTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpConsumerDualDoneFileNameTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerExcludeNameTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerExcludeNameTest.java
index f35ac27..8adb816 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerExcludeNameTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerExcludeNameTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test that ftp consumer will exclude pre and postfixes
@@ -32,7 +32,7 @@ public class FtpConsumerExcludeNameTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerFileSplitTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerFileSplitTest.java
index 9c0e227..d58da12 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerFileSplitTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerFileSplitTest.java
@@ -21,7 +21,7 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpConsumerFileSplitTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIPV6BodyAsStringTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIPV6BodyAsStringTest.java
index b75ff6c..30a484b 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIPV6BodyAsStringTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIPV6BodyAsStringTest.java
@@ -22,11 +22,14 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@Disabled
public class FtpConsumerIPV6BodyAsStringTest extends FtpServerTestSupport {
private String getFtpUrl() {
@@ -34,7 +37,7 @@ public class FtpConsumerIPV6BodyAsStringTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentKeyChangedIssueTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentKeyChangedIssueTest.java
index 884b155..bda2784 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentKeyChangedIssueTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentKeyChangedIssueTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpConsumerIdempotentKeyChangedIssueTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentMemoryRefTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentMemoryRefTest.java
index 14fb8ce..9f470fa 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentMemoryRefTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentMemoryRefTest.java
@@ -20,7 +20,10 @@ import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.support.processor.idempotent.MemoryIdempotentRepository;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Memory repo test
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentRefTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentRefTest.java
index df21bea..5f019f9 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentRefTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentRefTest.java
@@ -20,7 +20,10 @@ import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.spi.IdempotentRepository;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for the idempotentRepository # option.
@@ -61,7 +64,7 @@ public class FtpConsumerIdempotentRefTest extends FtpServerTestSupport {
Thread.sleep(2000);
assertMockEndpointsSatisfied();
- assertTrue("MyIdempotentRepository should have been invoked", invoked);
+ assertTrue(invoked, "MyIdempotentRepository should have been invoked");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentTest.java
index 1f94fac..8b6bc8a 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Unit test for the idempotent=true option.
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIncludeNameTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIncludeNameTest.java
index 764f73b..238ca3e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIncludeNameTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIncludeNameTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test that ftp consumer will include pre and postfixes
@@ -32,7 +32,7 @@ public class FtpConsumerIncludeNameTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryAsAbsolutePathTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryAsAbsolutePathTest.java
index 8d3ad1b..3381e36 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryAsAbsolutePathTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryAsAbsolutePathTest.java
@@ -26,8 +26,14 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
import org.apache.camel.util.FileUtil;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpConsumerLocalWorkDirectoryAsAbsolutePathTest extends FtpServerTestSupport {
@@ -39,7 +45,7 @@ public class FtpConsumerLocalWorkDirectoryAsAbsolutePathTest extends FtpServerTe
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/lwd");
deleteDirectory("target/out");
@@ -60,11 +66,11 @@ public class FtpConsumerLocalWorkDirectoryAsAbsolutePathTest extends FtpServerTe
// now the lwd file should be deleted
File local = new File("target/lwd/hello.txt");
- assertFalse("Local work file should have been deleted", local.exists());
+ assertFalse(local.exists(), "Local work file should have been deleted");
// and the out file should exists
File out = new File("target/out/hello.txt");
- assertTrue("file should exists", out.exists());
+ assertTrue(out.exists(), "file should exists");
assertEquals("Hello World", IOConverter.toString(out, null));
}
@@ -89,8 +95,8 @@ public class FtpConsumerLocalWorkDirectoryAsAbsolutePathTest extends FtpServerTe
public void process(Exchange exchange) throws Exception {
File body = exchange.getIn().getBody(File.class);
assertNotNull(body);
- assertTrue("Should be absolute path", body.isAbsolute());
- assertTrue("Local work file should exists", body.exists());
+ assertTrue(body.isAbsolute(), "Should be absolute path");
+ assertTrue(body.exists(), "Local work file should exists");
assertEquals(FileUtil.normalizePath(base + "/hello.txt"), body.getPath());
}
}).to("mock:result", "file://target/out");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryDirectTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryDirectTest.java
index cc3639a..f74bf41 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryDirectTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryDirectTest.java
@@ -24,8 +24,13 @@ import org.apache.camel.Producer;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.converter.IOConverter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpConsumerLocalWorkDirectoryDirectTest extends FtpServerTestSupport {
@@ -35,7 +40,7 @@ public class FtpConsumerLocalWorkDirectoryDirectTest extends FtpServerTestSuppor
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/lwd");
deleteDirectory("target/out");
@@ -60,16 +65,16 @@ public class FtpConsumerLocalWorkDirectoryDirectTest extends FtpServerTestSuppor
@Test
public void testLocalWorkDirectory() throws Exception {
NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
- assertTrue("Should process one file", notify.matchesMockWaitTime());
+ assertTrue(notify.matchesMockWaitTime(), "Should process one file");
// and the out file should exists
File out = new File("target/out/hello.txt");
- assertTrue("file should exists", out.exists());
+ assertTrue(out.exists(), "file should exists");
assertEquals("Hello World", IOConverter.toString(out, null));
// now the lwd file should be deleted
File local = new File("target/lwd/hello.txt");
- assertFalse("Local work file should have been deleted", local.exists());
+ assertFalse(local.exists(), "Local work file should have been deleted");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryTest.java
index 5ee2ca8..ce07cb7 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryTest.java
@@ -27,8 +27,14 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
import org.apache.camel.util.FileUtil;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpConsumerLocalWorkDirectoryTest extends FtpServerTestSupport {
@@ -38,7 +44,7 @@ public class FtpConsumerLocalWorkDirectoryTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/lwd");
deleteDirectory("target/out");
@@ -76,12 +82,12 @@ public class FtpConsumerLocalWorkDirectoryTest extends FtpServerTestSupport {
// and the out file should exists
File out = new File("target/out/hello.txt");
- assertTrue("file should exists", out.exists());
+ assertTrue(out.exists(), "file should exists");
assertEquals("Hello World", IOConverter.toString(out, null));
// now the lwd file should be deleted
File local = new File("target/lwd/hello.txt");
- assertFalse("Local work file should have been deleted", local.exists());
+ assertFalse(local.exists(), "Local work file should have been deleted");
}
@Override
@@ -93,7 +99,7 @@ public class FtpConsumerLocalWorkDirectoryTest extends FtpServerTestSupport {
public void process(Exchange exchange) throws Exception {
File body = exchange.getIn().getBody(File.class);
assertNotNull(body);
- assertTrue("Local work file should exists", body.exists());
+ assertTrue(body.exists(), "Local work file should exists");
assertEquals(FileUtil.normalizePath("target/lwd/hello.txt"), body.getPath());
}
}).to("mock:result", "file://target/out");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMaxMessagesPerPollTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMaxMessagesPerPollTest.java
index 63660ab..5973309 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMaxMessagesPerPollTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMaxMessagesPerPollTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FtpConsumerMaxMessagesPerPollTest extends FtpServerTestSupport {
@@ -29,7 +29,7 @@ public class FtpConsumerMaxMessagesPerPollTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMoveExpressionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMoveExpressionTest.java
index 4e0260c..8ebc480 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMoveExpressionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMoveExpressionTest.java
@@ -23,8 +23,11 @@ import java.util.Date;
import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for FTP using expression (file language)
@@ -39,7 +42,7 @@ public class FtpConsumerMoveExpressionTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
deleteDirectory("target/filelanguage");
@@ -59,7 +62,7 @@ public class FtpConsumerMoveExpressionTest extends FtpServerTestSupport {
String now = new SimpleDateFormat("yyyyMMdd").format(new Date());
File file = new File(FTP_ROOT_DIR + "/filelanguage/backup/" + now + "/123-report2.bak");
- assertTrue("File should have been renamed", file.exists());
+ assertTrue(file.exists(), "File should have been renamed");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMultipleDirectoriesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMultipleDirectoriesTest.java
index f19c498..9114d3d1 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMultipleDirectoriesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMultipleDirectoriesTest.java
@@ -20,8 +20,12 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.FileComponent;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertDirectoryEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
public class FtpConsumerMultipleDirectoriesTest extends FtpServerTestSupport {
@@ -30,7 +34,7 @@ public class FtpConsumerMultipleDirectoriesTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerNotEagerMaxMessagesPerPollTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerNotEagerMaxMessagesPerPollTest.java
index f4145b9..d99c2bf 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerNotEagerMaxMessagesPerPollTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerNotEagerMaxMessagesPerPollTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FtpConsumerNotEagerMaxMessagesPerPollTest extends FtpServerTestSupport {
@@ -30,7 +30,7 @@ public class FtpConsumerNotEagerMaxMessagesPerPollTest extends FtpServerTestSupp
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerProcessStrategyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerProcessStrategyTest.java
index 9eee5a8..8b24bce 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerProcessStrategyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerProcessStrategyTest.java
@@ -22,7 +22,11 @@ import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.file.GenericFileEndpoint;
import org.apache.camel.component.file.GenericFileOperations;
import org.apache.camel.component.file.GenericFileProcessStrategy;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpConsumerProcessStrategyTest extends FtpServerTestSupport {
@@ -44,7 +48,7 @@ public class FtpConsumerProcessStrategyTest extends FtpServerTestSupport {
String out = consumer.receiveBody(getFtpUrl(), 5000, String.class);
assertNotNull(out);
assertTrue(out.startsWith("Hello World"));
- assertEquals("Begin should have been invoked 1 times", 1, myStrategy.getInvoked());
+ assertEquals(1, myStrategy.getInvoked(), "Begin should have been invoked 1 times");
}
private static class MyStrategy implements GenericFileProcessStrategy {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerRelativeFileNameTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerRelativeFileNameTest.java
index 0fb09a2..0bf72a7 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerRelativeFileNameTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerRelativeFileNameTest.java
@@ -19,8 +19,10 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertDirectoryEquals;
public class FtpConsumerRelativeFileNameTest extends FtpServerTestSupport {
@@ -29,7 +31,7 @@ public class FtpConsumerRelativeFileNameTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
sendFile(getFtpUrl(), "Hello World", "target/filename-consumer-hello.txt");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerReplyStringTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerReplyStringTest.java
index 138f131..945f63c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerReplyStringTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerReplyStringTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpConsumerReplyStringTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerResumeDownloadTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerResumeDownloadTest.java
index 2059f1c..905fcf9 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerResumeDownloadTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerResumeDownloadTest.java
@@ -23,8 +23,14 @@ import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.createDirectory;
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpConsumerResumeDownloadTest extends FtpServerTestSupport {
@@ -34,7 +40,7 @@ public class FtpConsumerResumeDownloadTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/lwd");
deleteDirectory("target/out");
@@ -73,16 +79,16 @@ public class FtpConsumerResumeDownloadTest extends FtpServerTestSupport {
// and the out file should exists
File out = new File("target/out/hello.txt");
- assertTrue("file should exists", out.exists());
+ assertTrue(out.exists(), "file should exists");
assertEquals("Hello\nWorld\nI was here", IOConverter.toString(out, null));
// now the lwd file should be deleted
File local = new File("target/lwd/hello.txt");
- assertFalse("Local work file should have been deleted", local.exists());
+ assertFalse(local.exists(), "Local work file should have been deleted");
// and so the in progress
File temp = new File("target/lwd/hello.txt.inprogress");
- assertFalse("Local work file should have been deleted", temp.exists());
+ assertFalse(temp.exists(), "Local work file should have been deleted");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerSkipDotFilesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerSkipDotFilesTest.java
index 773b402..b8b79e4 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerSkipDotFilesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerSkipDotFilesTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test that ftp consumer will skip any files starting with a dot
@@ -31,7 +31,7 @@ public class FtpConsumerSkipDotFilesTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerTemplateTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerTemplateTest.java
index d734655..26939c8 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerTemplateTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerTemplateTest.java
@@ -21,8 +21,13 @@ import java.io.File;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Producer;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpConsumerTemplateTest extends FtpServerTestSupport {
@@ -31,7 +36,7 @@ public class FtpConsumerTemplateTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -61,7 +66,7 @@ public class FtpConsumerTemplateTest extends FtpServerTestSupport {
// file should still exists
Thread.sleep(500);
File file = new File(FTP_ROOT_DIR + "/template/hello.txt");
- assertTrue("The file should exist: " + file, file.exists());
+ assertTrue(file.exists(), "The file should exist: " + file);
}
@Test
@@ -92,7 +97,7 @@ public class FtpConsumerTemplateTest extends FtpServerTestSupport {
// file should still exists
Thread.sleep(500);
File file = new File(FTP_ROOT_DIR + "/template/hello.txt");
- assertTrue("The file should exist: " + file, file.exists());
+ assertTrue(file.exists(), "The file should exist: " + file);
}
private void prepareFtpServer() throws Exception {
@@ -107,7 +112,7 @@ public class FtpConsumerTemplateTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/template/hello.txt");
- assertTrue("The file should exist: " + file, file.exists());
+ assertTrue(file.exists(), "The file should exist: " + file);
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerTemplateUseListFalseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerTemplateUseListFalseTest.java
index 86e59bb..250eac1 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerTemplateUseListFalseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerTemplateUseListFalseTest.java
@@ -19,8 +19,11 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Producer;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
* Unit test to poll a fixed file from the FTP server without using the list command.
@@ -33,7 +36,7 @@ public class FtpConsumerTemplateUseListFalseTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -46,11 +49,11 @@ public class FtpConsumerTemplateUseListFalseTest extends FtpServerTestSupport {
// try a 2nd time and the file is deleted
data = consumer.receiveBody(getFtpUrl() + "&fileName=report.txt", 1000, String.class);
- assertNull("The file should no longer exist", data);
+ assertNull(data, "The file should no longer exist");
// and try a non existing file name
data = consumer.receiveBody(getFtpUrl() + "&fileName=report2.txt", 1000, String.class);
- assertNull("The file should no longer exist", data);
+ assertNull(data, "The file should no longer exist");
}
private void prepareFtpServer() throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerThrowExceptionOnLoginFailedTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerThrowExceptionOnLoginFailedTest.java
index 6898134..3560885 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerThrowExceptionOnLoginFailedTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerThrowExceptionOnLoginFailedTest.java
@@ -26,7 +26,11 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFileOperationFailedException;
import org.apache.camel.spi.PollingConsumerPollStrategy;
import org.apache.camel.support.service.ServiceSupport;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
/**
* Unit test for login failure due bad password and no re connect attempts allowed
@@ -55,7 +59,7 @@ public class FtpConsumerThrowExceptionOnLoginFailedTest extends FtpServerTestSup
Thread.sleep(1000);
Consumer consumer = context.getRoute("foo").getConsumer();
- assertTrue("Consumer should be stopped", ((ServiceSupport)consumer).isStopped());
+ assertTrue(((ServiceSupport)consumer).isStopped(), "Consumer should be stopped");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerUsingFTPClientConfigTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerUsingFTPClientConfigTest.java
index 728f3b6..4311f1c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerUsingFTPClientConfigTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerUsingFTPClientConfigTest.java
@@ -20,8 +20,8 @@ import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.commons.net.ftp.FTPClientConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Unit test for ftpClientConfig option.
@@ -33,7 +33,7 @@ public class FtpConsumerUsingFTPClientConfigTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithCharsetTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithCharsetTest.java
index 84cb842..8447f41 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithCharsetTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithCharsetTest.java
@@ -26,11 +26,19 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.FileComponent;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.util.IOHelper;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpConsumerWithCharsetTest extends FtpServerTestSupport {
+ private static final Logger LOG = LoggerFactory.getLogger(FtpConsumerWithCharsetTest.class);
+
private final String payload = "\u00e6\u00f8\u00e5 \u00a9";
private String getFtpUrl() {
@@ -38,34 +46,34 @@ public class FtpConsumerWithCharsetTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
byte[] iso = payload.getBytes("iso-8859-1");
byte[] utf = payload.getBytes("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, Charset.forName("iso-8859-1")));
+ LOG.debug("utf: {}", new String(utf, Charset.forName("utf-8")));
for (byte b : iso) {
- log.debug("iso byte: {}", b);
+ LOG.debug("iso byte: {}", b);
}
for (byte b : utf) {
- log.debug("utf byte: {}", b);
+ LOG.debug("utf byte: {}", b);
}
prepareFtpServer();
// Check that the payload exists in upload and is in iso charset.ß
File file = new File(FTP_ROOT_DIR + "/upload/iso.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
// Lets also test byte wise
InputStream fis = IOHelper.buffered(new FileInputStream(file));
byte[] buffer = new byte[100];
int len = fis.read(buffer);
- assertTrue("Should read data: " + len, len != -1);
+ assertTrue(len != -1, "Should read data: " + len);
byte[] data = new byte[len];
System.arraycopy(buffer, 0, data, 0, len);
fis.close();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithNoFileOptionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithNoFileOptionTest.java
index d8c1aef..94dc163 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithNoFileOptionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithNoFileOptionTest.java
@@ -20,8 +20,11 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.FileComponent;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Unit test CAMEL-1247
@@ -33,7 +36,7 @@ public class FtpConsumerWithNoFileOptionTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpEndpointURISanitizedTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpEndpointURISanitizedTest.java
index c1814b5..0735e21 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpEndpointURISanitizedTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpEndpointURISanitizedTest.java
@@ -19,9 +19,11 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Consumer;
import org.apache.camel.Endpoint;
import org.apache.camel.Producer;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* Test to ensure the FtpEndpoint URI is sanitized.
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpIllegalOptionsTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpIllegalOptionsTest.java
index b5557f9..1174838 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpIllegalOptionsTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpIllegalOptionsTest.java
@@ -18,8 +18,10 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.fail;
public class FtpIllegalOptionsTest extends CamelTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpLoginNoRetryTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpLoginNoRetryTest.java
index ae3d214..b727abb 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpLoginNoRetryTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpLoginNoRetryTest.java
@@ -22,7 +22,11 @@ import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Unit test for login failure due bad password and no re connect attempts
@@ -41,7 +45,7 @@ public class FtpLoginNoRetryTest extends FtpServerTestSupport {
// assert file NOT created
File file = new File(FTP_ROOT_DIR + "login/report.txt");
- assertFalse("The file should NOT exists", file.exists());
+ assertFalse(file.exists(), "The file should NOT exists");
}
private void uploadFile(String username, String password) throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpLoginTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpLoginTest.java
index 478357f..03d037f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpLoginTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpLoginTest.java
@@ -22,7 +22,12 @@ import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Unit test for login failure due bad password and login with accepted password
@@ -41,7 +46,7 @@ public class FtpLoginTest extends FtpServerTestSupport {
// assert file NOT created
File file = new File(FTP_ROOT_DIR + "/login/report.txt");
- assertFalse("The file should NOT exists", file.exists());
+ assertFalse(file.exists(), "The file should NOT exists");
}
@Test
@@ -50,7 +55,7 @@ public class FtpLoginTest extends FtpServerTestSupport {
// assert file created
File file = new File(FTP_ROOT_DIR + "/login/report.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
private void uploadFile(String username, String password) throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpNoReconnectAttemptUnknownHostTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpNoReconnectAttemptUnknownHostTest.java
index cec2e65..bb56790 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpNoReconnectAttemptUnknownHostTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpNoReconnectAttemptUnknownHostTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpNoReconnectAttemptUnknownHostTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichBridgeErrorHandlerTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichBridgeErrorHandlerTest.java
index 3a914bc..fd971f5 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichBridgeErrorHandlerTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichBridgeErrorHandlerTest.java
@@ -20,9 +20,10 @@ import org.apache.camel.AggregationStrategy;
import org.apache.camel.Exchange;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.camel.support.ExchangeHelper.copyResultsPreservePattern;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
public class FtpPollEnrichBridgeErrorHandlerTest extends BaseServerTestSupport {
@@ -47,7 +48,7 @@ public class FtpPollEnrichBridgeErrorHandlerTest extends BaseServerTestSupport {
assertNotNull(out);
Exception caught = out.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
- assertNotNull("Should store caught exception", caught);
+ assertNotNull(caught, "Should store caught exception");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichConsumeWithDisconnectAndDeleteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichConsumeWithDisconnectAndDeleteTest.java
index a81db95..025f167 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichConsumeWithDisconnectAndDeleteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichConsumeWithDisconnectAndDeleteTest.java
@@ -22,10 +22,16 @@ import org.apache.camel.Exchange;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
public class FtpPollEnrichConsumeWithDisconnectAndDeleteTest extends FtpServerTestSupport {
+ private static final Logger LOG = LoggerFactory.getLogger(FtpPollEnrichConsumeWithDisconnectAndDeleteTest.class);
+
@Test
public void testFtpSimpleConsume() throws Exception {
if (!canTest()) {
@@ -54,12 +60,12 @@ public class FtpPollEnrichConsumeWithDisconnectAndDeleteTest extends FtpServerTe
fileExists = file.exists();
if (fileExists) {
- log.info("Will check that file has been deleted again in 200ms");
+ LOG.info("Will check that file has been deleted again in 200ms");
Thread.sleep(200);
}
}
- assertFalse("The file should have been deleted", fileExists);
+ assertFalse(fileExists, "The file should have been deleted");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollingConsumerIdleMessageTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollingConsumerIdleMessageTest.java
index aa74c70..69f1b21 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollingConsumerIdleMessageTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollingConsumerIdleMessageTest.java
@@ -20,8 +20,10 @@ import java.io.File;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test to verify that the polling consumer delivers an empty Exchange when the
@@ -39,7 +41,7 @@ public class FtpPollingConsumerIdleMessageTest extends FtpServerTestSupport {
assertTrue(mock.getExchanges().get(1).getIn().getBody() == null);
}
- @Before
+ @BeforeEach
public void setup() throws Exception {
new File(FTP_ROOT_DIR + "/polling").mkdirs();
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollingConsumerTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollingConsumerTest.java
index d94a3cf..c26b653 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollingConsumerTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollingConsumerTest.java
@@ -20,7 +20,11 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.PollingConsumer;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
*
@@ -51,7 +55,7 @@ public class FtpPollingConsumerTest extends FtpServerTestSupport {
Thread.sleep(1000);
File file = new File(FTP_ROOT_DIR + "/polling/bye.txt");
- assertTrue("File should exist " + file, file.exists());
+ assertTrue(file.exists(), "File should exist " + file);
consumer.stop();
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerAllowNullBodyFileAlreadyExistTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerAllowNullBodyFileAlreadyExistTest.java
index 70f3b95..2153d51 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerAllowNullBodyFileAlreadyExistTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerAllowNullBodyFileAlreadyExistTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FtpProducerAllowNullBodyFileAlreadyExistTest extends FtpServerTestSupport {
@@ -29,7 +29,7 @@ public class FtpProducerAllowNullBodyFileAlreadyExistTest extends FtpServerTestS
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
template.sendBodyAndHeader(getFtpUrl(), "Hello world", Exchange.FILE_NAME, "hello.txt");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerAllowNullBodyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerAllowNullBodyTest.java
index cb37b3c..9503eec 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerAllowNullBodyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerAllowNullBodyTest.java
@@ -20,7 +20,13 @@ import java.io.File;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertFileExists;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class FtpProducerAllowNullBodyTest extends FtpServerTestSupport {
@@ -45,7 +51,7 @@ public class FtpProducerAllowNullBodyTest extends FtpServerTestSupport {
assertTrue(cause.getMessage().endsWith("allowNullBody.txt"));
}
- assertFalse("allowNullBody set to false with null body should not create a new file", new File(FTP_ROOT_DIR + "/allownull/allowNullBody.txt").exists());
+ assertFalse(new File(FTP_ROOT_DIR + "/allownull/allowNullBody.txt").exists(), "allowNullBody set to false with null body should not create a new file");
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerBuildDirectoryTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerBuildDirectoryTest.java
index ae7f43e..8abca38 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerBuildDirectoryTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerBuildDirectoryTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to verify that Camel can build remote directory on FTP server if missing (full or part of).
@@ -35,7 +38,7 @@ public class FtpProducerBuildDirectoryTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), "Hello World", "claus.txt");
File file = new File(FTP_ROOT_DIR + "/upload/user/claus/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerBuildPartOfDirectoryTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerBuildPartOfDirectoryTest.java
index 07ffa93..9ed5005 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerBuildPartOfDirectoryTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerBuildPartOfDirectoryTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to verify that Camel can build remote directory on FTP server if missing (full or part of).
@@ -35,7 +38,7 @@ public class FtpProducerBuildPartOfDirectoryTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), "Bye World", "claus.txt");
File file = new File(FTP_ROOT_DIR + "/upload/user/claus/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
- assertEquals("Bye World", IOConverter.toString(file, null));
+ assertTrue(file.exists(), "The uploaded file should exists");
+ assertEquals(IOConverter.toString(file, null), "Bye World");
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerConcurrentTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerConcurrentTest.java
index 947937f..22d190f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerConcurrentTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerConcurrentTest.java
@@ -21,13 +21,13 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Concurrent producers test.
*/
-@Ignore("TODO: investigate for Camel 3.0")
+@Disabled("TODO: investigate for Camel 3.0")
public class FtpProducerConcurrentTest extends FtpServerTestSupport {
private String getFtpUrl() {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerConnectErrorsHeaderTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerConnectErrorsHeaderTest.java
index aac5c3b..85ed008 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerConnectErrorsHeaderTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerConnectErrorsHeaderTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpProducerConnectErrorsHeaderTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectOnBatchCompleteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectOnBatchCompleteTest.java
index f6c9032..8e2d1d4 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectOnBatchCompleteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectOnBatchCompleteTest.java
@@ -19,15 +19,17 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.commons.net.ftp.FTPClient;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.camel.language.simple.SimpleLanguage.simple;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerDisconnectOnBatchCompleteTest extends FtpServerTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
@@ -47,8 +49,8 @@ public class FtpProducerDisconnectOnBatchCompleteTest extends FtpServerTestSuppo
Thread.sleep(2000);
FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
- assertFalse("The FTPClient should be already disconnected", endpoint.getFtpClient().isConnected());
- assertTrue("The FtpEndpoint should be configured to disconnect", endpoint.isDisconnectOnBatchComplete());
+ assertFalse(endpoint.getFtpClient().isConnected(), "The FTPClient should be already disconnected");
+ assertTrue(endpoint.isDisconnectOnBatchComplete(), "The FtpEndpoint should be configured to disconnect");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectTest.java
index 0311b90..761ed61 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectTest.java
@@ -17,13 +17,16 @@
package org.apache.camel.component.file.remote;
import org.apache.commons.net.ftp.FTPClient;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerDisconnectTest extends FtpServerTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
@@ -42,8 +45,8 @@ public class FtpProducerDisconnectTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), "Hello World", "claus.txt");
FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
- assertFalse("The FTPClient should be already disconnected", endpoint.getFtpClient().isConnected());
- assertTrue("The FtpEndpoint should be configured to disconnect", endpoint.isDisconnect());
+ assertFalse(endpoint.getFtpClient().isConnected(), "The FTPClient should be already disconnected");
+ assertTrue(endpoint.isDisconnect(), "The FtpEndpoint should be configured to disconnect");
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDoneFileNameTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDoneFileNameTest.java
index 9e099ba..fabe335 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDoneFileNameTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDoneFileNameTest.java
@@ -21,7 +21,12 @@ import java.io.File;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.Exchange;
import org.apache.camel.ExpressionIllegalSyntaxException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
public class FtpProducerDoneFileNameTest extends FtpServerTestSupport {
@@ -34,10 +39,10 @@ public class FtpProducerDoneFileNameTest extends FtpServerTestSupport {
template.sendBodyAndHeader(getFtpUrl() + "&doneFileName=done", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/done/hello.txt");
- assertEquals("File should exists", true, file.exists());
+ assertEquals(true, file.exists(), "File should exists");
File done = new File(FTP_ROOT_DIR + "/done/done");
- assertEquals("Done file should exists", true, done.exists());
+ assertEquals(true, done.exists(), "Done file should exists");
}
@Test
@@ -45,10 +50,10 @@ public class FtpProducerDoneFileNameTest extends FtpServerTestSupport {
template.sendBodyAndHeader(getFtpUrl() + "&doneFileName=done-${file:name}", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/done/hello.txt");
- assertEquals("File should exists", true, file.exists());
+ assertEquals(true, file.exists(), "File should exists");
File done = new File(FTP_ROOT_DIR + "/done/done-hello.txt");
- assertEquals("Done file should exists", true, done.exists());
+ assertEquals(true, done.exists(), "Done file should exists");
}
@Test
@@ -56,10 +61,10 @@ public class FtpProducerDoneFileNameTest extends FtpServerTestSupport {
template.sendBodyAndHeader(getFtpUrl() + "&doneFileName=${file:name}.done", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/done/hello.txt");
- assertEquals("File should exists", true, file.exists());
+ assertEquals(true, file.exists(), "File should exists");
File done = new File(FTP_ROOT_DIR + "/done/hello.txt.done");
- assertEquals("Done file should exists", true, done.exists());
+ assertEquals(true, done.exists(), "Done file should exists");
}
@Test
@@ -67,10 +72,10 @@ public class FtpProducerDoneFileNameTest extends FtpServerTestSupport {
template.sendBodyAndHeader(getFtpUrl() + "&doneFileName=${file:name.noext}.done", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/done/hello.txt");
- assertEquals("File should exists", true, file.exists());
+ assertEquals(true, file.exists(), "File should exists");
File done = new File(FTP_ROOT_DIR + "/done/hello.done");
- assertEquals("Done file should exists", true, done.exists());
+ assertEquals(true, done.exists(), "Done file should exists");
}
@Test
@@ -80,7 +85,7 @@ public class FtpProducerDoneFileNameTest extends FtpServerTestSupport {
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
ExpressionIllegalSyntaxException cause = assertIsInstanceOf(ExpressionIllegalSyntaxException.class, e.getCause());
- assertTrue(cause.getMessage(), cause.getMessage().endsWith("Cannot resolve reminder: ${file:parent}/foo"));
+ assertTrue(cause.getMessage().endsWith("Cannot resolve reminder: ${file:parent}/foo"), cause.getMessage());
}
}
@@ -91,7 +96,7 @@ public class FtpProducerDoneFileNameTest extends FtpServerTestSupport {
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
- assertTrue(cause.getMessage(), cause.getMessage().startsWith("doneFileName must be specified and not empty"));
+ assertTrue(cause.getMessage().startsWith("doneFileName must be specified and not empty"), cause.getMessage());
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerExpressionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerExpressionTest.java
index d07a0dc..83d7ffa 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerExpressionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerExpressionTest.java
@@ -21,8 +21,11 @@ import java.util.Calendar;
import java.util.Date;
import org.apache.camel.BindToRegistry;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertFileExists;
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
/**
* Unit test for FTP using expression (file language)
@@ -37,7 +40,7 @@ public class FtpProducerExpressionTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
deleteDirectory("target/filelanguage");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java
index 5d9664c..05e5561 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java
@@ -19,8 +19,10 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
public class FtpProducerFileExistAppendNoFileBeforeTest extends FtpServerTestSupport {
@@ -29,7 +31,7 @@ public class FtpProducerFileExistAppendNoFileBeforeTest extends FtpServerTestSup
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
deleteDirectory("target/exist");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java
index 7491b15..509e302 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java
@@ -19,8 +19,10 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
public class FtpProducerFileExistAppendTest extends FtpServerTestSupport {
private static final boolean ON_WINDOWS = System.getProperty("os.name").startsWith("Windows");
@@ -30,7 +32,7 @@ public class FtpProducerFileExistAppendTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
deleteDirectory("target/exist");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java
index 5828477..4b0574e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java
@@ -21,8 +21,13 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFileOperationFailedException;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
public class FtpProducerFileExistFailTest extends FtpServerTestSupport {
@@ -31,7 +36,7 @@ public class FtpProducerFileExistFailTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
deleteDirectory("target/exist");
@@ -50,7 +55,7 @@ public class FtpProducerFileExistFailTest extends FtpServerTestSupport {
fail("Should have thrown an exception");
} catch (CamelExecutionException e) {
GenericFileOperationFailedException cause = assertIsInstanceOf(GenericFileOperationFailedException.class, e.getCause());
- assertEquals("File already exist: exist/hello.txt. Cannot write new file.", cause.getMessage());
+ assertEquals(cause.getMessage(), "File already exist: exist/hello.txt. Cannot write new file.");
}
assertMockEndpointsSatisfied();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java
index 3423ca6..0e016eb 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java
@@ -19,8 +19,10 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
public class FtpProducerFileExistIgnoreTest extends FtpServerTestSupport {
@@ -29,7 +31,7 @@ public class FtpProducerFileExistIgnoreTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
deleteDirectory("target/exist");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java
index 12a30e3..2d54190 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java
@@ -19,8 +19,10 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
public class FtpProducerFileExistOverrideNoFileBeforeTest extends FtpServerTestSupport {
@@ -29,7 +31,7 @@ public class FtpProducerFileExistOverrideNoFileBeforeTest extends FtpServerTestS
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
deleteDirectory("target/exist");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java
index b4b8900..01b4241 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FtpProducerFileExistOverrideTest extends FtpServerTestSupport {
@@ -29,7 +29,7 @@ public class FtpProducerFileExistOverrideTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
template.sendBodyAndHeader(getFtpUrl(), "Hello World", Exchange.FILE_NAME, "hello.txt");
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTwoUploadTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTwoUploadTest.java
index 8770a4f..8675f55 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTwoUploadTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTwoUploadTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.Exchange;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerFileExistOverrideTwoUploadTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithCharsetTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithCharsetTest.java
index 8e05fa1..95af957 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithCharsetTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithCharsetTest.java
@@ -23,10 +23,18 @@ import java.nio.charset.Charset;
import org.apache.camel.converter.IOConverter;
import org.apache.camel.util.IOHelper;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerFileWithCharsetTest extends FtpServerTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(FtpPollEnrichConsumeWithDisconnectAndDeleteTest.class);
+
private String payload = "\u00e6\u00f8\u00e5 \u00a9";
private String getFtpUrl() {
@@ -34,19 +42,19 @@ public class FtpProducerFileWithCharsetTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
byte[] utf = payload.getBytes("utf-8");
byte[] iso = payload.getBytes("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, Charset.forName("utf-8")));
+ LOG.debug("iso: {}", new String(iso, Charset.forName("iso-8859-1")));
for (byte b : utf) {
- log.debug("utf byte: {}", b);
+ LOG.debug("utf byte: {}", b);
}
for (byte b : iso) {
- log.debug("iso byte: {}", b);
+ LOG.debug("iso byte: {}", b);
}
super.setUp();
}
@@ -56,7 +64,7 @@ public class FtpProducerFileWithCharsetTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), payload, "charset/iso.txt");
File file = new File(FTP_ROOT_DIR + "/upload/charset/iso.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
String fileContent = new String(IOConverter.toByteArray(file), "iso-8859-1");
assertEquals(fileContent, payload);
@@ -65,7 +73,7 @@ public class FtpProducerFileWithCharsetTest extends FtpServerTestSupport {
byte[] buffer = new byte[100];
int len = fis.read(buffer);
- assertTrue("Should read data: " + len, len != -1);
+ assertTrue(len != -1, "Should read data: " + len);
byte[] data = new byte[len];
System.arraycopy(buffer, 0, data, 0, len);
fis.close();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathNoStepwiseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathNoStepwiseTest.java
index 07fdd9b..a8ed12d 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathNoStepwiseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathNoStepwiseTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerFileWithPathNoStepwiseTest extends FtpServerTestSupport {
@@ -32,7 +35,7 @@ public class FtpProducerFileWithPathNoStepwiseTest extends FtpServerTestSupport
sendFile(getFtpUrl(), "Hello World", "hello/claus.txt");
File file = new File(FTP_ROOT_DIR + "/upload/hello/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorAutoNoStepwiseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorAutoNoStepwiseTest.java
index 29131a5..a1c16c7 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorAutoNoStepwiseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorAutoNoStepwiseTest.java
@@ -21,7 +21,11 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerFileWithPathPathSeparatorAutoNoStepwiseTest extends FtpServerTestSupport {
@@ -40,7 +44,7 @@ public class FtpProducerFileWithPathPathSeparatorAutoNoStepwiseTest extends FtpS
assertNotNull(out);
File file = new File(FTP_ROOT_DIR + "/upload/hello/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
assertEquals("upload/hello/claus.txt", out.getIn().getHeader(Exchange.FILE_NAME_PRODUCED));
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorUnixNoStepwiseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorUnixNoStepwiseTest.java
index 88f48e0..a670b73 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorUnixNoStepwiseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorUnixNoStepwiseTest.java
@@ -21,7 +21,11 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerFileWithPathPathSeparatorUnixNoStepwiseTest extends FtpServerTestSupport {
@@ -40,7 +44,7 @@ public class FtpProducerFileWithPathPathSeparatorUnixNoStepwiseTest extends FtpS
assertNotNull(out);
File file = new File(FTP_ROOT_DIR + "/upload/hello/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
assertEquals("upload/hello/claus.txt", out.getIn().getHeader(Exchange.FILE_NAME_PRODUCED));
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorWindowsNoStepwiseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorWindowsNoStepwiseTest.java
index 1a90fd6..39765be 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorWindowsNoStepwiseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathPathSeparatorWindowsNoStepwiseTest.java
@@ -21,7 +21,11 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerFileWithPathPathSeparatorWindowsNoStepwiseTest extends FtpServerTestSupport {
@@ -40,7 +44,7 @@ public class FtpProducerFileWithPathPathSeparatorWindowsNoStepwiseTest extends F
assertNotNull(out);
File file = new File(FTP_ROOT_DIR + "/upload/hello/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
assertEquals("upload/hello\\claus.txt", out.getIn().getHeader(Exchange.FILE_NAME_PRODUCED));
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathTest.java
index 08e7fe5..67c690c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileWithPathTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerFileWithPathTest extends FtpServerTestSupport {
@@ -32,7 +35,7 @@ public class FtpProducerFileWithPathTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), "Hello World", "hello/claus.txt");
File file = new File(FTP_ROOT_DIR + "/upload/hello/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerJailStartingDirectoryTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerJailStartingDirectoryTest.java
index fd4353c..f0d8e51 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerJailStartingDirectoryTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerJailStartingDirectoryTest.java
@@ -19,7 +19,11 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class FtpProducerJailStartingDirectoryTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerMoveExistingTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerMoveExistingTest.java
index adde74d..8b58b13 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerMoveExistingTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerMoveExistingTest.java
@@ -21,7 +21,14 @@ import java.io.File;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.Exchange;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertFileExists;
+import static org.apache.camel.test.junit5.TestSupport.assertFileNotExists;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
*
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerMultipleSiteCommandTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerMultipleSiteCommandTest.java
index 811c592..e93c0d3 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerMultipleSiteCommandTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerMultipleSiteCommandTest.java
@@ -20,7 +20,10 @@ import java.io.File;
import org.apache.camel.BindToRegistry;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerMultipleSiteCommandTest extends FtpServerTestSupport {
@@ -36,7 +39,7 @@ public class FtpProducerMultipleSiteCommandTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), "Hello World", "hello.txt");
File file = new File(FTP_ROOT_DIR + "/site/hello.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRawPasswordTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRawPasswordTest.java
index 861c27a..7b69761 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRawPasswordTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRawPasswordTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for password parameter using RAW value
@@ -39,7 +42,7 @@ public class FtpProducerRawPasswordTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), "Hello World", "camel.txt");
File file = new File(FTP_ROOT_DIR + "/upload/camel.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRecipientListParallelTimeoutTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRecipientListParallelTimeoutTest.java
index 99d1504..2d9c913 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRecipientListParallelTimeoutTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRecipientListParallelTimeoutTest.java
@@ -20,13 +20,13 @@ import org.apache.camel.AggregationStrategy;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Unit test to verify that Camel can build remote directory on FTP server if missing (full or part of).
*/
-@Ignore("Run this test manually")
+@Disabled("Run this test manually")
public class FtpProducerRecipientListParallelTimeoutTest extends FtpServerTestSupport {
private String getFtpUrl() {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRecipientListTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRecipientListTest.java
index c13e46f..bed154f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRecipientListTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRecipientListTest.java
@@ -19,7 +19,9 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerRecipientListTest extends FtpServerTestSupport {
@@ -34,13 +36,13 @@ public class FtpProducerRecipientListTest extends FtpServerTestSupport {
template.sendBodyAndHeader("direct:start", "Hi World", "foo", getFtpUrl() + "&fileName=hi.txt");
File file1 = new File(FTP_ROOT_DIR + "/list/hello.txt");
- assertTrue("File should exists " + file1, file1.exists());
+ assertTrue(file1.exists(), "File should exists " + file1);
File file2 = new File(FTP_ROOT_DIR + "/list/bye.txt");
- assertTrue("File should exists " + file2, file1.exists());
+ assertTrue(file1.exists(), "File should exists " + file2);
File file3 = new File(FTP_ROOT_DIR + "/list/hi.txt");
- assertTrue("File should exists " + file3, file1.exists());
+ assertTrue(file1.exists(), "File should exists " + file3);
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerReplyStringTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerReplyStringTest.java
index 6db19b8..ae7a1c7 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerReplyStringTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerReplyStringTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpProducerReplyStringTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRootFileExistFailTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRootFileExistFailTest.java
index 0d608c7..a597081 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRootFileExistFailTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRootFileExistFailTest.java
@@ -19,8 +19,13 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.Exchange;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertFileExists;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
public class FtpProducerRootFileExistFailTest extends FtpServerTestSupport {
@@ -29,7 +34,7 @@ public class FtpProducerRootFileExistFailTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
// create existing file on ftp server
@@ -43,7 +48,7 @@ public class FtpProducerRootFileExistFailTest extends FtpServerTestSupport {
fail("Should have thrown an exception");
} catch (CamelExecutionException e) {
GenericFileOperationFailedException cause = assertIsInstanceOf(GenericFileOperationFailedException.class, e.getCause());
- assertEquals("File already exist: hello.txt. Cannot write new file.", cause.getMessage());
+ assertEquals(cause.getMessage(), "File already exist: hello.txt. Cannot write new file.");
}
// root file should still exist
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerSendNoopFalseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerSendNoopFalseTest.java
index 46fc060..5997255 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerSendNoopFalseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerSendNoopFalseTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerSendNoopFalseTest extends FtpServerTestSupport {
@@ -32,7 +35,7 @@ public class FtpProducerSendNoopFalseTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), "Hello World", "hello/claus.txt");
File file = new File(FTP_ROOT_DIR + "/upload/hello/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerSiteCommandTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerSiteCommandTest.java
index 5bccbeb..3d572c9 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerSiteCommandTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerSiteCommandTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpProducerSiteCommandTest extends FtpServerTestSupport {
@@ -32,7 +35,7 @@ public class FtpProducerSiteCommandTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), "Hello World", "hello.txt");
File file = new File(FTP_ROOT_DIR + "/site/hello.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerTempFileExistIssueTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerTempFileExistIssueTest.java
index 0989ddc..8278aa8 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerTempFileExistIssueTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerTempFileExistIssueTest.java
@@ -21,7 +21,12 @@ import java.io.File;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.Exchange;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class FtpProducerTempFileExistIssueTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerTempPrefixTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerTempPrefixTest.java
index c27021d..1e5770a 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerTempPrefixTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerTempPrefixTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote;
import java.io.File;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to verify that Camel can build remote directory on FTP server if missing (full or part of).
@@ -35,7 +38,7 @@ public class FtpProducerTempPrefixTest extends FtpServerTestSupport {
sendFile(getFtpUrl(), "Hello World", "claus.txt");
File file = new File(FTP_ROOT_DIR + "/upload/user/claus/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
}
\ No newline at end of file
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerToDMoveExistingTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerToDMoveExistingTest.java
index de57eb2..8820a10 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerToDMoveExistingTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerToDMoveExistingTest.java
@@ -21,7 +21,9 @@ import java.util.Map;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertFileExists;
/**
*
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpReconnectAttemptServerStoppedTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpReconnectAttemptServerStoppedTest.java
index 070ae3b..da2fe96 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpReconnectAttemptServerStoppedTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpReconnectAttemptServerStoppedTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpReconnectAttemptServerStoppedTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpReconnectAttemptUnknownHostTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpReconnectAttemptUnknownHostTest.java
index aa2ff91..f2cc554 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpReconnectAttemptUnknownHostTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpReconnectAttemptUnknownHostTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpReconnectAttemptUnknownHostTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepth2Test.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepth2Test.java
index f2a84af..350c275 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepth2Test.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepth2Test.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpRecursiveDepth2Test extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepth3Test.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepth3Test.java
index cf81142..02a6ce6 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepth3Test.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepth3Test.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpRecursiveDepth3Test extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepthTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepthTest.java
index e2fb805..2496d86 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepthTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpRecursiveDepthTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpRecursiveDepthTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpServerTestSupport.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpServerTestSupport.java
index c7006bf..003a53a 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpServerTestSupport.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpServerTestSupport.java
@@ -29,10 +29,14 @@ import org.apache.ftpserver.ftplet.UserManager;
import org.apache.ftpserver.listener.ListenerFactory;
import org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor;
import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import static org.apache.camel.language.simple.SimpleLanguage.simple;
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Base class for unit testing using a FTPServer
@@ -43,11 +47,13 @@ public abstract class FtpServerTestSupport extends BaseServerTestSupport {
protected static final File USERS_FILE = new File("./src/test/resources/users.properties");
protected static final String DEFAULT_LISTENER = "default";
+ private static final Logger LOG = LoggerFactory.getLogger(FtpServerTestSupport.class);
+
protected FtpServer ftpServer;
protected boolean canTest;
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory(FTP_ROOT_DIR);
@@ -72,7 +78,7 @@ public abstract class FtpServerTestSupport extends BaseServerTestSupport {
String name = System.getProperty("os.name");
String message = nsae.getMessage();
- log.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
+ LOG.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
} else {
// some other error then throw it so the test can fail
throw e;
@@ -81,7 +87,7 @@ public abstract class FtpServerTestSupport extends BaseServerTestSupport {
}
@Override
- @After
+ @AfterEach
public void tearDown() throws Exception {
super.tearDown();
@@ -103,7 +109,7 @@ public abstract class FtpServerTestSupport extends BaseServerTestSupport {
protected FtpServerFactory createFtpServerFactory() throws Exception {
assertTrue(USERS_FILE.exists());
- assertTrue("Port number is not initialized in an expected range: " + getPort(), getPort() > 0);
+ assertTrue(getPort() > 0, "Port number is not initialized in an expected range: " + getPort());
NativeFileSystemFactory fsf = new NativeFileSystemFactory();
fsf.setCreateHome(true);
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java
index 17df4da..69d9c9b 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java
@@ -20,8 +20,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.ShutdownRunningTask;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Unit test to verify shutdown.
@@ -33,7 +35,7 @@ public class FtpShutdownCompleteAllTasksTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -63,7 +65,7 @@ public class FtpShutdownCompleteAllTasksTest extends FtpServerTestSupport {
context.stop();
// should route all 5
- assertEquals("Should complete all messages", 5, bar.getReceivedCounter());
+ assertEquals(5, bar.getReceivedCounter(), "Should complete all messages");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java
index bc40332..45eb2a8 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java
@@ -20,8 +20,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.ShutdownRunningTask;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test to verify shutdown.
@@ -33,7 +35,7 @@ public class FtpShutdownCompleteCurrentTaskOnlyTest extends FtpServerTestSupport
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -64,7 +66,7 @@ public class FtpShutdownCompleteCurrentTaskOnlyTest extends FtpServerTestSupport
context.stop();
// should NOT route all 5
- assertTrue("Should NOT complete all messages, was: " + bar.getReceivedCounter(), bar.getReceivedCounter() < 5);
+ assertTrue(bar.getReceivedCounter() < 5, "Should NOT complete all messages, was: " + bar.getReceivedCounter());
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeAbsoluteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeAbsoluteTest.java
index 8553594..879ec06 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeAbsoluteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeAbsoluteTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpSimpleConsumeAbsoluteTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeDirectoryParseWithAbsoluteDepthNoStepwiseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeDirectoryParseWithAbsoluteDepthNoStepwiseTest.java
index ef1c37b..f90d1b2 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeDirectoryParseWithAbsoluteDepthNoStepwiseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeDirectoryParseWithAbsoluteDepthNoStepwiseTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FtpSimpleConsumeDirectoryParseWithAbsoluteDepthNoStepwiseTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingPartialReadTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingPartialReadTest.java
index 96f41e6..e8d285b 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingPartialReadTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingPartialReadTest.java
@@ -24,7 +24,10 @@ import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpSimpleConsumeStreamingPartialReadTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingTest.java
index 92fcb06..73c5425 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingTest.java
@@ -22,7 +22,9 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpSimpleConsumeStreamingTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingWithMultipleFilesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingWithMultipleFilesTest.java
index 56819a2..0186c74 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingWithMultipleFilesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingWithMultipleFilesTest.java
@@ -22,7 +22,9 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpSimpleConsumeStreamingWithMultipleFilesTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSoTimeoutTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSoTimeoutTest.java
index 45172f4..b47b95a 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSoTimeoutTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSoTimeoutTest.java
@@ -17,16 +17,20 @@
package org.apache.camel.component.file.remote;
import java.net.ServerSocket;
+import java.util.concurrent.TimeUnit;
import org.apache.camel.BindToRegistry;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
import org.apache.commons.net.ftp.FTPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Test class used to demonstrate the problematic disconnect sequence of the {@link FtpOperations}.
@@ -43,7 +47,7 @@ public class FtpSoTimeoutTest extends CamelTestSupport {
// --- Set up
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
// the created server socket makes it possible for the FTP client to establish the socket connection.
// However, no message will ever be sent back, thus a read timeout should occur within FTPClient#__getReply()
@@ -52,7 +56,7 @@ public class FtpSoTimeoutTest extends CamelTestSupport {
}
@Override
- @After
+ @AfterEach
public void tearDown() throws Exception {
super.tearDown();
if (serverSocket != null) {
@@ -90,17 +94,23 @@ public class FtpSoTimeoutTest extends CamelTestSupport {
// --- Tests
- @Test(timeout = 10000, expected = CamelExecutionException.class)
+ @Test
+ @Timeout(value = 10, unit = TimeUnit.SECONDS)
public void testWithDefaultTimeout() throws Exception {
- // send exchange to the route using the custom FTPClient (with a default timeout)
- // the soTimeout triggers in time and test is successful
- template.sendBody("direct:with", "");
+ assertThrows(CamelExecutionException.class, () -> {
+ // send exchange to the route using the custom FTPClient (with a default timeout)
+ // the soTimeout triggers in time and test is successful
+ template.sendBody("direct:with", "");
+ });
}
-
- @Test(timeout = 10000, expected = CamelExecutionException.class)
+
+ @Test
+ @Timeout(value = 10, unit = TimeUnit.SECONDS)
public void testWithoutDefaultTimeout() throws Exception {
- // send exchange to the route using the default FTPClient (without a default timeout)
- // the soTimeout never triggers and test fails after its own timeout
- template.sendBody("direct:without", "");
+ assertThrows(CamelExecutionException.class, () -> {
+ // send exchange to the route using the default FTPClient (without a default timeout)
+ // the soTimeout never triggers and test fails after its own timeout
+ template.sendBody("direct:without", "");
+ });
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpStreamingMoveTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpStreamingMoveTest.java
index 4f2c157..5b8b93f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpStreamingMoveTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpStreamingMoveTest.java
@@ -22,8 +22,11 @@ import java.io.InputStream;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FtpStreamingMoveTest extends FtpServerTestSupport {
@@ -32,7 +35,7 @@ public class FtpStreamingMoveTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
deleteDirectory("target/mymove");
@@ -60,7 +63,7 @@ public class FtpStreamingMoveTest extends FtpServerTestSupport {
Thread.sleep(1000);
File file = new File(FTP_ROOT_DIR + "/mymove/done/hello.txt");
- assertTrue("File should have been renamed", file.exists());
+ assertTrue(file.exists(), "File should have been renamed");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpThrowExceptionOnConnectionFailedTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpThrowExceptionOnConnectionFailedTest.java
index eac20e6..f173b7f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpThrowExceptionOnConnectionFailedTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpThrowExceptionOnConnectionFailedTest.java
@@ -22,7 +22,11 @@ import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Unit test for login failure due bad password and no re connect attempts allowed
@@ -41,7 +45,7 @@ public class FtpThrowExceptionOnConnectionFailedTest extends FtpServerTestSuppor
// assert file NOT created
File file = new File(FTP_ROOT_DIR + "login/report.txt");
- assertFalse("The file should NOT exists", file.exists());
+ assertFalse(file.exists(), "The file should NOT exists");
}
private void uploadFile(String username, String password) throws Exception {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpUtilsExtractDirNameFromAbsolutePathTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpUtilsExtractDirNameFromAbsolutePathTest.java
index 540e81f..4cb3a69 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpUtilsExtractDirNameFromAbsolutePathTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpUtilsExtractDirNameFromAbsolutePathTest.java
@@ -16,9 +16,9 @@
*/
package org.apache.camel.component.file.remote;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class FtpUtilsExtractDirNameFromAbsolutePathTest {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java
index 88bfc9c..39e1ec9 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java
@@ -23,18 +23,24 @@ import org.apache.camel.util.ObjectHelper;
import org.apache.ftpserver.FtpServerFactory;
import org.apache.ftpserver.listener.ListenerFactory;
import org.apache.ftpserver.ssl.SslConfigurationFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Abstract base class for unit testing using a secure FTP Server (over SSL/TLS)
*/
public abstract class FtpsServerTestSupport extends FtpServerTestSupport {
-
+
protected static final String AUTH_VALUE_SSL = "SSLv3";
protected static final String AUTH_VALUE_TLS = "TLSv1.2";
protected static final File FTPSERVER_KEYSTORE = new File("./src/test/resources/server.jks");
protected static final String FTPSERVER_KEYSTORE_PASSWORD = "password";
+ private static final Logger LOG = LoggerFactory.getLogger(FtpsServerTestSupport.class);
+
@Override
protected FtpServerFactory createFtpServerFactory() throws Exception {
try {
@@ -45,7 +51,7 @@ public abstract class FtpsServerTestSupport extends FtpServerTestSupport {
if (nsae != null) {
String name = System.getProperty("os.name");
String message = nsae.getMessage();
- log.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
+ LOG.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
return null;
} else {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/OsgiParserFactoryTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/OsgiParserFactoryTest.java
index 27710a5..9488ef5 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/OsgiParserFactoryTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/OsgiParserFactoryTest.java
@@ -27,24 +27,25 @@ import org.apache.commons.net.ftp.parser.OS2FTPEntryParser;
import org.apache.commons.net.ftp.parser.OS400FTPEntryParser;
import org.apache.commons.net.ftp.parser.UnixFTPEntryParser;
import org.apache.commons.net.ftp.parser.VMSVersioningFTPEntryParser;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public class OsgiParserFactoryTest {
private static final OsgiParserFactory OSGI_PARSER_FACTORY = new OsgiParserFactory(null);
+
@Mock
private FTPClientConfig ftpClientConfig;
- @Before
+ @BeforeEach
public void setup() {
when(ftpClientConfig.getDefaultDateFormatStr()).thenReturn("yyyy-MM-dd");
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java
index 7524a86..bd84a41 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java
@@ -20,7 +20,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* An unit test based on Paddy having trouble with SFTP.
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RecipientListErrorHandlingIssueTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RecipientListErrorHandlingIssueTest.java
index dd309b9..031558d 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RecipientListErrorHandlingIssueTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RecipientListErrorHandlingIssueTest.java
@@ -22,7 +22,7 @@ import java.util.Map;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RecipientListErrorHandlingIssueTest extends FtpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteEndPointRemoteFilePollingConsumerPollStrategyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteEndPointRemoteFilePollingConsumerPollStrategyTest.java
index 8e729c7..979df90 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteEndPointRemoteFilePollingConsumerPollStrategyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteEndPointRemoteFilePollingConsumerPollStrategyTest.java
@@ -16,8 +16,10 @@
*/
package org.apache.camel.component.file.remote;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class RemoteEndPointRemoteFilePollingConsumerPollStrategyTest extends CamelTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileIgnoreDoPollErrorTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileIgnoreDoPollErrorTest.java
index 24b2a02..3e49530 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileIgnoreDoPollErrorTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileIgnoreDoPollErrorTest.java
@@ -25,8 +25,12 @@ import org.apache.camel.Processor;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.file.GenericFileOperationFailedException;
import org.apache.camel.component.file.GenericFileProducer;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class RemoteFileIgnoreDoPollErrorTest {
private final RemoteFileEndpoint<Object> remoteFileEndpoint = new RemoteFileEndpoint<Object>() {
@@ -55,14 +59,14 @@ public class RemoteFileIgnoreDoPollErrorTest {
public void testReadDirErrorIsHandled() throws Exception {
RemoteFileConsumer<Object> consumer = getRemoteFileConsumer("true", true);
boolean result = consumer.doSafePollSubDirectory("anyPath", "adir", new ArrayList<GenericFile<Object>>(), 0);
- Assert.assertTrue(result);
+ assertTrue(result);
}
@Test
public void testReadDirErrorIsHandledWithNoMorePoll() throws Exception {
RemoteFileConsumer<Object> consumer = getRemoteFileConsumer("false", true);
boolean result = consumer.doSafePollSubDirectory("anyPath", "adir", new ArrayList<GenericFile<Object>>(), 0);
- Assert.assertFalse(result);
+ assertFalse(result);
}
@Test
@@ -70,9 +74,9 @@ public class RemoteFileIgnoreDoPollErrorTest {
RemoteFileConsumer<Object> consumer = getRemoteFileConsumer("IllegalStateException", false);
try {
consumer.doSafePollSubDirectory("anyPath", "adir", new ArrayList<GenericFile<Object>>(), 0);
- Assert.fail("Must throw wrapped IllegalStateException in GenericFileOperationFailedException");
+ fail("Must throw wrapped IllegalStateException in GenericFileOperationFailedException");
} catch (GenericFileOperationFailedException e) {
- Assert.assertTrue(e.getCause() instanceof IllegalStateException);
+ assertTrue(e.getCause() instanceof IllegalStateException);
}
}
@@ -81,9 +85,9 @@ public class RemoteFileIgnoreDoPollErrorTest {
RemoteFileConsumer<Object> consumer = getRemoteFileConsumer("GenericFileOperationFailedException", false);
try {
consumer.doSafePollSubDirectory("anyPath", "adir", new ArrayList<GenericFile<Object>>(), 0);
- Assert.fail("Must throw GenericFileOperationFailedException");
+ fail("Must throw GenericFileOperationFailedException");
} catch (GenericFileOperationFailedException e) {
- Assert.assertNull(e.getCause());
+ assertNull(e.getCause());
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileProduceOverruleOnlyOnceTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileProduceOverruleOnlyOnceTest.java
index 91d7479..0258b50 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileProduceOverruleOnlyOnceTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileProduceOverruleOnlyOnceTest.java
@@ -22,8 +22,10 @@ import java.util.Map;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
/**
*
@@ -46,7 +48,7 @@ public class RemoteFileProduceOverruleOnlyOnceTest extends FtpServerTestSupport
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/out");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/SftpPollEnrichConsumeWithDisconnectAndDeleteTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/SftpPollEnrichConsumeWithDisconnectAndDeleteTest.java
index 56f2083..cccd06e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/SftpPollEnrichConsumeWithDisconnectAndDeleteTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/SftpPollEnrichConsumeWithDisconnectAndDeleteTest.java
@@ -23,10 +23,16 @@ import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.remote.sftp.SftpServerTestSupport;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
public class SftpPollEnrichConsumeWithDisconnectAndDeleteTest extends SftpServerTestSupport {
+ private static final Logger LOG = LoggerFactory.getLogger(SftpPollEnrichConsumeWithDisconnectAndDeleteTest.class);
+
@Test
public void testSftpSimpleConsume() throws Exception {
if (!canTest()) {
@@ -55,12 +61,12 @@ public class SftpPollEnrichConsumeWithDisconnectAndDeleteTest extends SftpServer
fileExists = file.exists();
if (fileExists) {
- log.info("Will check that file has been deleted again in 200ms");
+ LOG.info("Will check that file has been deleted again in 200ms");
Thread.sleep(200);
}
}
- assertFalse("The file should have been deleted", fileExists);
+ assertFalse(fileExists, "The file should have been deleted");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/ToFtpTempFileTargetFileExistTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/ToFtpTempFileTargetFileExistTest.java
index 552538e..85aa289 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/ToFtpTempFileTargetFileExistTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/ToFtpTempFileTargetFileExistTest.java
@@ -23,8 +23,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class ToFtpTempFileTargetFileExistTest extends FtpServerTestSupport {
@@ -34,7 +36,7 @@ public class ToFtpTempFileTargetFileExistTest extends FtpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
prepareFtpServer();
@@ -65,7 +67,7 @@ public class ToFtpTempFileTargetFileExistTest extends FtpServerTestSupport {
// assert file is created
File file = new File(FTP_ROOT_DIR + "/tempfile/foo/bar/message.txt");
- assertTrue("The file should exists", file.exists());
+ assertTrue(file.exists(), "The file should exists");
}
@Override
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
index e16d9ed..db5a324 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
@@ -18,8 +18,13 @@ package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.test.junit5.TestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
public class UriConfigurationTest extends CamelTestSupport {
@@ -160,11 +165,11 @@ public class UriConfigurationTest extends CamelTestSupport {
}
private void assertRemoteFileEndpointFile(String endpointUri, String expectedFile) {
- RemoteFileEndpoint<?> endpoint = resolveMandatoryEndpoint(context, endpointUri, RemoteFileEndpoint.class);
- assertNotNull("Could not find endpoint: " + endpointUri, endpoint);
+ RemoteFileEndpoint<?> endpoint = TestSupport.resolveMandatoryEndpoint(context, endpointUri, RemoteFileEndpoint.class);
+ assertNotNull(endpoint, "Could not find endpoint: " + endpointUri);
String file = endpoint.getConfiguration().getDirectory();
- assertEquals("For uri: " + endpointUri + " the file is not equal", expectedFile, file);
+ assertEquals(expectedFile, file, "For uri: " + endpointUri + " the file is not equal");
}
@Test
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelManualTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelManualTest.java
index ab8a24d..7840962 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelManualTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelManualTest.java
@@ -17,16 +17,18 @@
package org.apache.camel.component.file.remote.manual;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore("Run this test manually")
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+
+@Disabled("Run this test manually")
public class FtpConsumerCamelManualTest extends CamelTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/ftptest");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelRecursiveManualTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelRecursiveManualTest.java
index 1135625..6dd6e2d 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelRecursiveManualTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelRecursiveManualTest.java
@@ -17,16 +17,18 @@
package org.apache.camel.component.file.remote.manual;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore("Run this test manually")
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+
+@Disabled("Run this test manually")
public class FtpConsumerCamelRecursiveManualTest extends CamelTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/ftptest");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelRecursiveToAbsoluteManualTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelRecursiveToAbsoluteManualTest.java
index f97992e..cf5cebd 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelRecursiveToAbsoluteManualTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerCamelRecursiveToAbsoluteManualTest.java
@@ -17,16 +17,18 @@
package org.apache.camel.component.file.remote.manual;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore("Run this test manually")
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+
+@Disabled("Run this test manually")
public class FtpConsumerCamelRecursiveToAbsoluteManualTest extends CamelTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/ftptest");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelManualTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelManualTest.java
index 0280a9e..d9eb930 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelManualTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelManualTest.java
@@ -17,16 +17,18 @@
package org.apache.camel.component.file.remote.manual;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore("Run this test manually")
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+
+@Disabled("Run this test manually")
public class FtpConsumerNotStepwiseCamelManualTest extends CamelTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/ftptest");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelRecursiveManualTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelRecursiveManualTest.java
index a4ccc22..feb8b1e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelRecursiveManualTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelRecursiveManualTest.java
@@ -17,16 +17,18 @@
package org.apache.camel.component.file.remote.manual;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore("Run this test manually")
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+
+@Disabled("Run this test manually")
public class FtpConsumerNotStepwiseCamelRecursiveManualTest extends CamelTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/ftptest");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelRecursiveToAbsoluteManualTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelRecursiveToAbsoluteManualTest.java
index fbde292..73d237e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelRecursiveToAbsoluteManualTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerNotStepwiseCamelRecursiveToAbsoluteManualTest.java
@@ -17,16 +17,18 @@
package org.apache.camel.component.file.remote.manual;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore("Run this test manually")
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+
+@Disabled("Run this test manually")
public class FtpConsumerNotStepwiseCamelRecursiveToAbsoluteManualTest extends CamelTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/ftptest");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerScottManualTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerScottManualTest.java
index 52b77a8..ae1ba2c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerScottManualTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerScottManualTest.java
@@ -17,16 +17,18 @@
package org.apache.camel.component.file.remote.manual;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore("Run this test manually")
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+
+@Disabled("Run this test manually")
public class FtpConsumerScottManualTest extends CamelTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/ftptest");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerScottRecursiveManualTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerScottRecursiveManualTest.java
index eefcc8a..a437299 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerScottRecursiveManualTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/manual/FtpConsumerScottRecursiveManualTest.java
@@ -17,16 +17,18 @@
package org.apache.camel.component.file.remote.manual;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore("Run this test manually")
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+
+@Disabled("Run this test manually")
public class FtpConsumerScottRecursiveManualTest extends CamelTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/ftptest");
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePathTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePathTest.java
index 110510a..c91729d 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePathTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePathTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.file.remote.sftp;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FromSftpRecursiveNotStepwiseNoBasePathTest extends SftpServerTestSupport {
@@ -30,7 +30,7 @@ public class FromSftpRecursiveNotStepwiseNoBasePathTest extends SftpServerTestSu
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
rootDirMode = true;
super.setUp();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpChangedReadLockTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpChangedReadLockTest.java
index afc9d02..56fe4e4 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpChangedReadLockTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpChangedReadLockTest.java
@@ -21,11 +21,15 @@ import java.io.FileOutputStream;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.apache.camel.test.junit5.TestSupport.createDirectory;
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
*
*/
@@ -39,7 +43,7 @@ public class SftpChangedReadLockTest extends SftpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory("target/changed");
super.setUp();
@@ -63,7 +67,7 @@ public class SftpChangedReadLockTest extends SftpServerTestSupport {
String content = context.getTypeConverter().convertTo(String.class, new File("target/changed/out/slowfile.dat"));
String[] lines = content.split(LS);
- assertEquals("There should be 20 lines in the file", 20, lines.length);
+ assertEquals(20, lines.length, "There should be 20 lines in the file");
for (int i = 0; i < 20; i++) {
assertEquals("Line " + i, lines[i]);
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpChmodTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpChmodTest.java
index 5727026..0fefea6 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpChmodTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpChmodTest.java
@@ -19,7 +19,11 @@ package org.apache.camel.component.file.remote.sftp;
import java.io.File;
import org.apache.camel.Exchange;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnJre;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class SftpChmodTest extends SftpServerTestSupport {
@@ -29,15 +33,10 @@ public class SftpChmodTest extends SftpServerTestSupport {
return;
}
- // see https://issues.apache.org/jira/browse/SSHD-267
- if (isJava16()) {
- return;
- }
-
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin&chmod=777", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumeTemplateTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumeTemplateTest.java
index 17ff1cb..4251f75 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumeTemplateTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumeTemplateTest.java
@@ -17,7 +17,10 @@
package org.apache.camel.component.file.remote.sftp;
import org.apache.camel.Exchange;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpConsumeTemplateTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerAutoCreateTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerAutoCreateTest.java
index c01fa5b..99fd4d2 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerAutoCreateTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerAutoCreateTest.java
@@ -21,8 +21,11 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.component.file.GenericFileOperationFailedException;
import org.apache.camel.component.file.remote.SftpEndpoint;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class SftpConsumerAutoCreateTest extends SftpServerTestSupport {
@@ -31,7 +34,7 @@ public class SftpConsumerAutoCreateTest extends SftpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
index eb2a95d..57a5dc9 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
@@ -24,10 +24,12 @@ import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.commons.io.FileUtils;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+@Disabled
public class SftpConsumerDisconnectTest extends SftpServerTestSupport {
private static final String SAMPLE_FILE_NAME_1 = String.format("sample-1-%s.txt", SftpConsumerDisconnectTest.class.getSimpleName());
private static final String SAMPLE_FILE_NAME_2 = String.format("sample-2-%s.txt", SftpConsumerDisconnectTest.class.getSimpleName());
@@ -57,7 +59,7 @@ public class SftpConsumerDisconnectTest extends SftpServerTestSupport {
// File is deleted
File deletedFile = new File(FTP_ROOT_DIR + "/" + SAMPLE_FILE_NAME_1);
- assertFalse("File should have been deleted: " + deletedFile, deletedFile.exists());
+ assertFalse(deletedFile.exists(), "File should have been deleted: " + deletedFile);
}
@Test
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerProcessStrategyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerProcessStrategyTest.java
index 9bff904..08ea600 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerProcessStrategyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerProcessStrategyTest.java
@@ -22,7 +22,11 @@ import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.file.GenericFileEndpoint;
import org.apache.camel.component.file.GenericFileOperations;
import org.apache.camel.component.file.GenericFileProcessStrategy;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpConsumerProcessStrategyTest extends SftpServerTestSupport {
@@ -42,7 +46,7 @@ public class SftpConsumerProcessStrategyTest extends SftpServerTestSupport {
assertNotNull(out);
// Apache SSHD appends \u0000 at last byte in retrieved file
assertTrue(out.startsWith("Hello World"));
- assertEquals("CustomProcessStrategy should have been invoked 1 times", 1, myStrategy.getInvoked());
+ assertEquals(1, myStrategy.getInvoked(), "CustomProcessStrategy should have been invoked 1 times");
}
private static class MyStrategy implements GenericFileProcessStrategy {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerWithCharsetTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerWithCharsetTest.java
index cdc9ece..e720364 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerWithCharsetTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerWithCharsetTest.java
@@ -25,7 +25,10 @@ import org.apache.camel.component.file.FileComponent;
import org.apache.camel.component.file.remote.RemoteFile;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.commons.io.FileUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
public class SftpConsumerWithCharsetTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpECKeyFileConsumeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpECKeyFileConsumeTest.java
index 9137e8e..f14ea71 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpECKeyFileConsumeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpECKeyFileConsumeTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SftpECKeyFileConsumeTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpFromSedaDeleteFileTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpFromSedaDeleteFileTest.java
index 6b562dd..2ea8921 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpFromSedaDeleteFileTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpFromSedaDeleteFileTest.java
@@ -22,8 +22,10 @@ import java.io.IOException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.commons.io.FileUtils;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* Unit test to test delete option.
@@ -37,7 +39,7 @@ public class SftpFromSedaDeleteFileTest extends SftpServerTestSupport {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
createSampleFile();
@@ -55,7 +57,7 @@ public class SftpFromSedaDeleteFileTest extends SftpServerTestSupport {
// assert the file is deleted
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertFalse("The file should have been deleted", file.exists());
+ assertFalse(file.exists(), "The file should have been deleted");
}
private void createSampleFile() throws IOException {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyConsumeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyConsumeTest.java
index f847dce..ca8b60b 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyConsumeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyConsumeTest.java
@@ -27,7 +27,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.util.IOHelper;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SftpKeyConsumeTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyFileConsumeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyFileConsumeTest.java
index 966922c..8f9c589 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyFileConsumeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyFileConsumeTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SftpKeyFileConsumeTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyPairDSAConsumeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyPairDSAConsumeTest.java
index 819f39e..fa8b159 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyPairDSAConsumeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyPairDSAConsumeTest.java
@@ -23,14 +23,14 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class SftpKeyPairDSAConsumeTest extends SftpServerTestSupport {
private static KeyPair keyPair;
- @BeforeClass
+ @BeforeAll
public static void createKeys() throws Exception {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA");
keyGen.initialize(1024);
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyPairRSAConsumeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyPairRSAConsumeTest.java
index 3e93ae2..2ddfb96 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyPairRSAConsumeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyPairRSAConsumeTest.java
@@ -29,14 +29,14 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.util.IOHelper;
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class SftpKeyPairRSAConsumeTest extends SftpServerTestSupport {
private static KeyPair keyPair;
- @BeforeClass
+ @BeforeAll
public static void createKeys() throws Exception {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
keyGen.initialize(2048);
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyUriConsumeFromClasspathTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyUriConsumeFromClasspathTest.java
index ba80d73..d44406c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyUriConsumeFromClasspathTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyUriConsumeFromClasspathTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote.sftp;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SftpKeyUriConsumeFromClasspathTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyUriConsumeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyUriConsumeTest.java
index 309377c..183583b 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyUriConsumeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpKeyUriConsumeTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote.sftp;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SftpKeyUriConsumeTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProduceTempFileTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProduceTempFileTest.java
index a234d27..53bbaa2 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProduceTempFileTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProduceTempFileTest.java
@@ -20,7 +20,10 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.util.FileUtil;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpProduceTempFileTest extends SftpServerTestSupport {
@@ -34,7 +37,7 @@ public class SftpProduceTempFileTest extends SftpServerTestSupport {
+ "?username=admin&password=admin&tempFileName=temp-${file:name}", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
}
@@ -48,7 +51,7 @@ public class SftpProduceTempFileTest extends SftpServerTestSupport {
+ "/?username=admin&password=admin&tempFileName=temp-${file:name}", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File("hello.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
// delete file when we are done testing
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathNoStepwiseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathNoStepwiseTest.java
index bd6dc86..b7d507b 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathNoStepwiseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathNoStepwiseTest.java
@@ -20,7 +20,10 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpProducerFileWithPathNoStepwiseTest extends SftpServerTestSupport {
@@ -37,7 +40,7 @@ public class SftpProducerFileWithPathNoStepwiseTest extends SftpServerTestSuppor
template.sendBodyAndHeader(getFtpUrl(), "Hello World", Exchange.FILE_NAME, "hello/claus.txt");
File file = new File(FTP_ROOT_DIR + "/hello/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathTest.java
index 0742754..0adef5d 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathTest.java
@@ -20,7 +20,10 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.converter.IOConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpProducerFileWithPathTest extends SftpServerTestSupport {
@@ -37,7 +40,7 @@ public class SftpProducerFileWithPathTest extends SftpServerTestSupport {
template.sendBodyAndHeader(getFtpUrl(), "Hello World", Exchange.FILE_NAME, "hello/claus.txt");
File file = new File(FTP_ROOT_DIR + "/hello/claus.txt");
- assertTrue("The uploaded file should exists", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exists");
assertEquals("Hello World", IOConverter.toString(file, null));
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerMoveExistingTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerMoveExistingTest.java
index dabb245..18852ee 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerMoveExistingTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerMoveExistingTest.java
@@ -21,7 +21,14 @@ import java.io.File;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.Exchange;
import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertFileExists;
+import static org.apache.camel.test.junit5.TestSupport.assertFileNotExists;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
*
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerWithCharsetTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerWithCharsetTest.java
index 1080f37..27d7508 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerWithCharsetTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerWithCharsetTest.java
@@ -20,7 +20,10 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.commons.io.FileUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpProducerWithCharsetTest extends SftpServerTestSupport {
@@ -37,7 +40,7 @@ public class SftpProducerWithCharsetTest extends SftpServerTestSupport {
template.sendBodyAndHeader(getSftpUri(), SAMPLE_FILE_PAYLOAD, Exchange.FILE_NAME, SAMPLE_FILE_NAME);
File file = new File(FTP_ROOT_DIR + "/" + SAMPLE_FILE_NAME);
- assertTrue("The uploaded file should exist", file.exists());
+ assertTrue(file.exists(), "The uploaded file should exist");
String storedPayload = FileUtils.readFileToString(file, SAMPLE_FILE_CHARSET);
assertEquals(SAMPLE_FILE_PAYLOAD, storedPayload);
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
index aa79c8a..0aa44c7 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
@@ -34,12 +34,18 @@ import org.apache.sshd.server.SshServer;
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
import org.apache.sshd.server.scp.ScpCommandFactory;
import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.apache.camel.test.junit5.TestSupport.createDirectory;
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
public class SftpServerTestSupport extends BaseServerTestSupport {
protected static final String FTP_ROOT_DIR = "target/res/home";
+ private static final Logger LOG = LoggerFactory.getLogger(SftpServerTestSupport.class);
private static final String KNOWN_HOSTS = "[localhost]:%d ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDdfIWeSV4o68dRrKS"
+ "zFd/Bk51E65UTmmSrmW0O1ohtzi6HzsDPjXgCtlTt3FqTcfFfI92IlTr4JWqC9UK1QT1ZTeng0MkPQmv68hDANHbt5CpETZHjW5q4OOgWhV"
+ "vj5IyOC2NZHtKlJBkdsMAa15ouOOJLzBvAvbqOR/yUROsEiQ==";
@@ -51,7 +57,7 @@ public class SftpServerTestSupport extends BaseServerTestSupport {
private String simulatedUserSsh = "./target/user-home/.ssh";
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
deleteDirectory(FTP_ROOT_DIR);
@@ -92,7 +98,7 @@ public class SftpServerTestSupport extends BaseServerTestSupport {
String name = System.getProperty("os.name");
String message = nsae.getMessage();
- log.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
+ LOG.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
} else {
// some other error then throw it so the test can fail
throw e;
@@ -105,7 +111,7 @@ public class SftpServerTestSupport extends BaseServerTestSupport {
}
@Override
- @After
+ @AfterEach
public void tearDown() throws Exception {
if (oldUserHome != null) {
System.setProperty("user.home", oldUserHome);
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetCipherTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetCipherTest.java
index b7cc15f..f676fce 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetCipherTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetCipherTest.java
@@ -20,7 +20,10 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.component.file.remote.SftpEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpSetCipherTest extends SftpServerTestSupport {
@@ -36,7 +39,7 @@ public class SftpSetCipherTest extends SftpServerTestSupport {
// test setting the cipher doesn't interfere with message payload
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
// did we actually set the correct cipher?
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetOperationsTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetOperationsTest.java
index 468e258..b924ca6 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetOperationsTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetOperationsTest.java
@@ -20,7 +20,10 @@ import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.component.file.remote.SftpEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpSetOperationsTest extends SftpServerTestSupport {
@@ -38,7 +41,7 @@ public class SftpSetOperationsTest extends SftpServerTestSupport {
// test setting the cipher doesn't interfere with message payload
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
// did we actually set the preferedAuthentifications
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeRecursiveTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeRecursiveTest.java
index 500ed16..c220cad 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeRecursiveTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeRecursiveTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote.sftp;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SftpSimpleConsumeRecursiveTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingPartialReadTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingPartialReadTest.java
index d8c4589..11b11c2 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingPartialReadTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingPartialReadTest.java
@@ -24,7 +24,10 @@ import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests that a file move can occur on the server even if the remote stream was only partially read.
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingTest.java
index 0321ed8..d699756 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingTest.java
@@ -22,7 +22,9 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpSimpleConsumeStreamingTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingWithMultipleFilesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingWithMultipleFilesTest.java
index 4fd7d59..c51f23f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingWithMultipleFilesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingWithMultipleFilesTest.java
@@ -22,7 +22,9 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpSimpleConsumeStreamingWithMultipleFilesTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeTest.java
index 8933410..dbe094c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote.sftp;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SftpSimpleConsumeTest extends SftpServerTestSupport {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeThroughProxyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeThroughProxyTest.java
index dd425e3..846e9d4 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeThroughProxyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeThroughProxyTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.AvailablePortFinder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.littleshoot.proxy.DefaultHttpProxyServer;
import org.littleshoot.proxy.HttpProxyServer;
import org.littleshoot.proxy.ProxyAuthorizationHandler;
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleIPV6ConsumeTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleIPV6ConsumeTest.java
index e46b6e0..0856c69 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleIPV6ConsumeTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleIPV6ConsumeTest.java
@@ -19,10 +19,10 @@ package org.apache.camel.component.file.remote.sftp;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore
+@Disabled
public class SftpSimpleIPV6ConsumeTest extends SftpServerTestSupport {
@Test
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceDisconnectTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceDisconnectTest.java
index c18496a..ebf539c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceDisconnectTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceDisconnectTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote.sftp;
import java.io.File;
import org.apache.camel.Exchange;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpSimpleProduceDisconnectTest extends SftpServerTestSupport {
@@ -32,7 +35,7 @@ public class SftpSimpleProduceDisconnectTest extends SftpServerTestSupport {
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
// restart the SFTP server now
@@ -42,7 +45,7 @@ public class SftpSimpleProduceDisconnectTest extends SftpServerTestSupport {
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin", "Hello World", Exchange.FILE_NAME, "hello1.txt");
file = new File(FTP_ROOT_DIR + "/hello1.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceNotStepwiseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceNotStepwiseTest.java
index aea7cf7..f14c6a2 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceNotStepwiseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceNotStepwiseTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote.sftp;
import java.io.File;
import org.apache.camel.Exchange;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpSimpleProduceNotStepwiseTest extends SftpServerTestSupport {
@@ -32,7 +35,7 @@ public class SftpSimpleProduceNotStepwiseTest extends SftpServerTestSupport {
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin&stepwise=false", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
}
@@ -45,7 +48,7 @@ public class SftpSimpleProduceNotStepwiseTest extends SftpServerTestSupport {
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub?username=admin&password=admin&stepwise=false", "Bye World", Exchange.FILE_NAME, "bye.txt");
File file = new File(FTP_ROOT_DIR + "/mysub/bye.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, file));
}
@@ -59,7 +62,7 @@ public class SftpSimpleProduceNotStepwiseTest extends SftpServerTestSupport {
"Farewell World", Exchange.FILE_NAME, "farewell.txt");
File file = new File(FTP_ROOT_DIR + "/mysub/myother/farewell.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Farewell World", context.getTypeConverter().convertTo(String.class, file));
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java
index 2eb2f8e..e8ce250 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.file.remote.sftp;
import java.io.File;
import org.apache.camel.Exchange;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SftpSimpleProduceTest extends SftpServerTestSupport {
@@ -32,7 +35,7 @@ public class SftpSimpleProduceTest extends SftpServerTestSupport {
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
}
@@ -45,7 +48,7 @@ public class SftpSimpleProduceTest extends SftpServerTestSupport {
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub?username=admin&password=admin", "Bye World", Exchange.FILE_NAME, "bye.txt");
File file = new File(FTP_ROOT_DIR + "/mysub/bye.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, file));
}
@@ -58,7 +61,7 @@ public class SftpSimpleProduceTest extends SftpServerTestSupport {
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub/myother?username=admin&password=admin", "Farewell World", Exchange.FILE_NAME, "farewell.txt");
File file = new File(FTP_ROOT_DIR + "/mysub/myother/farewell.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Farewell World", context.getTypeConverter().convertTo(String.class, file));
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceThroughProxyTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceThroughProxyTest.java
index a269be9..b6498d3 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceThroughProxyTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceThroughProxyTest.java
@@ -22,11 +22,14 @@ import com.jcraft.jsch.ProxyHTTP;
import org.apache.camel.BindToRegistry;
import org.apache.camel.Exchange;
import org.apache.camel.test.AvailablePortFinder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.littleshoot.proxy.DefaultHttpProxyServer;
import org.littleshoot.proxy.HttpProxyServer;
import org.littleshoot.proxy.ProxyAuthorizationHandler;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
public class SftpSimpleProduceThroughProxyTest extends SftpServerTestSupport {
private final int proxyPort = AvailablePortFinder.getNextAvailable();
@@ -50,7 +53,7 @@ public class SftpSimpleProduceThroughProxyTest extends SftpServerTestSupport {
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin&proxy=#proxy", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/hello.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
proxyServer.stop();
@@ -75,7 +78,7 @@ public class SftpSimpleProduceThroughProxyTest extends SftpServerTestSupport {
template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub?username=admin&password=admin&proxy=#proxy", "Bye World", Exchange.FILE_NAME, "bye.txt");
File file = new File(FTP_ROOT_DIR + "/mysub/bye.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, file));
proxyServer.stop();
@@ -101,7 +104,7 @@ public class SftpSimpleProduceThroughProxyTest extends SftpServerTestSupport {
"farewell.txt");
File file = new File(FTP_ROOT_DIR + "/mysub/myother/farewell.txt");
- assertTrue("File should exist: " + file, file.exists());
+ assertTrue(file.exists(), "File should exist: " + file);
assertEquals("Farewell World", context.getTypeConverter().convertTo(String.class, file));
proxyServer.stop();
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpUseListFalseTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpUseListFalseTest.java
index b7a5b25..ef34037 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpUseListFalseTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpUseListFalseTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.file.remote.sftp;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SftpUseListFalseTest extends SftpServerTestSupport {
diff --git a/components/camel-test-junit5/src/main/docs/test-junit5.adoc b/components/camel-test-junit5/src/main/docs/test-junit5.adoc
index 41fc9ab..99f3b5c 100644
--- a/components/camel-test-junit5/src/main/docs/test-junit5.adoc
+++ b/components/camel-test-junit5/src/main/docs/test-junit5.adoc
@@ -65,6 +65,8 @@ Tips: It's possible to run JUnit4 & JUnit5 based camel tests side by side includ
* `TestSupport` static methods should be imported where needed, for instance `import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf`
* Usage of the field `CamelTestSupport.log` should be replaced by another logger, for instance `org.slf4j.LoggerFactory.getLogger(MyCamelTest.class);`
* Usage of the method `CamelTestSupport.createRegistry` should be replaced by `CamelTestSupport.createCamelRegistry()`
+* Usage of methods `CamelTestSupport.*Directory` should be replaced by `TestSupport.*Directory`
+* Usage of methods `CamelTestSupport.assert*` should be replaced by `TestSupport.assert*`
* Overrides of `isCreateCamelContextPerClass()` returning `false` should be removed
* Overrides of `isCreateCamelContextPerClass()` returning `true` should be replaced by `@TestInstance(Lifecycle.PER_CLASS)`