From 793d57fae904b1f324879f4388edad507bceb924 Mon Sep 17 00:00:00 2001 From: umjammer Date: Fri, 5 Jun 2020 18:49:37 +0900 Subject: [PATCH] make test pass --- .github/workflows/maven.yml | 2 +- .../ArchiveFileSystemProviderTest.java | 4 ++- .../GatheredFileSystemProviderTest.java | 2 ++ .../file/hfs/HfsFileSystemProviderTest.java | 4 ++- .../src/test/java/Test5.java | 26 +++++++++++++------ 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index a1a9f98d..a915866c 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -21,4 +21,4 @@ jobs: with: java-version: 1.8 - name: Build with Maven - run: mvn -B package --file pom.xml -Dmaven.test.skip=true + run: mvn -B install --file pom.xml diff --git a/vavi-nio-file-archive/src/test/java/vavi/nio/file/archive/ArchiveFileSystemProviderTest.java b/vavi-nio-file-archive/src/test/java/vavi/nio/file/archive/ArchiveFileSystemProviderTest.java index 1ca6380e..b8af8f6e 100644 --- a/vavi-nio-file-archive/src/test/java/vavi/nio/file/archive/ArchiveFileSystemProviderTest.java +++ b/vavi-nio-file-archive/src/test/java/vavi/nio/file/archive/ArchiveFileSystemProviderTest.java @@ -13,6 +13,7 @@ import java.util.Collections; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -57,8 +58,9 @@ void test2() throws Exception { } @Test + @DisabledIfEnvironmentVariable(named = "GITHUB_WORKFLOW", matches = ".*") void test3() throws Exception { - URI uri = URI.create("archive:file:/Users/nsano/src/vavi/vavi-util-archive/tmp/ugca010c.lzh"); + URI uri = URI.create("archive:file:/Users/nsano/src/vavi/vavi-util-archive/src/test/resources/test.lzh"); FileSystem fs = FileSystems.newFileSystem(uri, Collections.EMPTY_MAP); Files.list(fs.getRootDirectories().iterator().next()).forEach(System.err::println); } diff --git a/vavi-nio-file-gathered/src/test/java/vavi/nio/file/gathered/GatheredFileSystemProviderTest.java b/vavi-nio-file-gathered/src/test/java/vavi/nio/file/gathered/GatheredFileSystemProviderTest.java index 3f6a38c9..e75b95b5 100644 --- a/vavi-nio-file-gathered/src/test/java/vavi/nio/file/gathered/GatheredFileSystemProviderTest.java +++ b/vavi-nio-file-gathered/src/test/java/vavi/nio/file/gathered/GatheredFileSystemProviderTest.java @@ -18,6 +18,7 @@ import java.util.Map; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import com.github.fge.filesystem.box.provider.BoxFileSystemProvider; import com.github.fge.fs.dropbox.provider.DropBoxFileSystemProvider; @@ -126,6 +127,7 @@ private FileSystem getFileSystem(String id) throws IOException { } @Test + @DisabledIfEnvironmentVariable(named = "GITHUB_WORKFLOW", matches = ".*") void test() throws IOException { Map fileSystems = new HashMap<>(); NameMap nameMap = new NameMap(); diff --git a/vavi-nio-file-hfs/src/test/java/vavi/nio/file/hfs/HfsFileSystemProviderTest.java b/vavi-nio-file-hfs/src/test/java/vavi/nio/file/hfs/HfsFileSystemProviderTest.java index 3b5f8ecf..4862fb15 100644 --- a/vavi-nio-file-hfs/src/test/java/vavi/nio/file/hfs/HfsFileSystemProviderTest.java +++ b/vavi-nio-file-hfs/src/test/java/vavi/nio/file/hfs/HfsFileSystemProviderTest.java @@ -12,6 +12,7 @@ import java.util.Collections; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; /** @@ -23,8 +24,9 @@ class HfsFileSystemProviderTest { @Test + @DisabledIfEnvironmentVariable(named = "GITHUB_WORKFLOW", matches = ".*") void test3() throws Exception { - URI uri = URI.create("hfs:file:/Users/nsano/Downloads/Play-20170829.dmg"); + URI uri = URI.create("hfs:file:/Users/nsano/Downloads/googlechrome-80.dmg"); FileSystem fs = new HfsFileSystemProvider().newFileSystem(uri, Collections.EMPTY_MAP); Files.list(fs.getRootDirectories().iterator().next()).forEach(System.err::println); } diff --git a/vavi-nio-file-sandbox/src/test/java/Test5.java b/vavi-nio-file-sandbox/src/test/java/Test5.java index b36bf206..f40238f1 100644 --- a/vavi-nio-file-sandbox/src/test/java/Test5.java +++ b/vavi-nio-file-sandbox/src/test/java/Test5.java @@ -4,7 +4,6 @@ * Programmed by Naohide Sano */ -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -12,6 +11,8 @@ import org.cryptomator.frontend.fuse.mount.FuseMountFactory; import org.cryptomator.frontend.fuse.mount.Mount; import org.cryptomator.frontend.fuse.mount.Mounter; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /** @@ -22,19 +23,28 @@ */ public class Test5 { - /** - * @param args - */ - public static void main(String[] args) throws Exception { - Path mountPoint = Files.createTempDirectory("fuse-mount"); + // TODO doesn't work + @Test + @Disabled + public void test01() throws Exception { +// String email = System.getenv("TEST5_GOOGLE_ACCOUNT"); + String mp = System.getenv("TEST5_GOOGLE_MOUNT_POINT"); + +// URI uri = URI.create("googledrive:///?id=" + email); +// Map env = new HashMap<>(); +// env.put("ignoreAppleDouble", true); +// FileSystem fs = new GoogleDriveFileSystemProvider().newFileSystem(uri, env); +// Path remote = fs.getRootDirectories().iterator().next(); + Path remote = Paths.get("/tmp"); + + Path mountPoint = Paths.get(mp); Mounter mounter = FuseMountFactory.getMounter(); EnvironmentVariables envVars = EnvironmentVariables.create() .withFlags(mounter.defaultMountFlags()) .withMountPoint(mountPoint) .withRevealCommand("nautilus") .build(); - Path tmp = Paths.get("/tmp"); - Mount mnt = mounter.mount(tmp, envVars); + Mount mnt = mounter.mount(remote, envVars); mnt.revealInFileManager(); System.out.println("Wait for it..."); System.in.read();