@Test public void testGetComplexPathFileSystemNameIncludedInPath() { final URI newRepo = URI.create("default://default-new-complex-get-repo-name"); FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); final Path path = provider.getPath(URI.create("default://origin/master@default-new-complex-get-repo-name/home/default-new-complex-get-repo-name/somefolder")); assertThat(path).isNotNull(); assertThat(path.getRoot().toString()).isEqualTo("/"); assertThat(path.toString()).isEqualTo("/home/default-new-complex-get-repo-name/somefolder"); assertThat(path.toUri().getScheme()).isEqualTo("default"); fs.close(); } }
@Test public void testGetComplexPathFileSystemNameIncludedInPath() { final URI newRepo = URI.create("default://default-new-complex-get-repo-name"); FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); final Path path = provider.getPath(URI.create("default://origin/master@default-new-complex-get-repo-name/home/default-new-complex-get-repo-name/somefolder")); assertThat(path).isNotNull(); assertThat(path.getRoot().toString()).isEqualTo("/"); assertThat(path.toString()).isEqualTo("/home/default-new-complex-get-repo-name/somefolder"); assertThat(path.toUri().getScheme()).isEqualTo("default"); fs.close(); } }
private boolean deleteFS(final FileSystem fileSystem) { final File gitDir = ((JGitFileSystemImpl) fileSystem).getGit().getRepository().getDirectory(); fileSystem.close(); fileSystem.dispose(); try { if (System.getProperty("os.name").toLowerCase().contains("windows")) { //this operation forces a cache clean freeing any lock -> windows only issue! WindowCache.reconfigure(new WindowCacheConfig()); } FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY); fsManager.remove(fileSystem.getName()); cleanupParentDir(gitDir); return true; } catch (java.io.IOException e) { throw new IOException("Failed to remove the git repository.", e); } }
@Test public void testGetPath() { final URI newRepo = URI.create("default://default-new-get-repo-name"); FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); final Path path = provider.getPath(URI.create("default://master@default-new-get-repo-name/home")); assertThat(path).isNotNull(); assertThat(path.getRoot().toString()).isEqualTo("/"); assertThat(path.toString()).isEqualTo("/home"); assertThat(path.toUri().getScheme()).isEqualTo("default"); final Path pathRelative = provider.getPath(URI.create("default://master@default-new-get-repo-name/:home")); assertThat(pathRelative).isNotNull(); assertThat(pathRelative.toUri().toString()).isEqualTo("default://master@default-new-get-repo-name/:home"); assertThat(pathRelative.getRoot().toString()).isEqualTo(""); assertThat(pathRelative.toString()).isEqualTo("home"); fs.close(); }
@Test public void testGetPath() { final URI newRepo = URI.create("default://default-new-get-repo-name"); FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); final Path path = provider.getPath(URI.create("default://master@default-new-get-repo-name/home")); assertThat(path).isNotNull(); assertThat(path.getRoot().toString()).isEqualTo("/"); assertThat(path.toString()).isEqualTo("/home"); assertThat(path.toUri().getScheme()).isEqualTo("default"); final Path pathRelative = provider.getPath(URI.create("default://master@default-new-get-repo-name/:home")); assertThat(pathRelative).isNotNull(); assertThat(pathRelative.toUri().toString()).isEqualTo("default://master@default-new-get-repo-name/:home"); assertThat(pathRelative.getRoot().toString()).isEqualTo(""); assertThat(pathRelative.toString()).isEqualTo("home"); fs.close(); }
@Test public void testGetComplexPath() { final URI newRepo = URI.create("default://default-new-complex-get-repo-name"); FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); final Path path = provider.getPath(URI.create("default://origin/master@default-new-complex-get-repo-name/home")); assertThat(path).isNotNull(); assertThat(path.getRoot().toString()).isEqualTo("/"); assertThat(path.toString()).isEqualTo("/home"); assertThat(path.toUri().getScheme()).isEqualTo("default"); final Path pathRelative = provider.getPath(URI.create("default://origin/master@default-new-complex-get-repo-name/:home")); assertThat(pathRelative).isNotNull(); assertThat(pathRelative.getRoot().toString()).isEqualTo(""); assertThat(pathRelative.getRoot().toUri().toString()).isEqualTo("default://origin/master@default-new-complex-get-repo-name"); assertThat(pathRelative.toString()).isEqualTo("home"); fs.close(); }
@Test public void testGetComplexPath() { final URI newRepo = URI.create("default://default-new-complex-get-repo-name"); FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); final Path path = provider.getPath(URI.create("default://origin/master@default-new-complex-get-repo-name/home")); assertThat(path).isNotNull(); assertThat(path.getRoot().toString()).isEqualTo("/"); assertThat(path.toString()).isEqualTo("/home"); assertThat(path.toUri().getScheme()).isEqualTo("default"); final Path pathRelative = provider.getPath(URI.create("default://origin/master@default-new-complex-get-repo-name/:home")); assertThat(pathRelative).isNotNull(); assertThat(pathRelative.getRoot().toString()).isEqualTo(""); assertThat(pathRelative.getRoot().toUri().toString()).isEqualTo("default://origin/master@default-new-complex-get-repo-name"); assertThat(pathRelative.toString()).isEqualTo("home"); fs.close(); }
false)); assertThatThrownBy(() -> fileSystem.close()) .isInstanceOf(UnsupportedOperationException.class);
false)); assertThatThrownBy(() -> fileSystem.close()) .isInstanceOf(UnsupportedOperationException.class);
false)); assertThatThrownBy(() -> fileSystem.close()) .isInstanceOf(UnsupportedOperationException.class);
false)); assertThatThrownBy(() -> fileSystem.close()) .isInstanceOf(UnsupportedOperationException.class);