Skip to content

Commit

Permalink
Upgrade to SSHD 2.9.3
Browse files Browse the repository at this point in the history
* Fix `SftpRemoteFileTemplateTests` according to new SSHD requirements (restrictions?)
  • Loading branch information
artembilan committed Feb 17, 2024
1 parent e21de19 commit 0630709
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -71,14 +71,14 @@ public void testINT3412AppendStatRmdir() {
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"));
Expand All @@ -93,17 +93,17 @@ public void testINT3412AppendStatRmdir() {
}
});
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
Expand Down

0 comments on commit 0630709

Please sign in to comment.