http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java index 5e7b360..b58cfb2 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java @@ -99,8 +99,8 @@ import org.apache.sshd.server.subsystem.sftp.SftpEventListenerManager; import org.apache.sshd.server.subsystem.sftp.SftpFileSystemAccessor; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemEnvironment; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; +import org.apache.sshd.util.test.CommonTestSupportUtils; import org.apache.sshd.util.test.SimpleUserInfo; -import org.apache.sshd.util.test.Utils; import org.junit.After; import org.junit.Assume; import org.junit.Before; @@ -145,7 +145,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { public void testWriteOffsetIgnoredForAppendMode() throws IOException { Path targetPath = detectTargetFolder(); Path parentPath = targetPath.getParent(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); Path testFile = assertHierarchyTargetFolderExists(lclSftp).resolve("file.txt"); Files.deleteIfExists(testFile); @@ -160,7 +160,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { session.auth().verify(5L, TimeUnit.SECONDS); try (SftpClient sftp = createSftpClient(session)) { - String file = Utils.resolveRelativeRemotePath(parentPath, testFile); + String file = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, testFile); try (CloseableHandle handle = sftp.open(file, OpenMode.Create, OpenMode.Write, OpenMode.Read, OpenMode.Append)) { sftp.write(handle, 7365L, expectedRandom); @@ -192,7 +192,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { public void testReadBufferLimit() throws Exception { Path targetPath = detectTargetFolder(); Path parentPath = targetPath.getParent(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); Path testFile = assertHierarchyTargetFolderExists(lclSftp).resolve("file.txt"); byte[] expected = new byte[1024]; @@ -206,7 +206,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { session.auth().verify(5L, TimeUnit.SECONDS); try (SftpClient sftp = createSftpClient(session)) { - String file = Utils.resolveRelativeRemotePath(parentPath, testFile); + String file = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, testFile); byte[] actual = new byte[expected.length]; int maxAllowed = actual.length / 4; // allow less than actual @@ -263,7 +263,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { private void testCannotEscapeRoot(boolean useAbsolutePath) throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); assertHierarchyTargetFolderExists(lclSftp); sshd.setFileSystemFactory(new VirtualFileSystemFactory(lclSftp)); @@ -327,9 +327,9 @@ public class SftpTest extends AbstractSftpClientTestSupport { public void testNormalizeRemotePathsValues() throws Exception { Path targetPath = detectTargetFolder(); Path parentPath = targetPath.getParent(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); Path testFile = assertHierarchyTargetFolderExists(lclSftp).resolve("file.txt"); - String file = Utils.resolveRelativeRemotePath(parentPath, testFile); + String file = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, testFile); String[] comps = GenericUtils.split(file, '/'); Factory<? extends Random> factory = client.getRandomFactory(); @@ -379,10 +379,10 @@ public class SftpTest extends AbstractSftpClientTestSupport { public void testOpen() throws Exception { Path targetPath = detectTargetFolder(); Path parentPath = targetPath.getParent(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); Path clientFolder = lclSftp.resolve("client"); Path testFile = clientFolder.resolve("file.txt"); - String file = Utils.resolveRelativeRemotePath(parentPath, testFile); + String file = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, testFile); File javaFile = testFile.toFile(); assertHierarchyTargetFolderExists(javaFile.getParentFile()); @@ -477,7 +477,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { public void testInputStreamSkipAndReset() throws Exception { Path targetPath = detectTargetFolder(); Path parentPath = targetPath.getParent(); - Path localFile = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path localFile = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); Files.createDirectories(localFile.getParent()); byte[] data = (getClass().getName() + "#" + getCurrentTestName() + "[" + localFile + "]").getBytes(StandardCharsets.UTF_8); Files.write(localFile, data, StandardOpenOption.CREATE); @@ -486,7 +486,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { session.auth().verify(5L, TimeUnit.SECONDS); try (SftpClient sftp = createSftpClient(session); - InputStream stream = sftp.read(Utils.resolveRelativeRemotePath(parentPath, localFile), OpenMode.Read)) { + InputStream stream = sftp.read(CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, localFile), OpenMode.Read)) { assertFalse("Stream reported mark supported", stream.markSupported()); try { stream.mark(data.length); @@ -563,7 +563,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { Path targetPath = detectTargetFolder(); Path parentPath = targetPath.getParent(); - Path localFile = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path localFile = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); Files.createDirectories(localFile.getParent()); byte[] expected = (getClass().getName() + "#" + getCurrentTestName() + "[" + localFile + "]").getBytes(StandardCharsets.UTF_8); Files.write(localFile, expected, StandardOpenOption.CREATE); @@ -573,7 +573,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { try (SftpClient sftp = createSftpClient(session)) { byte[] actual = new byte[expected.length]; - try (InputStream stream = sftp.read(Utils.resolveRelativeRemotePath(parentPath, localFile), OpenMode.Read)) { + try (InputStream stream = sftp.read(CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, localFile), OpenMode.Read)) { IoUtils.readFully(stream, actual); } @@ -584,7 +584,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { Path localParent = localFile.getParent(); String localName = Objects.toString(localFile.getFileName(), null); - try (CloseableHandle handle = sftp.openDir(Utils.resolveRelativeRemotePath(parentPath, localParent))) { + try (CloseableHandle handle = sftp.openDir(CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, localParent))) { List<DirEntry> entries = sftp.readDir(handle); Path remoteParent = dirHolder.getAndSet(null); assertNotNull("No remote folder holder value", remoteParent); @@ -824,12 +824,12 @@ public class SftpTest extends AbstractSftpClientTestSupport { session.auth().verify(5L, TimeUnit.SECONDS); Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); - Utils.deleteRecursive(lclSftp); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + CommonTestSupportUtils.deleteRecursive(lclSftp); Path parentPath = targetPath.getParent(); Path clientFolder = assertHierarchyTargetFolderExists(lclSftp).resolve("client"); - String dir = Utils.resolveRelativeRemotePath(parentPath, clientFolder); + String dir = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, clientFolder); try (SftpClient sftp = createSftpClient(session)) { sftp.mkdir(dir); @@ -848,7 +848,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { // test erroneous calls that check for negative values Path invalidPath = clientFolder.resolve(getCurrentTestName() + "-invalid"); - testInvalidParams(sftp, invalidPath, Utils.resolveRelativeRemotePath(parentPath, invalidPath)); + testInvalidParams(sftp, invalidPath, CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, invalidPath)); // cleanup sftp.rmdir(dir); @@ -920,11 +920,11 @@ public class SftpTest extends AbstractSftpClientTestSupport { String d = getCurrentTestName() + "\n"; Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); - Utils.deleteRecursive(lclSftp); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + CommonTestSupportUtils.deleteRecursive(lclSftp); Path target = assertHierarchyTargetFolderExists(lclSftp).resolve("file.txt"); - String remotePath = Utils.resolveRelativeRemotePath(targetPath.getParent(), target); + String remotePath = CommonTestSupportUtils.resolveRelativeRemotePath(targetPath.getParent(), target); final int numIterations = 10; StringBuilder sb = new StringBuilder(d.length() * numIterations * numIterations); @@ -946,11 +946,11 @@ public class SftpTest extends AbstractSftpClientTestSupport { @Test public void testReadWriteWithOffset() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); - Utils.deleteRecursive(lclSftp); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + CommonTestSupportUtils.deleteRecursive(lclSftp); Path localPath = assertHierarchyTargetFolderExists(lclSftp).resolve("file.txt"); - String remotePath = Utils.resolveRelativeRemotePath(targetPath.getParent(), localPath); + String remotePath = CommonTestSupportUtils.resolveRelativeRemotePath(targetPath.getParent(), localPath); String data = getCurrentTestName(); String extraData = "@" + getClass().getSimpleName(); int appendOffset = -5; @@ -1024,8 +1024,8 @@ public class SftpTest extends AbstractSftpClientTestSupport { @Test public void testRename() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); - Utils.deleteRecursive(lclSftp); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + CommonTestSupportUtils.deleteRecursive(lclSftp); Path parentPath = targetPath.getParent(); Path clientFolder = assertHierarchyTargetFolderExists(lclSftp.resolve("client")); @@ -1035,15 +1035,15 @@ public class SftpTest extends AbstractSftpClientTestSupport { try (SftpClient sftp = createSftpClient(session)) { Path file1 = clientFolder.resolve("file-1.txt"); - String file1Path = Utils.resolveRelativeRemotePath(parentPath, file1); + String file1Path = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, file1); try (OutputStream os = sftp.write(file1Path, SftpClient.MIN_WRITE_BUFFER_SIZE)) { os.write((getCurrentTestName() + "\n").getBytes(StandardCharsets.UTF_8)); } Path file2 = clientFolder.resolve("file-2.txt"); - String file2Path = Utils.resolveRelativeRemotePath(parentPath, file2); + String file2Path = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, file2); Path file3 = clientFolder.resolve("file-3.txt"); - String file3Path = Utils.resolveRelativeRemotePath(parentPath, file3); + String file3Path = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, file3); try { sftp.rename(file2Path, file3Path); fail("Unxpected rename success of " + file2Path + " => " + file3Path); @@ -1223,12 +1223,12 @@ public class SftpTest extends AbstractSftpClientTestSupport { private void testClient(FactoryManager manager, SftpClient sftp) throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); - Utils.deleteRecursive(lclSftp); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + CommonTestSupportUtils.deleteRecursive(lclSftp); Path parentPath = targetPath.getParent(); Path clientFolder = assertHierarchyTargetFolderExists(lclSftp).resolve("client"); - String dir = Utils.resolveRelativeRemotePath(parentPath, clientFolder); + String dir = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, clientFolder); sftp.mkdir(dir); String file = dir + "/" + getCurrentTestName() + "-file.txt"; @@ -1343,8 +1343,8 @@ public class SftpTest extends AbstractSftpClientTestSupport { }; Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); - Utils.deleteRecursive(lclSftp); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + CommonTestSupportUtils.deleteRecursive(lclSftp); /* * NOTE !!! according to Jsch documentation @@ -1360,7 +1360,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { */ Path parentPath = targetPath.getParent(); Path sourcePath = assertHierarchyTargetFolderExists(lclSftp).resolve("src.txt"); - String remSrcPath = "/" + Utils.resolveRelativeRemotePath(parentPath, sourcePath); + String remSrcPath = "/" + CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, sourcePath); factory.addSftpEventListener(listener); try { @@ -1376,7 +1376,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { assertEquals("Mismatched stored data in " + remSrcPath, data, readFile(remSrcPath)); Path linkPath = lclSftp.resolve("link-" + sourcePath.getFileName()); - String remLinkPath = "/" + Utils.resolveRelativeRemotePath(parentPath, linkPath); + String remLinkPath = "/" + CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, linkPath); LinkOption[] options = IoUtils.getLinkOptions(false); if (Files.exists(linkPath, options)) { Files.delete(linkPath); @@ -1405,7 +1405,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { @Test // see SSHD-697 public void testFileChannel() throws IOException { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Path lclFile = lclSftp.resolve(getCurrentTestName() + ".txt"); Files.deleteIfExists(lclFile); byte[] expected = (getClass().getName() + "#" + getCurrentTestName() + "(" + new Date() + ")").getBytes(StandardCharsets.UTF_8); @@ -1416,7 +1416,7 @@ public class SftpTest extends AbstractSftpClientTestSupport { try (SftpClient sftp = createSftpClient(session)) { Path parentPath = targetPath.getParent(); - String remFilePath = Utils.resolveRelativeRemotePath(parentPath, lclFile); + String remFilePath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, lclFile); try (FileChannel fc = sftp.openRemotePathChannel(remFilePath, EnumSet.of(StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE))) { int writeLen = fc.write(ByteBuffer.wrap(expected));
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java index afc1944..e02aa30 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java @@ -27,7 +27,7 @@ import java.util.Random; import org.apache.sshd.client.session.ClientSession; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemEnvironment; -import org.apache.sshd.util.test.BaseTestSupport; +import org.apache.sshd.util.test.JUnitTestSupport; import org.apache.sshd.util.test.NoIoTestCase; import org.junit.FixMethodOrder; import org.junit.Test; @@ -40,7 +40,7 @@ import org.mockito.Mockito; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @Category({ NoIoTestCase.class }) -public class SftpVersionSelectorTest extends BaseTestSupport { +public class SftpVersionSelectorTest extends JUnitTestSupport { public SftpVersionSelectorTest() { super(); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java index 0e82f6e..1051c50 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java @@ -61,8 +61,8 @@ import org.apache.sshd.server.subsystem.sftp.SftpEventListener; import org.apache.sshd.server.subsystem.sftp.SftpSubsystem; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemEnvironment; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; +import org.apache.sshd.util.test.CommonTestSupportUtils; import org.apache.sshd.util.test.JUnit4ClassRunnerWithParametersFactory; -import org.apache.sshd.util.test.Utils; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; @@ -111,13 +111,13 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport { @Test // See SSHD-749 public void testSftpOpenFlags() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Path lclParent = assertHierarchyTargetFolderExists(lclSftp); Path lclFile = lclParent.resolve(getCurrentTestName() + "-" + getTestedVersion() + ".txt"); Files.deleteIfExists(lclFile); Path parentPath = targetPath.getParent(); - String remotePath = Utils.resolveRelativeRemotePath(parentPath, lclFile); + String remotePath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, lclFile); try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port) .verify(CONNECT_TIMEOUT, TimeUnit.SECONDS) .getSession()) { @@ -150,11 +150,11 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport { @Test // see SSHD-572 public void testSftpFileTimesUpdate() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Path lclFile = assertHierarchyTargetFolderExists(lclSftp).resolve(getCurrentTestName() + "-" + getTestedVersion() + ".txt"); Files.write(lclFile, getClass().getName().getBytes(StandardCharsets.UTF_8)); Path parentPath = targetPath.getParent(); - String remotePath = Utils.resolveRelativeRemotePath(parentPath, lclFile); + String remotePath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, lclFile); try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port) .verify(CONNECT_TIMEOUT, TimeUnit.SECONDS) .getSession()) { @@ -186,7 +186,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport { @Test // see SSHD-573 public void testSftpFileTypeAndPermissionsUpdate() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Path subFolder = Files.createDirectories(lclSftp.resolve("sub-folder")); String subFolderName = subFolder.getFileName().toString(); Path lclFile = assertHierarchyTargetFolderExists(lclSftp).resolve(getCurrentTestName() + "-" + getTestedVersion() + ".txt"); @@ -194,7 +194,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport { Files.write(lclFile, getClass().getName().getBytes(StandardCharsets.UTF_8)); Path parentPath = targetPath.getParent(); - String remotePath = Utils.resolveRelativeRemotePath(parentPath, lclSftp); + String remotePath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, lclSftp); try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port) .verify(CONNECT_TIMEOUT, TimeUnit.SECONDS) .getSession()) { @@ -299,13 +299,13 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport { }); Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Files.createDirectories(lclSftp.resolve("sub-folder")); Path lclFile = assertHierarchyTargetFolderExists(lclSftp).resolve(getCurrentTestName() + "-" + getTestedVersion() + ".txt"); Files.write(lclFile, getClass().getName().getBytes(StandardCharsets.UTF_8)); Path parentPath = targetPath.getParent(); - String remotePath = Utils.resolveRelativeRemotePath(parentPath, lclSftp); + String remotePath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, lclSftp); int numInvoked = 0; List<NamedFactory<Command>> factories = sshd.getSubsystemFactories(); @@ -418,13 +418,13 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport { }); Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Files.createDirectories(lclSftp.resolve("sub-folder")); Path lclFile = assertHierarchyTargetFolderExists(lclSftp).resolve(getCurrentTestName() + "-" + getTestedVersion() + ".txt"); Files.write(lclFile, getClass().getName().getBytes(StandardCharsets.UTF_8)); Path parentPath = targetPath.getParent(); - String remotePath = Utils.resolveRelativeRemotePath(parentPath, lclSftp); + String remotePath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, lclSftp); int numInvoked = 0; List<NamedFactory<Command>> factories = sshd.getSubsystemFactories(); @@ -471,7 +471,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport { int version = sftp.getVersion(); Path targetPath = detectTargetFolder(); Path parentPath = targetPath.getParent(); - String remotePath = Utils.resolveRelativeRemotePath(parentPath, targetPath); + String remotePath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, targetPath); try (CloseableHandle handle = sftp.openDir(remotePath)) { List<DirEntry> entries = sftp.readDir(handle, eolIndicator); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SimpleSftpClientTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SimpleSftpClientTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SimpleSftpClientTest.java index 2f41c0f..7663485 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SimpleSftpClientTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/SimpleSftpClientTest.java @@ -33,7 +33,7 @@ import org.apache.sshd.common.session.Session; import org.apache.sshd.common.subsystem.sftp.SftpConstants; import org.apache.sshd.common.util.io.IoUtils; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; -import org.apache.sshd.util.test.Utils; +import org.apache.sshd.util.test.CommonTestSupportUtils; import org.apache.sshd.util.test.client.simple.BaseSimpleClientTestSupport; import org.junit.FixMethodOrder; import org.junit.Test; @@ -80,11 +80,11 @@ public class SimpleSftpClientTest extends BaseSimpleClientTestSupport { @Test public void testSftpProxyCalls() throws Exception { - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); - Utils.deleteRecursive(lclSftp); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + CommonTestSupportUtils.deleteRecursive(lclSftp); Path clientFolder = assertHierarchyTargetFolderExists(lclSftp).resolve("client"); Path clientFile = clientFolder.resolve("file.txt"); - String remoteFileDir = Utils.resolveRelativeRemotePath(parentPath, clientFolder); + String remoteFileDir = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, clientFolder); String clientFileName = clientFile.getFileName().toString(); String remoteFilePath = remoteFileDir + "/" + clientFileName; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java index e3537ea..1ddd789 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java @@ -49,8 +49,8 @@ import org.apache.sshd.common.util.GenericUtils; import org.apache.sshd.common.util.NumberUtils; import org.apache.sshd.common.util.buffer.BufferUtils; import org.apache.sshd.common.util.io.IoUtils; +import org.apache.sshd.util.test.CommonTestSupportUtils; import org.apache.sshd.util.test.JUnit4ClassRunnerWithParametersFactory; -import org.apache.sshd.util.test.Utils; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; @@ -159,7 +159,7 @@ public class AbstractCheckFileExtensionTest extends AbstractSftpClientTestSuppor @SuppressWarnings("checkstyle:nestedtrydepth") private void testCheckFileExtension(NamedFactory<? extends Digest> factory, byte[] data, int hashBlockSize, byte[] expectedHash) throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Path srcFile = assertHierarchyTargetFolderExists(lclSftp).resolve(factory.getName() + "-data-" + data.length + "-" + hashBlockSize + ".txt"); Files.write(srcFile, data, IoUtils.EMPTY_OPEN_OPTIONS); @@ -175,8 +175,8 @@ public class AbstractCheckFileExtensionTest extends AbstractSftpClientTestSuppor } Path parentPath = targetPath.getParent(); - String srcPath = Utils.resolveRelativeRemotePath(parentPath, srcFile); - String srcFolder = Utils.resolveRelativeRemotePath(parentPath, srcFile.getParent()); + String srcPath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, srcFile); + String srcFolder = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, srcFile.getParent()); try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) { session.addPasswordIdentity(getCurrentTestName()); session.auth().verify(5L, TimeUnit.SECONDS); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java index ea2783a..c195f15 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java @@ -43,8 +43,8 @@ import org.apache.sshd.common.subsystem.sftp.SftpException; import org.apache.sshd.common.util.GenericUtils; import org.apache.sshd.common.util.buffer.BufferUtils; import org.apache.sshd.common.util.io.IoUtils; +import org.apache.sshd.util.test.CommonTestSupportUtils; import org.apache.sshd.util.test.JUnit4ClassRunnerWithParametersFactory; -import org.apache.sshd.util.test.Utils; import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; @@ -127,13 +127,13 @@ public class AbstractMD5HashExtensionTest extends AbstractSftpClientTestSupport } Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Path srcFile = assertHierarchyTargetFolderExists(lclSftp).resolve("data-" + data.length + ".txt"); Files.write(srcFile, data, IoUtils.EMPTY_OPEN_OPTIONS); Path parentPath = targetPath.getParent(); - String srcPath = Utils.resolveRelativeRemotePath(parentPath, srcFile); - String srcFolder = Utils.resolveRelativeRemotePath(parentPath, srcFile.getParent()); + String srcPath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, srcFile); + String srcFolder = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, srcFile.getParent()); try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) { session.addPasswordIdentity(getCurrentTestName()); session.auth().verify(5L, TimeUnit.SECONDS); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java index 01d3334..6b78607 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java @@ -43,8 +43,8 @@ import org.apache.sshd.common.Factory; import org.apache.sshd.common.random.Random; import org.apache.sshd.common.subsystem.sftp.SftpConstants; import org.apache.sshd.common.util.io.IoUtils; +import org.apache.sshd.util.test.CommonTestSupportUtils; import org.apache.sshd.util.test.JUnit4ClassRunnerWithParametersFactory; -import org.apache.sshd.util.test.Utils; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; @@ -135,18 +135,18 @@ public class CopyDataExtensionImplTest extends AbstractSftpClientTestSupport { private void testCopyDataExtension(byte[] data, int readOffset, int readLength, long writeOffset) throws Exception { Path targetPath = detectTargetFolder(); Path parentPath = targetPath.getParent(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); LinkOption[] options = IoUtils.getLinkOptions(true); String baseName = readOffset + "-" + readLength + "-" + writeOffset; Path srcFile = assertHierarchyTargetFolderExists(lclSftp, options).resolve(baseName + "-src.txt"); Files.write(srcFile, data, IoUtils.EMPTY_OPEN_OPTIONS); - String srcPath = Utils.resolveRelativeRemotePath(parentPath, srcFile); + String srcPath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, srcFile); Path dstFile = srcFile.getParent().resolve(baseName + "-dst.txt"); if (Files.exists(dstFile, options)) { Files.delete(dstFile); } - String dstPath = Utils.resolveRelativeRemotePath(parentPath, dstFile); + String dstPath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, dstFile); if (writeOffset > 0L) { Factory<? extends Random> factory = client.getRandomFactory(); Random randomizer = factory.create(); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyFileExtensionImplTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyFileExtensionImplTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyFileExtensionImplTest.java index b21da13..74d3573 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyFileExtensionImplTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyFileExtensionImplTest.java @@ -33,7 +33,7 @@ import org.apache.sshd.client.subsystem.sftp.extensions.CopyFileExtension; import org.apache.sshd.common.subsystem.sftp.SftpConstants; import org.apache.sshd.common.subsystem.sftp.SftpException; import org.apache.sshd.common.util.io.IoUtils; -import org.apache.sshd.util.test.Utils; +import org.apache.sshd.util.test.CommonTestSupportUtils; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; @@ -56,17 +56,18 @@ public class CopyFileExtensionImplTest extends AbstractSftpClientTestSupport { @Test public void testCopyFileExtension() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); - Utils.deleteRecursive(lclSftp); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, + SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + CommonTestSupportUtils.deleteRecursive(lclSftp); byte[] data = (getClass().getName() + "#" + getCurrentTestName()).getBytes(StandardCharsets.UTF_8); Path srcFile = assertHierarchyTargetFolderExists(lclSftp).resolve("src.txt"); Files.write(srcFile, data, IoUtils.EMPTY_OPEN_OPTIONS); Path parentPath = targetPath.getParent(); - String srcPath = Utils.resolveRelativeRemotePath(parentPath, srcFile); + String srcPath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, srcFile); Path dstFile = lclSftp.resolve("dst.txt"); - String dstPath = Utils.resolveRelativeRemotePath(parentPath, dstFile); + String dstPath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, dstFile); LinkOption[] options = IoUtils.getLinkOptions(true); assertFalse("Destination file unexpectedly exists", Files.exists(dstFile, options)); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java index af83656..a528278 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java @@ -38,7 +38,7 @@ import org.apache.sshd.common.subsystem.sftp.extensions.SpaceAvailableExtensionI import org.apache.sshd.server.command.Command; import org.apache.sshd.server.subsystem.sftp.SftpSubsystem; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; -import org.apache.sshd.util.test.Utils; +import org.apache.sshd.util.test.CommonTestSupportUtils; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; @@ -61,10 +61,10 @@ public class SpaceAvailableExtensionImplTest extends AbstractSftpClientTestSuppo @Test public void testFileStoreReport() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); Path parentPath = targetPath.getParent(); FileStore store = Files.getFileStore(lclSftp.getRoot()); - final String queryPath = Utils.resolveRelativeRemotePath(parentPath, lclSftp); + final String queryPath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, lclSftp); final SpaceAvailableExtensionInfo expected = new SpaceAvailableExtensionInfo(store); List<NamedFactory<Command>> factories = sshd.getSubsystemFactories(); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java index 83ef70f..d778393 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java @@ -52,7 +52,7 @@ import org.apache.sshd.server.command.Command; import org.apache.sshd.server.session.ServerSession; import org.apache.sshd.server.subsystem.sftp.SftpSubsystem; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; -import org.apache.sshd.util.test.Utils; +import org.apache.sshd.util.test.CommonTestSupportUtils; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; @@ -75,12 +75,12 @@ public class OpenSSHExtensionsTest extends AbstractSftpClientTestSupport { @Test public void testFsync() throws IOException { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Path srcFile = assertHierarchyTargetFolderExists(lclSftp).resolve(getCurrentTestName() + ".txt"); byte[] expected = (getClass().getName() + "#" + getCurrentTestName()).getBytes(StandardCharsets.UTF_8); Path parentPath = targetPath.getParent(); - String srcPath = Utils.resolveRelativeRemotePath(parentPath, srcFile); + String srcPath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, srcFile); try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) { session.addPasswordIdentity(getCurrentTestName()); session.auth().verify(5L, TimeUnit.SECONDS); @@ -101,11 +101,11 @@ public class OpenSSHExtensionsTest extends AbstractSftpClientTestSupport { @Test public void testStat() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName()); Path srcFile = assertHierarchyTargetFolderExists(lclSftp).resolve(getCurrentTestName() + ".txt"); Files.write(srcFile, (getClass().getName() + "#" + getCurrentTestName()).getBytes(StandardCharsets.UTF_8), IoUtils.EMPTY_OPEN_OPTIONS); Path parentPath = targetPath.getParent(); - String srcPath = Utils.resolveRelativeRemotePath(parentPath, srcFile); + String srcPath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, srcFile); final AtomicReference<String> extensionHolder = new AtomicReference<>(null); final OpenSSHStatExtensionInfo expected = new OpenSSHStatExtensionInfo(); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpConstantsTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpConstantsTest.java b/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpConstantsTest.java index d059d36..52f7096 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpConstantsTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpConstantsTest.java @@ -20,7 +20,7 @@ package org.apache.sshd.common.subsystem.sftp; import org.apache.sshd.common.util.GenericUtils; -import org.apache.sshd.util.test.BaseTestSupport; +import org.apache.sshd.util.test.JUnitTestSupport; import org.apache.sshd.util.test.NoIoTestCase; import org.junit.FixMethodOrder; import org.junit.Test; @@ -32,7 +32,7 @@ import org.junit.runners.MethodSorters; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @Category({ NoIoTestCase.class }) -public class SftpConstantsTest extends BaseTestSupport { +public class SftpConstantsTest extends JUnitTestSupport { public SftpConstantsTest() { super(); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroupTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroupTest.java b/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroupTest.java index 704aa05..3075f01 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroupTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroupTest.java @@ -20,7 +20,7 @@ package org.apache.sshd.common.subsystem.sftp; import org.apache.sshd.common.util.GenericUtils; -import org.apache.sshd.util.test.BaseTestSupport; +import org.apache.sshd.util.test.JUnitTestSupport; import org.apache.sshd.util.test.NoIoTestCase; import org.junit.FixMethodOrder; import org.junit.Test; @@ -32,7 +32,7 @@ import org.junit.runners.MethodSorters; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @Category({ NoIoTestCase.class }) -public class SftpUniversalOwnerAndGroupTest extends BaseTestSupport { +public class SftpUniversalOwnerAndGroupTest extends JUnitTestSupport { public SftpUniversalOwnerAndGroupTest() { super(); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java ---------------------------------------------------------------------- diff --git a/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java b/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java index 436c84b..da722f2 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java @@ -20,7 +20,7 @@ package org.apache.sshd.server.subsystem.sftp; import org.apache.sshd.common.util.threads.CloseableExecutorService; -import org.apache.sshd.util.test.BaseTestSupport; +import org.apache.sshd.util.test.JUnitTestSupport; import org.apache.sshd.util.test.NoIoTestCase; import org.junit.FixMethodOrder; import org.junit.Test; @@ -33,7 +33,7 @@ import org.mockito.Mockito; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @Category({ NoIoTestCase.class }) -public class SftpSubsystemFactoryTest extends BaseTestSupport { +public class SftpSubsystemFactoryTest extends JUnitTestSupport { public SftpSubsystemFactoryTest() { super(); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-spring-sftp/pom.xml ---------------------------------------------------------------------- diff --git a/sshd-spring-sftp/pom.xml b/sshd-spring-sftp/pom.xml index c5b4f56..63ec070 100644 --- a/sshd-spring-sftp/pom.xml +++ b/sshd-spring-sftp/pom.xml @@ -100,6 +100,13 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.apache.sshd</groupId> + <artifactId>sshd-common</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-spring-sftp/src/main/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactory.java ---------------------------------------------------------------------- diff --git a/sshd-spring-sftp/src/main/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactory.java b/sshd-spring-sftp/src/main/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactory.java index 1d04f60..7dc2eb0 100644 --- a/sshd-spring-sftp/src/main/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactory.java +++ b/sshd-spring-sftp/src/main/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactory.java @@ -37,7 +37,7 @@ import org.apache.sshd.client.subsystem.sftp.SftpClient.DirEntry; import org.apache.sshd.client.subsystem.sftp.SftpClientFactory; import org.apache.sshd.client.subsystem.sftp.SftpVersionSelector; import org.apache.sshd.common.PropertyResolverUtils; -import org.apache.sshd.common.config.SshConfigFileReader; +import org.apache.sshd.common.config.ConfigFileReaderSupport; import org.apache.sshd.common.config.keys.FilePasswordProvider; import org.apache.sshd.common.config.keys.KeyUtils; import org.apache.sshd.common.config.keys.loader.pem.PEMResourceParserUtils; @@ -72,7 +72,7 @@ public class ApacheSshdSftpSessionFactory private final AtomicReference<ClientSession> sharedSessionHolder = new AtomicReference<>(); private volatile String hostValue; - private volatile int portValue = SshConfigFileReader.DEFAULT_PORT; + private volatile int portValue = ConfigFileReaderSupport.DEFAULT_PORT; private volatile String userValue; private volatile String passwordValue; private volatile Resource privateKey; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-spring-sftp/src/test/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactoryTest.java ---------------------------------------------------------------------- diff --git a/sshd-spring-sftp/src/test/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactoryTest.java b/sshd-spring-sftp/src/test/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactoryTest.java index e59ebd8..75d7195 100644 --- a/sshd-spring-sftp/src/test/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactoryTest.java +++ b/sshd-spring-sftp/src/test/java/org/apache/sshd/spring/integration/sftp/ApacheSshdSftpSessionFactoryTest.java @@ -47,8 +47,9 @@ import org.apache.sshd.common.util.io.IoUtils; import org.apache.sshd.server.SshServer; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; import org.apache.sshd.util.test.BaseTestSupport; +import org.apache.sshd.util.test.CommonTestSupportUtils; +import org.apache.sshd.util.test.CoreTestSupportUtils; import org.apache.sshd.util.test.JSchLogger; -import org.apache.sshd.util.test.Utils; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -110,12 +111,12 @@ public class ApacheSshdSftpSessionFactoryTest extends BaseTestSupport { @BeforeClass public static void setupClientAndServer() throws Exception { JSchLogger.init(); - sshd = Utils.setupTestServer(ApacheSshdSftpSessionFactoryTest.class); + sshd = CoreTestSupportUtils.setupTestServer(ApacheSshdSftpSessionFactoryTest.class); sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory())); sshd.start(); port = sshd.getPort(); - client = Utils.setupTestClient(ApacheSshdSftpSessionFactoryTest.class); + client = CoreTestSupportUtils.setupTestClient(ApacheSshdSftpSessionFactoryTest.class); client.start(); } @@ -174,7 +175,7 @@ public class ApacheSshdSftpSessionFactoryTest extends BaseTestSupport { @Test public void testWriteRemoteFileContents() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); Path srcFile = Files.createDirectories(lclSftp).resolve("source.txt"); List<String> expectedLines = Arrays.asList(getClass().getPackage().getName(), getClass().getSimpleName(), getCurrentTestName()); Files.deleteIfExists(srcFile); @@ -182,7 +183,7 @@ public class ApacheSshdSftpSessionFactoryTest extends BaseTestSupport { Path dstFile = srcFile.getParent().resolve("destination.txt"); Path parentPath = targetPath.getParent(); - String remoteFile = Utils.resolveRelativeRemotePath(parentPath, dstFile); + String remoteFile = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, dstFile); SessionFactory<LsEntry> legacyFactory = getLegacySessionFactory(); SessionFactory<SftpClient.DirEntry> sshdFactory = getSshdSessionFactory(); try (Session<LsEntry> legacySession = legacyFactory.getSession(); @@ -208,14 +209,14 @@ public class ApacheSshdSftpSessionFactoryTest extends BaseTestSupport { @Test public void testRetrieveRemoteFileContents() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); Path lclFile = Files.createDirectories(lclSftp).resolve("source.txt"); List<String> expectedLines = Arrays.asList(getClass().getPackage().getName(), getClass().getSimpleName(), getCurrentTestName()); Files.deleteIfExists(lclFile); Files.write(lclFile, expectedLines, StandardCharsets.UTF_8); Path parentPath = targetPath.getParent(); - String remoteFile = Utils.resolveRelativeRemotePath(parentPath, lclFile); + String remoteFile = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, lclFile); SessionFactory<LsEntry> legacyFactory = getLegacySessionFactory(); SessionFactory<SftpClient.DirEntry> sshdFactory = getSshdSessionFactory(); try (Session<LsEntry> legacySession = legacyFactory.getSession(); @@ -253,8 +254,8 @@ public class ApacheSshdSftpSessionFactoryTest extends BaseTestSupport { @Test public void testListContents() throws Exception { Path targetPath = detectTargetFolder(); - Path lclSftp = Utils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); - Utils.deleteRecursive(lclSftp); // start clean + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), getCurrentTestName()); + CommonTestSupportUtils.deleteRecursive(lclSftp); // start clean List<Path> subFolders = new ArrayList<>(); for (int index = 1; index <= Byte.SIZE; index++) { @@ -272,7 +273,7 @@ public class ApacheSshdSftpSessionFactoryTest extends BaseTestSupport { Collections.sort(subFiles, BY_CASE_INSENSITIVE_FILE_PART); Path parentPath = targetPath.getParent(); - String remotePath = Utils.resolveRelativeRemotePath(parentPath, lclSftp); + String remotePath = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, lclSftp); SessionFactory<LsEntry> legacyFactory = getLegacySessionFactory(); SessionFactory<SftpClient.DirEntry> sshdFactory = getSshdSessionFactory(); try (Session<LsEntry> legacySession = legacyFactory.getSession();
