Upgrade to SSHD 2.9.3
* Fix `SftpRemoteFileTemplateTests` according to new SSHD requirements (restrictions?)
This commit is contained in:
@@ -47,7 +47,7 @@ ext {
|
||||
modifiedFiles =
|
||||
files(grgit.status().unstaged.modified).filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') }
|
||||
|
||||
apacheSshdVersion = '2.9.2'
|
||||
apacheSshdVersion = '2.9.3'
|
||||
artemisVersion = '2.28.0'
|
||||
aspectjVersion = '1.9.20.1'
|
||||
assertjVersion = '3.24.2'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2023 the original author or authors.
|
||||
* Copyright 2014-2024 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.
|
||||
@@ -71,14 +71,14 @@ public class SftpRemoteFileTemplateTests extends SftpTestSupport {
|
||||
fileNameGenerator.setExpression("'foobar.txt'");
|
||||
fileNameGenerator.setBeanFactory(mock(BeanFactory.class));
|
||||
template.setFileNameGenerator(fileNameGenerator);
|
||||
template.setRemoteDirectoryExpression(new LiteralExpression("foo/"));
|
||||
template.setRemoteDirectoryExpression(new LiteralExpression("/foo/"));
|
||||
template.setUseTemporaryFileName(false);
|
||||
template.setBeanFactory(mock(BeanFactory.class));
|
||||
template.afterPropertiesSet();
|
||||
|
||||
template.execute(session -> {
|
||||
session.mkdir("foo/");
|
||||
return session.mkdir("foo/bar/");
|
||||
session.mkdir("/foo");
|
||||
return session.mkdir("/foo/bar");
|
||||
});
|
||||
template.append(new GenericMessage<>("foo"));
|
||||
template.append(new GenericMessage<>("bar"));
|
||||
@@ -93,17 +93,17 @@ public class SftpRemoteFileTemplateTests extends SftpTestSupport {
|
||||
}
|
||||
});
|
||||
template.execute((SessionCallbackWithoutResult<SftpClient.DirEntry>) session -> {
|
||||
SftpClient.DirEntry[] files = session.list("foo/");
|
||||
SftpClient.DirEntry[] files = session.list("/foo");
|
||||
assertThat(files.length).isEqualTo(4);
|
||||
assertThat(session.remove("foo/foobar.txt")).isTrue();
|
||||
assertThat(session.rmdir("foo/bar/")).isTrue();
|
||||
files = session.list("foo/");
|
||||
assertThat(session.remove("/foo/foobar.txt")).isTrue();
|
||||
assertThat(session.rmdir("/foo/bar")).isTrue();
|
||||
files = session.list("/foo");
|
||||
assertThat(files.length).isEqualTo(2);
|
||||
List<String> fileNames = Arrays.stream(files).map(SftpClient.DirEntry::getFilename).toList();
|
||||
assertThat(fileNames).contains(".", "..");
|
||||
assertThat(session.rmdir("foo/")).isTrue();
|
||||
assertThat(session.rmdir("/foo")).isTrue();
|
||||
});
|
||||
assertThat(template.exists("foo")).isFalse();
|
||||
assertThat(template.exists("/foo")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user