diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/RemoteFileTestSupport.java b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/RemoteFileTestSupport.java index c941c58c74..758967ddd1 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/RemoteFileTestSupport.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/RemoteFileTestSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,15 +19,14 @@ package org.springframework.integration.file.remote; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.nio.file.Path; import java.util.Arrays; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.rules.TemporaryFolder; -import org.junit.rules.TestName; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.io.TempDir; /** * Abstract base class for tests requiring remote file servers, e.g. (S)FTP. @@ -42,14 +41,12 @@ public abstract class RemoteFileTestSupport { protected static int port; - @ClassRule - public static final TemporaryFolder remoteTemporaryFolder = new TemporaryFolder(); + @TempDir + public static Path temporaryFolder; - @ClassRule - public static final TemporaryFolder localTemporaryFolder = new TemporaryFolder(); + protected static File remoteTemporaryFolder; - @Rule - public final TestName testName = new TestName(); + protected static File localTemporaryFolder; protected volatile File sourceRemoteDirectory; @@ -89,42 +86,53 @@ public abstract class RemoteFileTestSupport { *
* $ tree remoteSource/ * remoteSource/ - * ??? remoteSource1.txt - contains 'source1' - * ??? remoteSource2.txt - contains 'source2' - * ??? subRemoteSource - * ??? subRemoteSource1.txt - contains 'subSource1' + * |-- remoteSource1.txt - contains 'source1' + * |-- remoteSource2.txt - contains 'source2' + * |-- subRemoteSource + * |-- subRemoteSource1.txt - contains 'subSource1' * remoteTarget/ * $ tree localSource/ * localSource/ - * ??? localSource1.txt - contains 'local1' - * ??? localSource2.txt - contains 'local2' - * ??? subLocalSource - * ??? subLocalSource1.txt - contains 'subLocal1' + * |-- localSource1.txt - contains 'local1' + * |-- localSource2.txt - contains 'local2' + * |-- subLocalSource + * |-- subLocalSource1.txt - contains 'subLocal1' * localTarget/ ** - * The intent is tests retrieve from remoteSource and verify arrival in localTarget or send from localSource and verify - * arrival in remoteTarget. + * The intent is tests retrieve from remoteSource and verify arrival in localTarget or + * send from localSource and verify arrival in remoteTarget. *
- * Subclasses can change 'remote' in these names by overriding {@link #prefix()} or override this method completely to - * create a different structure. + * Subclasses can change 'remote' in these names by overriding {@link #prefix()} or + * override this method completely to create a different structure. *
- * While a single server exists for all tests, the directory structure is rebuilt for each test. + * While a single server exists for all tests, the directory structure is rebuilt for + * each test. * @throws IOException IO Exception. */ - @Before - public void setupFolders() throws IOException { + @BeforeEach + public void setupFolders(TestInfo info) throws IOException { String prefix = prefix(); - recursiveDelete(new File(remoteTemporaryFolder.getRoot(), prefix + "Source")); - this.sourceRemoteDirectory = remoteTemporaryFolder.newFolder(prefix + "Source"); - recursiveDelete(new File(remoteTemporaryFolder.getRoot(), prefix + "Target")); - this.targetRemoteDirectory = remoteTemporaryFolder.newFolder(prefix + "Target"); - recursiveDelete(new File(localTemporaryFolder.getRoot(), "localSource")); - this.sourceLocalDirectory = localTemporaryFolder.newFolder("localSource"); - recursiveDelete(new File(localTemporaryFolder.getRoot(), "localTarget")); - this.targetLocalDirectory = localTemporaryFolder.newFolder("localTarget"); + getRemoteTempFolder(); + getLocalTempFolder(); + File file = new File(remoteTemporaryFolder, prefix + "Source"); + recursiveDelete(file, info); + this.sourceRemoteDirectory = new File(file.getAbsolutePath()); + this.sourceRemoteDirectory.mkdirs(); + file = new File(remoteTemporaryFolder, prefix + "Target"); + recursiveDelete(file, info); + this.targetRemoteDirectory = new File(file.getAbsolutePath()); + this.targetRemoteDirectory.mkdirs(); + file = new File(localTemporaryFolder, "localSource"); + recursiveDelete(file, info); + this.sourceLocalDirectory = new File(file.getAbsolutePath()); + this.sourceLocalDirectory.mkdirs(); + file = new File(localTemporaryFolder, "localTarget"); + recursiveDelete(file, info); + this.targetLocalDirectory = new File(file.getAbsolutePath()); + this.targetLocalDirectory.mkdirs(); - File file = new File(this.sourceRemoteDirectory, " " + prefix + "Source1.txt"); + file = new File(this.sourceRemoteDirectory, " " + prefix + "Source1.txt"); file.createNewFile(); FileOutputStream fos = new FileOutputStream(file); fos.write("source1".getBytes()); @@ -161,31 +169,47 @@ public abstract class RemoteFileTestSupport { fos.close(); } + protected static File getRemoteTempFolder() { + if (remoteTemporaryFolder == null) { + remoteTemporaryFolder = new File(temporaryFolder.toFile().getAbsolutePath() + File.separator + "source"); + remoteTemporaryFolder.mkdirs(); + } + return remoteTemporaryFolder; + } + + protected static File getLocalTempFolder() { + if (localTemporaryFolder == null) { + localTemporaryFolder = new File(temporaryFolder.toFile().getAbsolutePath() + File.separator + "local"); + localTemporaryFolder.mkdirs(); + } + return localTemporaryFolder; + } + private String camelCase(String prefix) { char[] chars = prefix.toCharArray(); chars[0] &= 0xdf; return new String(chars); } - public void recursiveDelete(File file) { + public void recursiveDelete(File file, TestInfo info) { if (file != null && file.exists()) { File[] files = file.listFiles(); if (files != null) { for (File fyle : files) { - logger.info("Deleting: " + fyle + " in " + testName.getMethodName()); + logger.info("Deleting: " + fyle + " in " + info.getDisplayName()); if (fyle.isDirectory()) { - recursiveDelete(fyle); + recursiveDelete(fyle, info); } else { if (!fyle.delete()) { - logger.error("Couldn't delete: " + fyle + " in " + testName.getMethodName()); + logger.error("Couldn't delete: " + fyle + " in " + info.getDisplayName()); } } } } - logger.info("Deleting: " + file + " in " + testName.getMethodName()); + logger.info("Deleting: " + file + " in " + info.getDisplayName()); if (!file.delete()) { - logger.error("Couldn't delete: " + file + " in " + testName.getMethodName()); + logger.error("Couldn't delete: " + file + " in " + info.getDisplayName()); if (file.isDirectory()) { logger.error("Contents: " + Arrays.toString(file.listFiles())); } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpMessageHistoryTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpMessageHistoryTests.java index e55e1f90bd..909b0125f1 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpMessageHistoryTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpMessageHistoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package org.springframework.integration.ftp; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.endpoint.SourcePollingChannelAdapter; @@ -30,6 +30,7 @@ import org.springframework.integration.endpoint.SourcePollingChannelAdapter; * */ public class FtpMessageHistoryTests { + @Test public void testMessageHistory() throws Exception { ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("ftp-message-history-context.xml", @@ -39,4 +40,5 @@ public class FtpMessageHistoryTests { assertThat(adapter.getComponentType()).isEqualTo("ftp:inbound-channel-adapter"); ac.close(); } + } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests.java index 4142e77bc4..ea44a927db 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,9 +22,9 @@ import static org.assertj.core.api.Assertions.fail; import java.io.File; import java.io.FileNotFoundException; -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.springframework.beans.BeansException; import org.springframework.beans.factory.BeanCreationException; @@ -38,7 +38,8 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; * */ public class FtpParserInboundTests { - @Before + + @BeforeEach public void prepare() { new File("target/foo").delete(); } @@ -67,7 +68,7 @@ public class FtpParserInboundTests { } } - @After + @AfterEach public void cleanUp() throws Exception { new File("target/foo").delete(); } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpTestSupport.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpTestSupport.java index 97aaeabc9d..022a26a306 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpTestSupport.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpTestSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,8 +35,8 @@ import org.apache.ftpserver.usermanager.impl.BaseUser; import org.apache.ftpserver.usermanager.impl.ConcurrentLoginPermission; import org.apache.ftpserver.usermanager.impl.TransferRatePermission; import org.apache.ftpserver.usermanager.impl.WritePermission; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.springframework.integration.file.remote.RemoteFileTestSupport; import org.springframework.integration.file.remote.session.CachingSessionFactory; @@ -58,10 +58,10 @@ public class FtpTestSupport extends RemoteFileTestSupport { private static volatile FtpServer server; - @BeforeClass + @BeforeAll public static void createServer() throws Exception { FtpServerFactory serverFactory = new FtpServerFactory(); - serverFactory.setUserManager(new TestUserManager(remoteTemporaryFolder.getRoot().getAbsolutePath())); + serverFactory.setUserManager(new TestUserManager(getRemoteTempFolder().getAbsolutePath())); ListenerFactory factory = new ListenerFactory(); factory.setPort(0); @@ -78,7 +78,7 @@ public class FtpTestSupport extends RemoteFileTestSupport { } - @AfterClass + @AfterAll public static void stopServer() throws Exception { server.stop(); } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java index 93e8b793da..66b23009f9 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,8 +28,7 @@ import java.util.Set; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.atomic.AtomicReference; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.annotation.Autowired; @@ -52,8 +51,7 @@ import org.springframework.integration.metadata.MetadataStore; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.MessageChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.ReflectionUtils; /** @@ -64,8 +62,7 @@ import org.springframework.util.ReflectionUtils; * @author Artem Bilan * @author Venil Noronha */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig @DirtiesContext public class FtpInboundChannelAdapterParserTests { diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java index 30ccf92cb7..48593d022b 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.File; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.messaging.MessageChannel; @@ -36,7 +36,7 @@ public class FtpInboundOutboundSanitySample { @Test - @Ignore + @Disabled public void testFtpInboundChannelAdapter() throws Exception { File fileA = new File("local-test-dir/a.test"); if (fileA.exists()) { @@ -66,7 +66,7 @@ public class FtpInboundOutboundSanitySample { } @Test - @Ignore + @Disabled public void testFtpOutboundChannelAdapter() throws Exception { ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("FtpOutboundChannelAdapterSample-context.xml", this.getClass()); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests.java index 0b3c469223..f02d91c56b 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundGatewayParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,7 @@ import java.lang.reflect.Method; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.expression.Expression; @@ -45,8 +44,7 @@ import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.ReflectionUtils; /** @@ -57,8 +55,7 @@ import org.springframework.util.ReflectionUtils; * @since 2.1 * */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig @DirtiesContext public class FtpOutboundGatewayParserTests { diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpStreamingInboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpStreamingInboundChannelAdapterParserTests.java index 52617501c8..16a55b3382 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpStreamingInboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpStreamingInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,7 @@ import static org.mockito.Mockito.when; import java.util.Iterator; import java.util.Set; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.annotation.Autowired; @@ -40,15 +39,13 @@ import org.springframework.integration.ftp.session.FtpSession; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.MessageChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Gary Russell * @author Artem Bilan */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig @DirtiesContext public class FtpStreamingInboundChannelAdapterParserTests { diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests.java index 4ee9faf98c..fb68923c93 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.ftp.config; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.endpoint.SourcePollingChannelAdapter; @@ -28,8 +27,7 @@ import org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizingMe import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.MessageChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Oleg Zhurakousky @@ -37,8 +35,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @author Gary Russell * @author Artem Bilan */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig @DirtiesContext public class FtpsInboundChannelAdapterParserTests { diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java index 3fbfc067a7..9f1c80c6bc 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java @@ -31,8 +31,7 @@ import java.util.Map; import java.util.regex.Matcher; import org.apache.commons.net.ftp.FTPFile; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -64,7 +63,7 @@ import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.FileCopyUtils; /** @@ -74,7 +73,7 @@ import org.springframework.util.FileCopyUtils; * * @since 5.0 */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class FtpTests extends FtpTestSupport { diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/filters/FtpFileListFilterTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/filters/FtpFileListFilterTests.java index f8f45e15c7..edd14aca02 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/filters/FtpFileListFilterTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/filters/FtpFileListFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 the original author or authors. + * Copyright 2017-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,7 @@ import java.io.File; import java.util.List; import org.apache.commons.net.ftp.FTPFile; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -32,14 +31,14 @@ import org.springframework.integration.file.remote.session.SessionFactory; import org.springframework.integration.ftp.FtpTestSupport; import org.springframework.integration.ftp.session.FtpRemoteFileTemplate; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Gary Russell * @since 5.0 * */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class FtpFileListFilterTests extends FtpTestSupport { diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/filters/FtpPersistentAcceptOnceFileListFilterTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/filters/FtpPersistentAcceptOnceFileListFilterTests.java index 7bc2af551e..423488e930 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/filters/FtpPersistentAcceptOnceFileListFilterTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/filters/FtpPersistentAcceptOnceFileListFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import java.util.Calendar; import java.util.List; import org.apache.commons.net.ftp.FTPFile; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.integration.metadata.SimpleMetadataStore; diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTests.java index 3ae08eb510..cf953c07d9 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,9 +34,9 @@ import java.util.Map; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; -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.mockito.Mockito; import org.springframework.beans.factory.BeanFactory; @@ -71,8 +71,8 @@ public class FtpInboundRemoteFileSystemSynchronizerTests { private static FTPClient ftpClient = mock(FTPClient.class); - @Before - @After + @BeforeEach + @AfterEach public void cleanup() { recursiveDelete(new File("test")); } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpMessageSourceTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpMessageSourceTests.java index 9c1786bf08..c6f2f0423b 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpMessageSourceTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.ftp.inbound; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -28,14 +27,14 @@ import org.springframework.integration.file.FileHeaders; import org.springframework.integration.ftp.FtpTestSupport; import org.springframework.messaging.Message; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Gary Russell * @since 5.0.7 * */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class FtpMessageSourceTests extends FtpTestSupport { diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpStreamingMessageSourceTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpStreamingMessageSourceTests.java index 75d6b72efd..2932770233 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpStreamingMessageSourceTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpStreamingMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,8 +26,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.apache.commons.net.ftp.FTPFile; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -55,7 +54,7 @@ import org.springframework.integration.transformer.StreamTransformer; import org.springframework.messaging.Message; import org.springframework.scheduling.support.PeriodicTrigger; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Gary Russell @@ -64,7 +63,7 @@ import org.springframework.test.context.junit4.SpringRunner; * @since 4.3 * */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class FtpStreamingMessageSourceTests extends FtpTestSupport { diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java index 6a523c2aa1..57a321d637 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,10 +28,11 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.apache.commons.net.ftp.FTPFile; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; @@ -67,9 +68,9 @@ import org.springframework.integration.metadata.SimpleMetadataStore; */ public class RotatingServersTests extends FtpTestSupport { - private static String tmpDir = localTemporaryFolder.getRoot().getAbsolutePath() + File.separator + "multiSF"; + private static String tmpDir = getLocalTempFolder().getAbsolutePath() + File.separator + "multiSF"; - @BeforeClass + @BeforeAll public static void setup() { FtpRemoteFileTemplate rft = new FtpRemoteFileTemplate(sessionFactory()); rft.execute(s -> { @@ -87,10 +88,10 @@ public class RotatingServersTests extends FtpTestSupport { }); } - @Before - @After - public void clean() { - recursiveDelete(new File(tmpDir)); + @BeforeEach + @AfterEach + public void clean(TestInfo info) { + recursiveDelete(new File(tmpDir), info); } @Test diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/BigMGetTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/BigMGetTests.java index b3605f6358..6be1fea02c 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/BigMGetTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/BigMGetTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,24 +18,23 @@ package org.springframework.integration.ftp.outbound; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Gary Russell * @since 2.2 * */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig +@DirtiesContext public class BigMGetTests extends org.springframework.integration.file.BigMGetTests { @Test - @Ignore // needs directories and server (FTP and SFTP) + @Disabled("needs directories and server (FTP)") // TODO use FtpTestSupport public void doTest() throws Exception { assertThat(this.mgetManyFiles().getPayload().size()).isEqualTo(FILES); } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpOutboundTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpOutboundTests.java index b64cac5f14..5e996e0dcb 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpOutboundTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpOutboundTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,8 +39,8 @@ import java.util.concurrent.atomic.AtomicReference; import org.apache.commons.logging.Log; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.DirectFieldAccessor; @@ -72,7 +72,7 @@ public class FtpOutboundTests { private TestFtpSessionFactory sessionFactory; - @Before + @BeforeEach public void prepare() { ftpClient = mock(FTPClient.class); sessionFactory = new TestFtpSessionFactory(); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests.java index 69ab221594..2ad72ac712 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 the original author or authors. + * Copyright 2013-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,9 +45,8 @@ import java.util.regex.Matcher; import org.apache.commons.io.FileUtils; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; -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.mockito.Mockito; import org.springframework.beans.DirectFieldAccessor; @@ -90,8 +89,7 @@ import org.springframework.messaging.support.GenericMessage; import org.springframework.stereotype.Component; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.FileCopyUtils; /** @@ -100,8 +98,7 @@ import org.springframework.util.FileCopyUtils; * * @since 3.0 */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class FtpServerOutboundTests extends FtpTestSupport { @@ -172,7 +169,7 @@ public class FtpServerOutboundTests extends FtpTestSupport { @Autowired private Config config; - @Before + @BeforeEach public void setup() { this.config.targetLocalDirectoryName = getTargetLocalDirectoryName(); } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/FtpRemoteFileTemplateTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/FtpRemoteFileTemplateTests.java index 74755cad62..d30649a718 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/FtpRemoteFileTemplateTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/FtpRemoteFileTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,8 +28,7 @@ import java.util.UUID; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -47,7 +46,7 @@ import org.springframework.integration.util.SimplePool; import org.springframework.messaging.MessagingException; import org.springframework.messaging.support.GenericMessage; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Gary Russell @@ -56,7 +55,7 @@ import org.springframework.test.context.junit4.SpringRunner; * @since 4.1 * */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class FtpRemoteFileTemplateTests extends FtpTestSupport { diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/SftpTestSupport.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/SftpTestSupport.java index 902a2cfa03..f596f69145 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/SftpTestSupport.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/SftpTestSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory; import org.apache.sshd.server.SshServer; import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.springframework.integration.file.remote.RemoteFileTestSupport; import org.springframework.integration.file.remote.session.CachingSessionFactory; @@ -59,7 +59,7 @@ public class SftpTestSupport extends RemoteFileTestSupport { return "sftp"; } - @BeforeClass + @BeforeAll public static void createServer() throws Exception { server = SshServer.setUpDefaultServer(); server.setPasswordAuthenticator((username, password, session) -> true); @@ -71,7 +71,7 @@ public class SftpTestSupport extends RemoteFileTestSupport { }); sftpFactory.addSftpEventListener(eventListener); server.setSubsystemFactories(Collections.singletonList(sftpFactory)); - server.setFileSystemFactory(new VirtualFileSystemFactory(remoteTemporaryFolder.getRoot().toPath())); + server.setFileSystemFactory(new VirtualFileSystemFactory(getRemoteTempFolder().toPath())); server.start(); port = server.getPort(); } @@ -90,7 +90,7 @@ public class SftpTestSupport extends RemoteFileTestSupport { return eventListener; } - @AfterClass + @AfterAll public static void stopServer() throws Exception { server.stop(); File hostKey = new File("hostkey.ser"); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserCachingTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserCachingTests.java index ba4d9266f4..f265d8be66 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserCachingTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserCachingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,23 +20,22 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Properties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.file.remote.session.CachingSessionFactory; import org.springframework.integration.sftp.session.DefaultSftpSessionFactory; import org.springframework.integration.test.util.TestUtils; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Mark Fisher * @author Gunnar Hillert * @author Gary Russell */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig +@DirtiesContext public class InboundChannelAdapterParserCachingTests { @Autowired private Object cachingAdapter; diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java index 41495f6c26..424e570ee0 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,9 @@ import java.util.Collection; import java.util.Comparator; import java.util.concurrent.PriorityBlockingQueue; -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.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanDefinitionStoreException; @@ -50,7 +50,7 @@ import org.springframework.messaging.PollableChannel; */ public class InboundChannelAdapterParserTests { - @Before + @BeforeEach public void prepare() { new File("foo").delete(); } @@ -152,7 +152,7 @@ public class InboundChannelAdapterParserTests { getClass())); } - @After + @AfterEach public void cleanUp() { new File("foo").delete(); } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserCachingTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserCachingTests.java index e5edbe75a8..cd49789e06 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserCachingTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserCachingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,23 +18,22 @@ package org.springframework.integration.sftp.config; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.file.remote.session.CachingSessionFactory; import org.springframework.integration.sftp.session.DefaultSftpSessionFactory; import org.springframework.integration.test.util.TestUtils; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Mark Fisher * @author Gunnar Hillert * @author Gary Russell */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig +@DirtiesContext public class OutboundChannelAdapterParserCachingTests { @Autowired private Object cachingAdapter; diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java index bd70675811..e17ecd83e4 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.File; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.messaging.MessageChannel; @@ -36,7 +36,7 @@ public class SftpInboundOutboundSanitySample { @Test - @Ignore + @Disabled public void testInbound() throws Exception { File fileA = new File("local-test-dir/a.test"); if (fileA.exists()) { @@ -66,7 +66,7 @@ public class SftpInboundOutboundSanitySample { } @Test - @Ignore + @Disabled public void testOutbound() throws Exception { ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("SftpOutboundTransferSample-ignored.xml", this.getClass()); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpMessageHistoryTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpMessageHistoryTests.java index f3c6129b89..340d4a14be 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpMessageHistoryTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpMessageHistoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package org.springframework.integration.sftp.config; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.endpoint.SourcePollingChannelAdapter; diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests.java index 66ea34182a..e4a3ab327b 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundGatewayParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,7 @@ import java.lang.reflect.Method; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.expression.Expression; @@ -39,8 +38,8 @@ import org.springframework.integration.sftp.gateway.SftpOutboundGateway; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.ReflectionUtils; /** @@ -51,8 +50,8 @@ import org.springframework.util.ReflectionUtils; * @since 2.1 * */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig +@DirtiesContext public class SftpOutboundGatewayParserTests { @Autowired diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java index 9abfc0bbfb..2f1b78d3e8 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package org.springframework.integration.sftp.config; import java.io.File; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.support.MessageBuilder; @@ -33,7 +33,7 @@ import org.springframework.messaging.MessageChannel; public class SftpOutboundTransferSample { @Test - @Ignore + @Disabled public void testOutbound() throws Exception { ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("SftpOutboundTransferSample-ignored.xml", SftpOutboundTransferSample.class); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpStreamingInboundChannelAdapterParserTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpStreamingInboundChannelAdapterParserTests.java index 0e8db330f2..8e776dc44e 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpStreamingInboundChannelAdapterParserTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpStreamingInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,7 @@ import static org.mockito.Mockito.when; import java.util.Iterator; import java.util.Set; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.annotation.Autowired; @@ -41,15 +40,13 @@ import org.springframework.integration.sftp.session.SftpSession; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.MessageChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Gary Russell * @author Artem Bilan */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig @DirtiesContext public class SftpStreamingInboundChannelAdapterParserTests { diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java index 23a5083c6c..ba26e4034b 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ import java.io.InputStream; import java.util.List; import java.util.regex.Matcher; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -48,7 +48,7 @@ import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import com.jcraft.jsch.ChannelSftp; @@ -60,7 +60,7 @@ import com.jcraft.jsch.ChannelSftp; * @since 5.0 * */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class SftpTests extends SftpTestSupport { @@ -150,7 +150,7 @@ public class SftpTests extends SftpTestSupport { @Test - @Ignore("Doesn't work as expected on Windows") + @DisabledOnOs(OS.WINDOWS) public void testSftpOutboundFlowWithChmod() { IntegrationFlow flow = f -> f.handle(Sftp.outboundAdapter(sessionFactory(), FileExistsMode.FAIL) .useTemporaryFileName(false) diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/filters/SftpFileListFilterTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/filters/SftpFileListFilterTests.java index c1d4be6131..2c030b34dd 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/filters/SftpFileListFilterTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/filters/SftpFileListFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 the original author or authors. + * Copyright 2017-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.File; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -31,7 +30,7 @@ import org.springframework.integration.file.remote.session.SessionFactory; import org.springframework.integration.sftp.SftpTestSupport; import org.springframework.integration.sftp.session.SftpRemoteFileTemplate; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import com.jcraft.jsch.ChannelSftp.LsEntry; @@ -40,7 +39,7 @@ import com.jcraft.jsch.ChannelSftp.LsEntry; * @since 5.0 * */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class SftpFileListFilterTests extends SftpTestSupport { diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/filters/SftpPersistentAcceptOnceFileListFilterTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/filters/SftpPersistentAcceptOnceFileListFilterTests.java index ab7e282c3f..7354c382fc 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/filters/SftpPersistentAcceptOnceFileListFilterTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/filters/SftpPersistentAcceptOnceFileListFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import java.lang.reflect.Constructor; import java.util.Arrays; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.integration.metadata.SimpleMetadataStore; diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/RollbackLocalFilterTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/RollbackLocalFilterTests.java index 7ac3bae8dd..63832b4bbc 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/RollbackLocalFilterTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/RollbackLocalFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,18 +23,16 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.integration.file.remote.session.SessionFactory; import org.springframework.integration.sftp.SftpTestSupport; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import com.jcraft.jsch.ChannelSftp.LsEntry; @@ -44,13 +42,12 @@ import com.jcraft.jsch.ChannelSftp.LsEntry; * @since 4.1.7 * */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig @DirtiesContext public class RollbackLocalFilterTests extends SftpTestSupport { - @BeforeClass - @AfterClass + @BeforeAll + @AfterAll public static void clean() { new File("local-test-dir/rollback/sftpSource2.txt").delete(); } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java index 1a73fbdeb6..7b9166a4bb 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +31,9 @@ import java.util.Collection; import java.util.List; import java.util.Vector; -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.springframework.beans.factory.BeanFactory; import org.springframework.integration.file.FileHeaders; @@ -67,8 +67,8 @@ public class SftpInboundRemoteFileSystemSynchronizerTests { private static com.jcraft.jsch.Session jschSession = mock(com.jcraft.jsch.Session.class); - @Before - @After + @BeforeEach + @AfterEach public void cleanup() { File file = new File("test"); if (file.exists()) { diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpMessageSourceTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpMessageSourceTests.java index ef9b24a50f..3aa0c1eab4 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpMessageSourceTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.sftp.inbound; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -28,7 +27,7 @@ import org.springframework.integration.file.FileHeaders; import org.springframework.integration.sftp.SftpTestSupport; import org.springframework.messaging.Message; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Gary Russell @@ -37,7 +36,7 @@ import org.springframework.test.context.junit4.SpringRunner; * @since 5.0.7 * */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class SftpMessageSourceTests extends SftpTestSupport { diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java index 9a47bd9e95..d04d65ec48 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,7 @@ import java.util.Comparator; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -50,7 +49,7 @@ import org.springframework.integration.transformer.StreamTransformer; import org.springframework.messaging.Message; import org.springframework.scheduling.support.PeriodicTrigger; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import com.jcraft.jsch.ChannelSftp.LsEntry; @@ -61,7 +60,7 @@ import com.jcraft.jsch.ChannelSftp.LsEntry; * @since 4.3 * */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class SftpStreamingMessageSourceTests extends SftpTestSupport { diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/BigMGetTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/BigMGetTests.java index e2ffe214df..6b040d9493 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/BigMGetTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/BigMGetTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,24 +18,21 @@ package org.springframework.integration.sftp.outbound; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Gary Russell * @since 2.2 * */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig public class BigMGetTests extends org.springframework.integration.file.BigMGetTests { @Test - @Ignore // needs directories and server (FTP and SFTP) + @Disabled("needs directories and server (FTP and SFTP)") // TODO: use SftpTestSupport public void doTest() throws Exception { assertThat(this.mgetManyFiles().getPayload().size()).isEqualTo(FILES); } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests.java index dbca776f29..04a05d1737 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests.java @@ -37,9 +37,8 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import org.apache.commons.io.FileUtils; -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.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.annotation.Autowired; @@ -70,7 +69,7 @@ import org.springframework.messaging.MessagingException; import org.springframework.messaging.PollableChannel; import org.springframework.messaging.support.GenericMessage; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.FileCopyUtils; import com.jcraft.jsch.ChannelSftp; @@ -82,7 +81,7 @@ import com.jcraft.jsch.ChannelSftp.LsEntry; * * @since 3.0 */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class SftpServerOutboundTests extends SftpTestSupport { @@ -137,7 +136,7 @@ public class SftpServerOutboundTests extends SftpTestSupport { @Autowired private SftpRemoteFileTemplate template; - @Before + @BeforeEach public void setup() { this.config.targetLocalDirectoryName = getTargetLocalDirectoryName(); } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/ProxyTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/ProxyTests.java index 2cd81c7044..9f143c2bab 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/ProxyTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/ProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package org.springframework.integration.sftp.session; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.integration.test.util.TestUtils; @@ -36,7 +36,7 @@ import com.jcraft.jsch.ProxySOCKS5; public class ProxyTests { @Test - @Ignore + @Disabled // TODO Use SftpTestSupport /* * Needs host and account */ @@ -51,7 +51,7 @@ public class ProxyTests { } @Test - @Ignore + @Disabled /* * Needs host and account and... * $ ssh -D 1080 -f -N gpr@10.0.0.3 diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpRemoteFileTemplateTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpRemoteFileTemplateTests.java index af0d43f1c6..c96c773a33 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpRemoteFileTemplateTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpRemoteFileTemplateTests.java @@ -24,8 +24,7 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -43,7 +42,7 @@ import org.springframework.messaging.MessageDeliveryException; import org.springframework.messaging.MessagingException; import org.springframework.messaging.support.GenericMessage; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.ChannelSftp.LsEntry; @@ -57,7 +56,7 @@ import com.jcraft.jsch.SftpException; * @since 4.1 * */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class SftpRemoteFileTemplateTests extends SftpTestSupport { diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java index 97f2ade4dc..26a804ff62 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory; import org.apache.sshd.server.SshServer; import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ClassPathResource; diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpSessionFactoryTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpSessionFactoryTests.java index 7d5d10b8ba..f266890737 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpSessionFactoryTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpSessionFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ import java.util.Collections; import org.apache.sshd.server.SshServer; import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource;