update to gradle 8.7, lift to module path

This commit is contained in:
Jörg Prante 2024-04-13 19:30:30 +02:00
parent 99406c1ca4
commit b4dc1f5203
66 changed files with 266 additions and 140 deletions

View file

@ -1,7 +1,5 @@
plugins { plugins {
id "checkstyle"
id "pmd"
id 'maven-publish' id 'maven-publish'
id 'signing' id 'signing'
id "io.github.gradle-nexus.publish-plugin" version "2.0.0-rc-1" id "io.github.gradle-nexus.publish-plugin" version "2.0.0-rc-1"
@ -12,7 +10,7 @@ plugins {
wrapper { wrapper {
gradleVersion = libs.versions.gradle.get() gradleVersion = libs.versions.gradle.get()
distributionType = Wrapper.DistributionType.ALL distributionType = Wrapper.DistributionType.BIN
} }
ext { ext {
@ -31,14 +29,10 @@ ext {
} }
subprojects { subprojects {
//apply from: rootProject.file('gradle/ide/idea.gradle')
apply from: rootProject.file('gradle/repositories/maven.gradle') apply from: rootProject.file('gradle/repositories/maven.gradle')
apply from: rootProject.file('gradle/compile/java.gradle') apply from: rootProject.file('gradle/compile/java.gradle')
apply from: rootProject.file('gradle/test/junit5.gradle') apply from: rootProject.file('gradle/test/junit5.gradle')
apply from: rootProject.file('gradle/publish/maven.gradle') apply from: rootProject.file('gradle/publish/maven.gradle')
apply from: rootProject.file('gradle/quality/checkstyle.gradle')
apply from: rootProject.file('gradle/quality/pmd.gradle')
//apply from: rootProject.file('gradle/quality/spotbugs.gradle')
} }
apply from: rootProject.file('gradle/publish/sonatype.gradle') apply from: rootProject.file('gradle/publish/sonatype.gradle')
apply from: rootProject.file('gradle/publish/forgejo.gradle') apply from: rootProject.file('gradle/publish/forgejo.gradle')

View file

@ -1,8 +1,8 @@
dependencies { dependencies {
api project(':files-api') api project(':files-api')
api project(':files-ftp') api project(':files-ftp')
testImplementation libs.mockftpserver testImplementation testLibs.mockftpserver
testImplementation libs.junit.jupiter.params testImplementation testLibs.junit.jupiter.params
testImplementation libs.mockito.core testImplementation testLibs.mockito.core
testImplementation libs.mockito.junit.jupiter testImplementation testLibs.mockito.junit.jupiter
} }

View file

@ -6,6 +6,8 @@ import org.xbib.io.ftp.fs.spi.FTPFilesProvider;
module org.xbib.files.ftp.fs { module org.xbib.files.ftp.fs {
requires org.xbib.files; requires org.xbib.files;
requires org.xbib.files.ftp; requires org.xbib.files.ftp;
exports org.xbib.io.ftp.fs;
exports org.xbib.io.ftp.fs.spi;
provides FileSystemProvider with FTPFileSystemProvider; provides FileSystemProvider with FTPFileSystemProvider;
provides FileServiceProvider with FTPFilesProvider; provides FileServiceProvider with FTPFilesProvider;
} }

View file

@ -12,7 +12,7 @@ import java.util.Collection;
*/ */
public class DefaultFileSystemExceptionFactory implements FileSystemExceptionFactory { public class DefaultFileSystemExceptionFactory implements FileSystemExceptionFactory {
static final DefaultFileSystemExceptionFactory INSTANCE = new DefaultFileSystemExceptionFactory(); public static final DefaultFileSystemExceptionFactory INSTANCE = new DefaultFileSystemExceptionFactory();
@Override @Override
public FileSystemException createGetFileException(String file, int replyCode, String replyString) { public FileSystemException createGetFileException(String file, int replyCode, String replyString) {

View file

@ -48,7 +48,7 @@ import java.util.regex.Pattern;
/** /**
* An FTP file system. * An FTP file system.
*/ */
class FTPFileSystem extends FileSystem { public class FTPFileSystem extends FileSystem {
static final String CURRENT_DIR = "."; static final String CURRENT_DIR = ".";
static final String PARENT_DIR = ".."; static final String PARENT_DIR = "..";
@ -74,7 +74,7 @@ class FTPFileSystem extends FileSystem {
private final FTPFileStrategy ftpFileStrategy; private final FTPFileStrategy ftpFileStrategy;
private final AtomicBoolean open = new AtomicBoolean(true); private final AtomicBoolean open = new AtomicBoolean(true);
FTPFileSystem(FTPFileSystemProvider provider, URI uri, FTPEnvironment env) throws IOException { public FTPFileSystem(FTPFileSystemProvider provider, URI uri, FTPEnvironment env) throws IOException {
this.provider = Objects.requireNonNull(provider); this.provider = Objects.requireNonNull(provider);
this.rootDirectories = Collections.<Path>singleton(new FTPPath(this, "/")); this.rootDirectories = Collections.<Path>singleton(new FTPPath(this, "/"));
this.fileStore = new FTPFileStore(this); this.fileStore = new FTPFileStore(this);
@ -90,7 +90,7 @@ class FTPFileSystem extends FileSystem {
} }
} }
static String getFileName(FTPFile ftpFile) { public static String getFileName(FTPFile ftpFile) {
String fileName = ftpFile.getName(); String fileName = ftpFile.getName();
if (fileName == null) { if (fileName == null) {
return null; return null;
@ -172,27 +172,27 @@ class FTPFileSystem extends FileSystem {
throw Messages.unsupportedOperation(FileSystem.class, "newWatchService"); throw Messages.unsupportedOperation(FileSystem.class, "newWatchService");
} }
void keepAlive() throws IOException { public void keepAlive() throws IOException {
clientPool.keepAlive(); clientPool.keepAlive();
} }
URI toUri(FTPPath path) { public URI toUri(FTPPath path) {
FTPPath absPath = toAbsolutePath(path).normalize(); FTPPath absPath = toAbsolutePath(path).normalize();
return toUri(absPath.path()); return toUri(absPath.path());
} }
URI toUri(String path) { public URI toUri(String path) {
return URISupport.create(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), path, null, null); return URISupport.create(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), path, null, null);
} }
FTPPath toAbsolutePath(FTPPath path) { public FTPPath toAbsolutePath(FTPPath path) {
if (path.isAbsolute()) { if (path.isAbsolute()) {
return path; return path;
} }
return new FTPPath(this, defaultDirectory + "/" + path.path()); return new FTPPath(this, defaultDirectory + "/" + path.path());
} }
FTPPath toRealPath(FTPPath path, LinkOption... options) throws IOException { public FTPPath toRealPath(FTPPath path, LinkOption... options) throws IOException {
boolean followLinks = LinkOptionSupport.followLinks(options); boolean followLinks = LinkOptionSupport.followLinks(options);
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
return toRealPath(client, path, followLinks).ftpPath; return toRealPath(client, path, followLinks).ftpPath;
@ -221,7 +221,7 @@ class FTPFileSystem extends FileSystem {
return path.path(); return path.path();
} }
InputStream newInputStream(FTPPath path, OpenOption... options) throws IOException { public InputStream newInputStream(FTPPath path, OpenOption... options) throws IOException {
OpenOptions openOptions = OpenOptions.forNewInputStream(options); OpenOptions openOptions = OpenOptions.forNewInputStream(options);
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
@ -235,7 +235,7 @@ class FTPFileSystem extends FileSystem {
return client.newInputStream(path.path(), options); return client.newInputStream(path.path(), options);
} }
OutputStream newOutputStream(FTPPath path, OpenOption... options) throws IOException { public OutputStream newOutputStream(FTPPath path, OpenOption... options) throws IOException {
OpenOptions openOptions = OpenOptions.forNewOutputStream(options); OpenOptions openOptions = OpenOptions.forNewOutputStream(options);
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
@ -268,7 +268,7 @@ class FTPFileSystem extends FileSystem {
return new FTPFileAndOutputStreamPair(ftpFile, out); return new FTPFileAndOutputStreamPair(ftpFile, out);
} }
SeekableByteChannel newByteChannel(FTPPath path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException { public SeekableByteChannel newByteChannel(FTPPath path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
if (attrs.length > 0) { if (attrs.length > 0) {
throw Messages.fileSystemProvider().unsupportedCreateFileAttribute(attrs[0].name()); throw Messages.fileSystemProvider().unsupportedCreateFileAttribute(attrs[0].name());
} }
@ -292,7 +292,7 @@ class FTPFileSystem extends FileSystem {
} }
} }
DirectoryStream<Path> newDirectoryStream(final FTPPath path, Filter<? super Path> filter) throws IOException { public DirectoryStream<Path> newDirectoryStream(final FTPPath path, Filter<? super Path> filter) throws IOException {
List<FTPFile> children; List<FTPFile> children;
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
children = ftpFileStrategy.getChildren(client, path); children = ftpFileStrategy.getChildren(client, path);
@ -300,7 +300,7 @@ class FTPFileSystem extends FileSystem {
return new FTPPathDirectoryStream(path, children, filter); return new FTPPathDirectoryStream(path, children, filter);
} }
void createDirectory(FTPPath path, FileAttribute<?>... attrs) throws IOException { public void createDirectory(FTPPath path, FileAttribute<?>... attrs) throws IOException {
if (attrs.length > 0) { if (attrs.length > 0) {
throw Messages.fileSystemProvider().unsupportedCreateFileAttribute(attrs[0].name()); throw Messages.fileSystemProvider().unsupportedCreateFileAttribute(attrs[0].name());
} }
@ -309,7 +309,7 @@ class FTPFileSystem extends FileSystem {
} }
} }
void delete(FTPPath path) throws IOException { public void delete(FTPPath path) throws IOException {
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
FTPFile ftpFile = getFTPFile(client, path); FTPFile ftpFile = getFTPFile(client, path);
boolean isDirectory = ftpFile.isDirectory(); boolean isDirectory = ftpFile.isDirectory();
@ -317,7 +317,7 @@ class FTPFileSystem extends FileSystem {
} }
} }
FTPPath readSymbolicLink(FTPPath path) throws IOException { public FTPPath readSymbolicLink(FTPPath path) throws IOException {
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
FTPFile ftpFile = getFTPFile(client, path); FTPFile ftpFile = getFTPFile(client, path);
FTPFile link = getLink(client, ftpFile, path); FTPFile link = getLink(client, ftpFile, path);
@ -328,7 +328,7 @@ class FTPFileSystem extends FileSystem {
} }
} }
void copy(FTPPath source, FTPPath target, CopyOption... options) throws IOException { public void copy(FTPPath source, FTPPath target, CopyOption... options) throws IOException {
boolean sameFileSystem = source.getFileSystem() == target.getFileSystem(); boolean sameFileSystem = source.getFileSystem() == target.getFileSystem();
CopyOptions copyOptions = CopyOptions.forCopy(options); CopyOptions copyOptions = CopyOptions.forCopy(options);
@ -403,7 +403,7 @@ class FTPFileSystem extends FileSystem {
} }
} }
void move(FTPPath source, FTPPath target, CopyOption... options) throws IOException { public void move(FTPPath source, FTPPath target, CopyOption... options) throws IOException {
boolean sameFileSystem = source.getFileSystem() == target.getFileSystem(); boolean sameFileSystem = source.getFileSystem() == target.getFileSystem();
CopyOptions copyOptions = CopyOptions.forMove(sameFileSystem, options); CopyOptions copyOptions = CopyOptions.forMove(sameFileSystem, options);
@ -444,7 +444,7 @@ class FTPFileSystem extends FileSystem {
} }
} }
boolean isSameFile(FTPPath path, FTPPath path2) throws IOException { public boolean isSameFile(FTPPath path, FTPPath path2) throws IOException {
if (path.getFileSystem() != path2.getFileSystem()) { if (path.getFileSystem() != path2.getFileSystem()) {
return false; return false;
} }
@ -463,7 +463,7 @@ class FTPFileSystem extends FileSystem {
return toRealPath(client, path, true).ftpPath.path().equals(toRealPath(client, path2, true).ftpPath.path()); return toRealPath(client, path, true).ftpPath.path().equals(toRealPath(client, path2, true).ftpPath.path());
} }
boolean isHidden(FTPPath path) throws IOException { public boolean isHidden(FTPPath path) throws IOException {
// call getFTPFile to check for existence // call getFTPFile to check for existence
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
getFTPFile(client, path); getFTPFile(client, path);
@ -472,7 +472,7 @@ class FTPFileSystem extends FileSystem {
return !CURRENT_DIR.equals(fileName) && !PARENT_DIR.equals(fileName) && fileName.startsWith("."); return !CURRENT_DIR.equals(fileName) && !PARENT_DIR.equals(fileName) && fileName.startsWith(".");
} }
FileStore getFileStore(FTPPath path) throws IOException { public FileStore getFileStore(FTPPath path) throws IOException {
// call getFTPFile to check existence of the path // call getFTPFile to check existence of the path
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
getFTPFile(client, path); getFTPFile(client, path);
@ -480,7 +480,7 @@ class FTPFileSystem extends FileSystem {
return fileStore; return fileStore;
} }
void checkAccess(FTPPath path, AccessMode... modes) throws IOException { public void checkAccess(FTPPath path, AccessMode... modes) throws IOException {
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
FTPFile ftpFile = getFTPFile(client, path); FTPFile ftpFile = getFTPFile(client, path);
for (AccessMode mode : modes) { for (AccessMode mode : modes) {
@ -504,7 +504,7 @@ class FTPFileSystem extends FileSystem {
} }
} }
PosixFileAttributes readAttributes(FTPPath path, LinkOption... options) throws IOException { public PosixFileAttributes readAttributes(FTPPath path, LinkOption... options) throws IOException {
boolean followLinks = LinkOptionSupport.followLinks(options); boolean followLinks = LinkOptionSupport.followLinks(options);
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
FTPPathAndFilePair pair = toRealPath(client, path, followLinks); FTPPathAndFilePair pair = toRealPath(client, path, followLinks);
@ -515,7 +515,7 @@ class FTPFileSystem extends FileSystem {
} }
} }
Map<String, Object> readAttributes(FTPPath path, String attributes, LinkOption... options) throws IOException { public Map<String, Object> readAttributes(FTPPath path, String attributes, LinkOption... options) throws IOException {
String view; String view;
int pos = attributes.indexOf(':'); int pos = attributes.indexOf(':');
if (pos == -1) { if (pos == -1) {
@ -622,7 +622,7 @@ class FTPFileSystem extends FileSystem {
return result; return result;
} }
FTPFile getFTPFile(FTPPath path) throws IOException { public FTPFile getFTPFile(FTPPath path) throws IOException {
try (FTPClientPool.Client client = clientPool.get()) { try (FTPClientPool.Client client = clientPool.get()) {
return getFTPFile(client, path); return getFTPFile(client, path);
} }

View file

@ -6,11 +6,10 @@ import java.util.ResourceBundle;
/** /**
* A utility class for providing translated messages and exceptions. * A utility class for providing translated messages and exceptions.
*/ */
final class FTPMessages { public final class FTPMessages {
private static final String BUNDLE_NAME = "org.xbib.ftp.fs.messages"; private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.xbib.ftp.fs.messages",
Locale.ROOT, UTF8Control.INSTANCE);
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, Locale.ROOT, UTF8Control.INSTANCE);
private FTPMessages() { private FTPMessages() {
throw new Error("cannot create instances of " + getClass().getName()); throw new Error("cannot create instances of " + getClass().getName());

View file

@ -26,11 +26,11 @@ import java.util.Set;
/** /**
* A path for FTP file systems. * A path for FTP file systems.
*/ */
class FTPPath extends SimpleAbstractPath { public class FTPPath extends SimpleAbstractPath {
private final FTPFileSystem fs; private final FTPFileSystem fs;
FTPPath(FTPFileSystem fs, String path) { public FTPPath(FTPFileSystem fs, String path) {
super(path); super(path);
this.fs = Objects.requireNonNull(fs); this.fs = Objects.requireNonNull(fs);
} }

View file

@ -0,0 +1,13 @@
module org.xbib.files.ftp.fs.test {
requires MockFtpServer;
requires org.hamcrest;
requires org.junit.jupiter.api;
requires org.junit.jupiter.params;
requires org.mockito;
requires org.xbib.files.ftp;
requires org.xbib.files.ftp.fs;
exports org.xbib.io.ftp.fs.test;
exports org.xbib.io.ftp.fs.test.server;
opens org.xbib.io.ftp.fs.test to org.junit.platform.commons;
opens org.xbib.io.ftp.fs.test.server to org.junit.platform.commons;
}

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs; package org.xbib.io.ftp.fs.test;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
@ -12,10 +12,16 @@ import org.mockftpserver.fake.filesystem.FileSystem;
import org.mockftpserver.fake.filesystem.FileSystemEntry; import org.mockftpserver.fake.filesystem.FileSystemEntry;
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; import org.mockftpserver.fake.filesystem.UnixFakeFileSystem;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.xbib.io.ftp.fs.server.ExtendedUnixFakeFileSystem; import org.xbib.io.ftp.fs.DefaultFileSystemExceptionFactory;
import org.xbib.io.ftp.fs.server.ListHiddenFilesCommandHandler; import org.xbib.io.ftp.fs.FTPEnvironment;
import org.xbib.io.ftp.fs.server.MDTMCommandHandler; import org.xbib.io.ftp.fs.FTPFileSystem;
import org.xbib.io.ftp.fs.server.SymbolicLinkEntry; import org.xbib.io.ftp.fs.FTPFileSystemProvider;
import org.xbib.io.ftp.fs.FTPPath;
import org.xbib.io.ftp.fs.FileSystemExceptionFactory;
import org.xbib.io.ftp.fs.test.server.ExtendedUnixFakeFileSystem;
import org.xbib.io.ftp.fs.test.server.ListHiddenFilesCommandHandler;
import org.xbib.io.ftp.fs.test.server.MDTMCommandHandler;
import org.xbib.io.ftp.fs.test.server.SymbolicLinkEntry;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs; package org.xbib.io.ftp.fs.test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
@ -16,6 +16,9 @@ import java.net.Proxy;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Collections; import java.util.Collections;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.xbib.io.ftp.fs.ConnectionMode;
import org.xbib.io.ftp.fs.DefaultFileSystemExceptionFactory;
import org.xbib.io.ftp.fs.FTPEnvironment;
public class FTPEnvironmentSetterTest { public class FTPEnvironmentSetterTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs; package org.xbib.io.ftp.fs.test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -8,6 +8,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.xbib.io.ftp.fs.FTPEnvironment;
public class FTPEnvironmentTest { public class FTPEnvironmentTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs; package org.xbib.io.ftp.fs.test;
import org.hamcrest.Description; import org.hamcrest.Description;
import org.hamcrest.Matcher; import org.hamcrest.Matcher;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs; package org.xbib.io.ftp.fs.test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs; package org.xbib.io.ftp.fs.test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs; package org.xbib.io.ftp.fs.test;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -18,6 +18,11 @@ import java.nio.file.attribute.PosixFileAttributeView;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import org.xbib.io.ftp.fs.FTPFileSystem;
import org.xbib.io.ftp.fs.FTPFileSystemProvider;
import org.xbib.io.ftp.fs.FTPPath;
import org.xbib.io.ftp.fs.FileType;
import org.xbib.io.ftp.fs.URISupport;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.instanceOf;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs; package org.xbib.io.ftp.fs.test;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -7,7 +7,12 @@ import org.mockftpserver.fake.filesystem.FileEntry;
import org.mockftpserver.fake.filesystem.FileSystemEntry; import org.mockftpserver.fake.filesystem.FileSystemEntry;
import org.mockito.verification.VerificationMode; import org.mockito.verification.VerificationMode;
import org.xbib.io.ftp.client.FTPFile; import org.xbib.io.ftp.client.FTPFile;
import org.xbib.io.ftp.fs.server.SymbolicLinkEntry; import org.xbib.io.ftp.fs.FTPFileSystem;
import org.xbib.io.ftp.fs.FTPFileSystemException;
import org.xbib.io.ftp.fs.FTPPath;
import org.xbib.io.ftp.fs.SimpleGroupPrincipal;
import org.xbib.io.ftp.fs.SimpleUserPrincipal;
import org.xbib.io.ftp.fs.test.server.SymbolicLinkEntry;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs; package org.xbib.io.ftp.fs.test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.Arguments;
@ -19,6 +19,7 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.xbib.io.ftp.fs.FTPMessages;
public class FTPMessagesTest { public class FTPMessagesTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs.server; package org.xbib.io.ftp.fs.test.server;
import org.mockftpserver.fake.filesystem.FileSystemEntry; import org.mockftpserver.fake.filesystem.FileSystemEntry;
import org.mockftpserver.fake.filesystem.UnixDirectoryListingFormatter; import org.mockftpserver.fake.filesystem.UnixDirectoryListingFormatter;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs.server; package org.xbib.io.ftp.fs.test.server;
import org.mockftpserver.fake.filesystem.FileSystemEntry; import org.mockftpserver.fake.filesystem.FileSystemEntry;
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; import org.mockftpserver.fake.filesystem.UnixFakeFileSystem;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs.server; package org.xbib.io.ftp.fs.test.server;
import org.mockftpserver.core.command.Command; import org.mockftpserver.core.command.Command;
import org.mockftpserver.core.command.ReplyCodes; import org.mockftpserver.core.command.ReplyCodes;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs.server; package org.xbib.io.ftp.fs.test.server;
import org.mockftpserver.core.command.Command; import org.mockftpserver.core.command.Command;
import org.mockftpserver.core.command.ReplyCodes; import org.mockftpserver.core.command.ReplyCodes;

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.fs.server; package org.xbib.io.ftp.fs.test.server;
import org.mockftpserver.fake.filesystem.FileSystemEntry; import org.mockftpserver.fake.filesystem.FileSystemEntry;
import org.mockftpserver.fake.filesystem.Permissions; import org.mockftpserver.fake.filesystem.Permissions;

View file

View file

@ -427,8 +427,7 @@ public class FTPClient extends FTP implements Configurable {
* or the full string after the reply code and space if the syntax is invalid * or the full string after the reply code and space if the syntax is invalid
* (i.e. enclosing quotes are missing or embedded quotes are not doubled) * (i.e. enclosing quotes are missing or embedded quotes are not doubled)
*/ */
// package protected for access by test cases public static String __parsePathname(String reply) {
static String __parsePathname(String reply) {
String param = reply.substring(REPLY_CODE_LEN + 1); String param = reply.substring(REPLY_CODE_LEN + 1);
if (param.startsWith("\"")) { if (param.startsWith("\"")) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -479,7 +478,7 @@ public class FTPClient extends FTP implements Configurable {
* @param reply the reply to parse * @param reply the reply to parse
* @throws MalformedServerReplyException if the server reply does not match (n,n,n,n),(n),(n) * @throws MalformedServerReplyException if the server reply does not match (n,n,n,n),(n),(n)
*/ */
protected void _parsePassiveModeReply(String reply) public void _parsePassiveModeReply(String reply)
throws MalformedServerReplyException { throws MalformedServerReplyException {
java.util.regex.Matcher m = __PARMS_PAT.matcher(reply); java.util.regex.Matcher m = __PARMS_PAT.matcher(reply);
if (!m.find()) { if (!m.find()) {
@ -2951,7 +2950,7 @@ public class FTPClient extends FTP implements Configurable {
return initiateListParsing(fileEntryParser, pathname); return initiateListParsing(fileEntryParser, pathname);
} }
void createParser(String parserKey) throws IOException { public void createParser(String parserKey) throws IOException {
// We cache the value to avoid creation of a new object every // We cache the value to avoid creation of a new object every
// time a file listing is generated. // time a file listing is generated.
// Note: we don't check against a null parserKey (NET-544) // Note: we don't check against a null parserKey (NET-544)
@ -2996,7 +2995,7 @@ public class FTPClient extends FTP implements Configurable {
} }
} }
FTPFileEntryParser getFileEntryParser() { public FTPFileEntryParser getFileEntryParser() {
return fileEntryParser; return fileEntryParser;
} }

View file

@ -70,7 +70,7 @@ public class FTPListParseEngine {
* Intended for use by FTPClient only * Intended for use by FTPClient only
* *
*/ */
FTPListParseEngine(FTPFileEntryParser parser, FTPClientConfig configuration) { public FTPListParseEngine(FTPFileEntryParser parser, FTPClientConfig configuration) {
this.parser = parser; this.parser = parser;
if (configuration != null) { if (configuration != null) {
this.saveUnparseableEntries = configuration.getUnparseableEntries(); this.saveUnparseableEntries = configuration.getUnparseableEntries();

View file

@ -367,14 +367,14 @@ public class FTPTimestampParserImpl implements Configurable {
/** /**
* @return Returns the lenientFutureDates. * @return Returns the lenientFutureDates.
*/ */
boolean isLenientFutureDates() { public boolean isLenientFutureDates() {
return lenientFutureDates; return lenientFutureDates;
} }
/** /**
* @param lenientFutureDates The lenientFutureDates to set. * @param lenientFutureDates The lenientFutureDates to set.
*/ */
void setLenientFutureDates(boolean lenientFutureDates) { public void setLenientFutureDates(boolean lenientFutureDates) {
this.lenientFutureDates = lenientFutureDates; this.lenientFutureDates = lenientFutureDates;
} }
} }

View file

@ -15,17 +15,17 @@ import java.util.List;
*/ */
public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
static final int UNKNOWN_LIST_TYPE = -1; public static final int UNKNOWN_LIST_TYPE = -1;
static final int FILE_LIST_TYPE = 0; public static final int FILE_LIST_TYPE = 0;
static final int MEMBER_LIST_TYPE = 1; public static final int MEMBER_LIST_TYPE = 1;
static final int UNIX_LIST_TYPE = 2; public static final int UNIX_LIST_TYPE = 2;
static final int JES_LEVEL_1_LIST_TYPE = 3; public static final int JES_LEVEL_1_LIST_TYPE = 3;
static final int JES_LEVEL_2_LIST_TYPE = 4; public static final int JES_LEVEL_2_LIST_TYPE = 4;
/** /**
* Dates are ignored for file lists, but are used for member lists where * Dates are ignored for file lists, but are used for member lists where
* possible * possible
*/ */
static final String DEFAULT_DATE_FORMAT = "yyyy/MM/dd HH:mm"; // 2001/09/18 public static final String DEFAULT_DATE_FORMAT = "yyyy/MM/dd HH:mm"; // 2001/09/18
/** /**
* Matches these entries: * Matches these entries:
* <pre> * <pre>
@ -33,7 +33,7 @@ public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
* B10142 3390 2006/03/20 2 31 F 80 80 PS MDI.OKL.WORK * B10142 3390 2006/03/20 2 31 F 80 80 PS MDI.OKL.WORK
* </pre> * </pre>
*/ */
static final String FILE_LIST_REGEX = "\\S+\\s+" + // volume public static final String FILE_LIST_REGEX = "\\S+\\s+" + // volume
// ignored // ignored
"\\S+\\s+" + // unit - ignored "\\S+\\s+" + // unit - ignored
"\\S+\\s+" + // access date - ignored "\\S+\\s+" + // access date - ignored
@ -53,7 +53,7 @@ public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
* TBSHELF 01.03 2002/09/12 2002/10/11 09:37 11 11 0 KIL001 * TBSHELF 01.03 2002/09/12 2002/10/11 09:37 11 11 0 KIL001
* </pre> * </pre>
*/ */
static final String MEMBER_LIST_REGEX = "(\\S+)\\s+" + // name public static final String MEMBER_LIST_REGEX = "(\\S+)\\s+" + // name
"\\S+\\s+" + // version, modification (ignored) "\\S+\\s+" + // version, modification (ignored)
"\\S+\\s+" + // create date (ignored) "\\S+\\s+" + // create date (ignored)
"(\\S+)\\s+" + // modification date "(\\S+)\\s+" + // modification date
@ -71,7 +71,7 @@ public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
* 1 2 3 4 * 1 2 3 4
* </pre> * </pre>
*/ */
static final String JES_LEVEL_1_LIST_REGEX = public static final String JES_LEVEL_1_LIST_REGEX =
"(\\S+)\\s+" + // job name ignored "(\\S+)\\s+" + // job name ignored
"(\\S+)\\s+" + // job number "(\\S+)\\s+" + // job number
"(\\S+)\\s+" + // job status (OUTPUT,INPUT,ACTIVE) "(\\S+)\\s+" + // job status (OUTPUT,INPUT,ACTIVE)
@ -113,7 +113,7 @@ public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
* </pre> * </pre>
*/ */
static final String JES_LEVEL_2_LIST_REGEX = public static final String JES_LEVEL_2_LIST_REGEX =
"(\\S+)\\s+" + // job name ignored "(\\S+)\\s+" + // job name ignored
"(\\S+)\\s+" + // job number "(\\S+)\\s+" + // job number
"(\\S+)\\s+" + // owner ignored "(\\S+)\\s+" + // owner ignored
@ -472,7 +472,7 @@ public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
* *
* @param type The listing type. * @param type The listing type.
*/ */
void setType(int type) { public void setType(int type) {
isType = type; isType = type;
} }

View file

@ -122,7 +122,7 @@ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
// if true, leading spaces are trimmed from file names // if true, leading spaces are trimmed from file names
// this was the case for the original implementation // this was the case for the original implementation
final boolean trimLeadingSpaces; // package protected for access from test code public final boolean trimLeadingSpaces; // package protected for access from test code
/** /**
* The default constructor for a UnixFTPEntryParser object. * The default constructor for a UnixFTPEntryParser object.

View file

@ -0,0 +1,7 @@
module org.xbib.files.ftp.test {
requires org.junit.jupiter.api;
requires org.xbib.files.ftp;
exports org.xbib.io.ftp.client.test;
opens org.xbib.io.ftp.client.test to org.junit.platform.commons;
opens org.xbib.io.ftp.client.test.parser to org.junit.platform.commons;
}

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client; package org.xbib.io.ftp.client.test;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@ -9,6 +9,9 @@ import java.time.ZonedDateTime;
import java.util.Comparator; import java.util.Comparator;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import org.xbib.io.ftp.client.FTPClient;
import org.xbib.io.ftp.client.FTPClientConfig;
import org.xbib.io.ftp.client.FTPFile;
/* /*
* This test was contributed in a different form by W. McDonald Buck * This test was contributed in a different form by W. McDonald Buck

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client; package org.xbib.io.ftp.client.test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
@ -9,6 +9,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import org.xbib.io.ftp.client.FTPClientConfig;
public class FTPClientConfigTest { public class FTPClientConfigTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client; package org.xbib.io.ftp.client.test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -10,7 +10,13 @@ import java.io.ByteArrayOutputStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.io.ftp.client.FTPClient;
import org.xbib.io.ftp.client.FTPClientConfig;
import org.xbib.io.ftp.client.FTPFile;
import org.xbib.io.ftp.client.FTPFileEntryParser;
import org.xbib.io.ftp.client.FTPListParseEngine;
import org.xbib.io.ftp.client.parser.UnixFTPEntryParser; import org.xbib.io.ftp.client.parser.UnixFTPEntryParser;
public class FTPClientTest { public class FTPClientTest {
@ -44,7 +50,7 @@ public class FTPClientTest {
@Test @Test
public void testParseClient() { public void testParseClient() {
for(int i = 0; i < TESTS.length; i += 2) { for(int i = 0; i < TESTS.length; i += 2) {
assertEquals(TESTS[i+1], FTPClient.__parsePathname(TESTS[i]), "Failed to parse"); Assertions.assertEquals(TESTS[i+1], FTPClient.__parsePathname(TESTS[i]), "Failed to parse");
} }
} }

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client; package org.xbib.io.ftp.client.test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -11,6 +11,10 @@ import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.xbib.io.ftp.client.FTPClient;
import org.xbib.io.ftp.client.FTPClientConfig;
import org.xbib.io.ftp.client.FTPFile;
import org.xbib.io.ftp.client.FTPListParseEngine;
/** /**
* A functional test suite for checking that site listings work. * A functional test suite for checking that site listings work.

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client; package org.xbib.io.ftp.client.test;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@ -8,6 +8,7 @@ import java.net.ConnectException;
import java.net.SocketException; import java.net.SocketException;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import org.xbib.io.ftp.client.FTPClient;
public class TestConnectTimeout { public class TestConnectTimeout {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -8,6 +8,18 @@ import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.io.ftp.client.FTPClientConfig; import org.xbib.io.ftp.client.FTPClientConfig;
import org.xbib.io.ftp.client.FTPFileEntryParser; import org.xbib.io.ftp.client.FTPFileEntryParser;
import org.xbib.io.ftp.client.parser.CompositeFileEntryParser;
import org.xbib.io.ftp.client.parser.DefaultFTPFileEntryParserFactory;
import org.xbib.io.ftp.client.parser.FTPFileEntryParserFactory;
import org.xbib.io.ftp.client.parser.MVSFTPEntryParser;
import org.xbib.io.ftp.client.parser.MacOsPeterFTPEntryParser;
import org.xbib.io.ftp.client.parser.NTFTPEntryParser;
import org.xbib.io.ftp.client.parser.NetwareFTPEntryParser;
import org.xbib.io.ftp.client.parser.OS2FTPEntryParser;
import org.xbib.io.ftp.client.parser.OS400FTPEntryParser;
import org.xbib.io.ftp.client.parser.ParserInitializationException;
import org.xbib.io.ftp.client.parser.UnixFTPEntryParser;
import org.xbib.io.ftp.client.parser.VMSFTPEntryParser;
public class DefaultFTPFileEntryParserFactoryTest { public class DefaultFTPFileEntryParserFactoryTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -13,6 +13,7 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.EnumSet; import java.util.EnumSet;
import org.xbib.io.ftp.client.parser.EnterpriseUnixFTPEntryParser;
/** /**
* Tests the EnterpriseUnixFTPEntryParser * Tests the EnterpriseUnixFTPEntryParser

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -10,6 +10,7 @@ import org.xbib.io.ftp.client.FTPFile;
import java.time.Year; import java.time.Year;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import org.xbib.io.ftp.client.parser.UnixFTPEntryParser;
/** /**
* This is a simple TestCase that tests entry parsing using the new FTPClientConfig * This is a simple TestCase that tests entry parsing using the new FTPClientConfig

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@ -13,6 +13,8 @@ import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.Locale; import java.util.Locale;
import java.util.TimeZone; import java.util.TimeZone;
import org.xbib.io.ftp.client.parser.FTPTimestampParser;
import org.xbib.io.ftp.client.parser.FTPTimestampParserImpl;
/** /**
* Test the FTPTimestampParser class. * Test the FTPTimestampParser class.

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.io.ftp.client.FTP; import org.xbib.io.ftp.client.FTP;
@ -13,6 +13,8 @@ import java.io.InputStream;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import org.xbib.io.ftp.client.parser.MLSxEntryParser;
import org.xbib.io.ftp.client.parser.UnixFTPEntryParser;
/** /**
* Attempt comparison of LIST and MLSD listings * Attempt comparison of LIST and MLSD listings

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
@ -9,6 +9,7 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.EnumSet; import java.util.EnumSet;
import org.xbib.io.ftp.client.parser.MLSxEntryParser;
public class MLSxEntryParserTest { public class MLSxEntryParserTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -10,6 +10,7 @@ import java.time.format.DateTimeParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.xbib.io.ftp.client.parser.MVSFTPEntryParser;
public class MVSFTPEntryParserTest { public class MVSFTPEntryParserTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -14,6 +14,7 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.EnumSet; import java.util.EnumSet;
import org.xbib.io.ftp.client.parser.MacOsPeterFTPEntryParser;
public class MacOsPeterFTPEntryParserTest { public class MacOsPeterFTPEntryParserTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -17,6 +17,9 @@ import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Locale; import java.util.Locale;
import org.xbib.io.ftp.client.parser.CompositeFileEntryParser;
import org.xbib.io.ftp.client.parser.NTFTPEntryParser;
import org.xbib.io.ftp.client.parser.UnixFTPEntryParser;
@Disabled @Disabled
public class NTFTPEntryParserTest { public class NTFTPEntryParserTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -14,6 +14,7 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.EnumSet; import java.util.EnumSet;
import org.xbib.io.ftp.client.parser.NetwareFTPEntryParser;
public class NetwareFTPEntryParserTest { public class NetwareFTPEntryParserTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -13,6 +13,8 @@ import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Locale; import java.util.Locale;
import org.xbib.io.ftp.client.parser.ConfigurableFTPFileEntryParserImpl;
import org.xbib.io.ftp.client.parser.OS2FTPEntryParser;
public class OS2FTPEntryParserTest { public class OS2FTPEntryParserTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -12,6 +12,9 @@ import java.time.Month;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import org.xbib.io.ftp.client.parser.CompositeFileEntryParser;
import org.xbib.io.ftp.client.parser.OS400FTPEntryParser;
import org.xbib.io.ftp.client.parser.UnixFTPEntryParser;
public class OS400FTPEntryParserAdditionalTest { public class OS400FTPEntryParserAdditionalTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -16,6 +16,9 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.EnumSet; import java.util.EnumSet;
import org.xbib.io.ftp.client.parser.CompositeFileEntryParser;
import org.xbib.io.ftp.client.parser.OS400FTPEntryParser;
import org.xbib.io.ftp.client.parser.UnixFTPEntryParser;
public class OS400FTPEntryParserTest { public class OS400FTPEntryParserTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -13,6 +13,7 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.EnumSet; import java.util.EnumSet;
import org.xbib.io.ftp.client.parser.UnixFTPEntryParser;
public class UnixFTPEntryParserTest { public class UnixFTPEntryParserTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -14,6 +14,9 @@ import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.util.Locale; import java.util.Locale;
import org.xbib.io.ftp.client.parser.ConfigurableFTPFileEntryParserImpl;
import org.xbib.io.ftp.client.parser.VMSFTPEntryParser;
import org.xbib.io.ftp.client.parser.VMSVersioningFTPEntryParser;
public class VMSFTPEntryParserTest { public class VMSFTPEntryParserTest {

View file

@ -1,4 +1,4 @@
package org.xbib.io.ftp.client.parser; package org.xbib.io.ftp.client.test.parser;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

7
files-sftp-fs/NOTICE.txt Normal file
View file

@ -0,0 +1,7 @@
This work is build upon Apache MINA SSHD
as forked of 29 Nov 2021 (Version 2.6.0)
License: Apache License 2.0
https://github.com/apache/mina-sshd

View file

@ -1,5 +1,5 @@
import org.apache.sshd.fs.SftpFileSystemProvider;
import java.nio.file.spi.FileSystemProvider; import java.nio.file.spi.FileSystemProvider;
import org.apache.sshd.fs.SftpFileSystemProvider;
import org.xbib.files.FileServiceProvider; import org.xbib.files.FileServiceProvider;
import org.apache.sshd.fs.spi.SFTPFileServiceProvider; import org.apache.sshd.fs.spi.SFTPFileServiceProvider;

View file

@ -0,0 +1,10 @@
module org.xbib.files.sftp.fs.test {
requires java.logging;
requires org.junit.jupiter.api;
requires org.xbib.files;
requires org.xbib.files.sftp;
requires org.xbib.files.sftp.fs;
requires org.xbib.net.security;
exports org.apache.sshd.fs.test;
opens org.apache.sshd.fs.test to org.junit.platform.commons;
}

7
files-sftp/NOTICE.txt Normal file
View file

@ -0,0 +1,7 @@
This work is build upon Apache MINA SSHD
as forked of 29 Nov 2021 (Version 2.6.0)
License: Apache License 2.0
https://github.com/apache/mina-sshd

View file

@ -81,4 +81,5 @@ module org.xbib.files.sftp {
exports org.apache.sshd.common.util.threads; exports org.apache.sshd.common.util.threads;
requires org.xbib.net.security; requires org.xbib.net.security;
requires java.logging; requires java.logging;
uses org.apache.sshd.common.io.IoServiceFactoryFactory;
} }

View file

@ -62,7 +62,6 @@ public class DefaultIoServiceFactoryFactory extends AbstractIoServiceFactoryFact
factory = newInstance(IoServiceFactoryFactory.class); factory = newInstance(IoServiceFactoryFactory.class);
if (factory == null) { if (factory == null) {
factory = BuiltinIoServiceFactoryFactories.NIO2.create(); factory = BuiltinIoServiceFactoryFactories.NIO2.create();
} else {
} }
Factory<CloseableExecutorService> executorServiceFactory = getExecutorServiceFactory(); Factory<CloseableExecutorService> executorServiceFactory = getExecutorServiceFactory();

View file

@ -1,5 +1,3 @@
group = org.xbib group = org.xbib
name = files name = files
version = 4.2.1 version = 4.3.0
org.gradle.warning.mode = ALL

View file

@ -1,4 +1,3 @@
apply plugin: 'java-library' apply plugin: 'java-library'
java { java {
@ -14,16 +13,33 @@ jar {
manifest { manifest {
attributes('Implementation-Version': project.version) attributes('Implementation-Version': project.version)
} }
duplicatesStrategy = DuplicatesStrategy.INCLUDE
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile).configureEach {
options.fork = true doFirst {
options.forkOptions.jvmArgs += ['-Duser.language=en','-Duser.country=US'] options.fork = true
options.compilerArgs.add('-Xlint:all') options.forkOptions.jvmArgs += ['-Duser.language=en', '-Duser.country=US']
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
options.compilerArgs.add('-Xlint:all')
// enforce presence of module-info.java
options.compilerArgs.add("--module-path")
options.compilerArgs.add(classpath.asPath)
classpath = files()
}
} }
tasks.withType(Javadoc) { tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet') doFirst {
options.encoding = 'UTF-8' options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = 'UTF-8'
}
}
tasks.withType(JavaExec).configureEach {
doFirst {
jvmArguments.add("--module-path")
jvmArguments.add(classpath.asPath)
classpath = files()
}
} }

View file

@ -1,8 +1,8 @@
dependencies { dependencies {
testImplementation libs.junit.jupiter.api testImplementation testLibs.junit.jupiter.api
testImplementation libs.junit.jupiter.params testImplementation testLibs.hamcrest
testImplementation libs.hamcrest testRuntimeOnly testLibs.junit.jupiter.engine
testRuntimeOnly libs.junit.jupiter.engine testRuntimeOnly testLibs.junit.jupiter.platform.launcher
} }
test { test {

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

20
gradlew.bat vendored
View file

@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail

View file

@ -15,17 +15,19 @@ pluginManagement {
dependencyResolutionManagement { dependencyResolutionManagement {
versionCatalogs { versionCatalogs {
libs { libs {
version('gradle', '8.4') version('gradle', '8.7')
version('groovy', '4.0.12') version('net', '4.3.1')
version('junit', '5.10.0') library('net-security', 'org.xbib', 'net-security').versionRef('net')
version('net', '4.0.0') }
testLibs {
version('junit', '5.10.2')
library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit') library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit')
library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit') library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit')
library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit') library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit')
library('junit-vintage-engine', 'org.junit.vintage', 'junit-vintage-engine').versionRef('junit') library('junit-vintage-engine', 'org.junit.vintage', 'junit-vintage-engine').versionRef('junit')
library('junit-jupiter-platform-launcher', 'org.junit.platform', 'junit-platform-launcher').version('1.10.1')
library('hamcrest', 'org.hamcrest', 'hamcrest-library').version('2.2') library('hamcrest', 'org.hamcrest', 'hamcrest-library').version('2.2')
library('junit4', 'junit', 'junit').version('4.13.2') library('junit4', 'junit', 'junit').version('4.13.2')
library('net-security', 'org.xbib', 'net-security').versionRef('net')
library('mockftpserver', 'org.mockftpserver', 'MockFtpServer').version('2.7.1') library('mockftpserver', 'org.mockftpserver', 'MockFtpServer').version('2.7.1')
library('mockito-core', 'org.mockito', 'mockito-core').version('5.6.0') library('mockito-core', 'org.mockito', 'mockito-core').version('5.6.0')
library('mockito-junit-jupiter', 'org.mockito', 'mockito-junit-jupiter').version('5.6.0') library('mockito-junit-jupiter', 'org.mockito', 'mockito-junit-jupiter').version('5.6.0')
@ -34,7 +36,6 @@ dependencyResolutionManagement {
} }
include 'files-api' include 'files-api'
include 'files-zlib'
include 'files-ftp' include 'files-ftp'
include 'files-ftp-fs' include 'files-ftp-fs'
include 'files-sftp' include 'files-sftp'