@Override public boolean isHadCommitOnBatchState(final Path path) { final Path root = checkNotNull("path", path).getRoot(); return hadCommitOnBatchState.containsKey(root) ? hadCommitOnBatchState.get(root) : false; }
void cleanupIfDeletedBranch(Path path) { if (path.equals(path.getRoot())) { indexEngine.delete(KObjectUtil.toKCluster(path)); } }
void cleanupIfDeletedBranch(Path path) { if (path.equals(path.getRoot())) { indexEngine.delete(KObjectUtil.toKCluster(path)); } }
private void fireNewBranchEvent(final Path targetRoot, final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot) { final Repository repository = repoService.getRepository(targetRoot); final Optional<Branch> branch = repository.getBranch(Paths.convert(nioTargetRepositoryRoot.getRoot())); if (branch.isPresent()) { newBranchEvent.fire(new NewBranchEvent(repository, branch.get().getName(), sessionInfo.getIdentity())); } else { throw new IllegalStateException("Could not find a branch that was just created. The Path used was " + nioTargetRepositoryRoot.getRoot()); } }
private void fireNewBranchEvent(final Path targetRoot, final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot) { configuredRepositories.reloadRepositories(); final Repository repository = repositoryService.getRepository(targetRoot); final Optional<Branch> branch = repository.getBranch(Paths.convert(nioTargetRepositoryRoot.getRoot())); if (branch.isPresent()) { newBranchEventEvent.fire(new NewBranchEvent(repository, branch.get().getName(), sessionInfo.getIdentity())); } else { throw new IllegalStateException("Could not find a branch that was just created. The Path used was " + nioTargetRepositoryRoot.getRoot()); } }
List<FolderItem> getSegmentSiblings(final Path path) { final List<FolderItem> result = new ArrayList<>(); final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (nioPath.equals(nioPath.getRoot())) { result.add(explorerServiceHelper.toFolderItem(nioPath)); } else { final org.uberfire.java.nio.file.Path nioParentPath = nioPath.getParent(); for (org.uberfire.java.nio.file.Path sibling : getDirectoryIterator(nioParentPath)) { result.add(explorerServiceHelper.toFolderItem(sibling)); } } return result; }
private void fireNewBranchEvent(final Space space, final Path targetRoot, final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot) { configuredRepositories.reloadRepositories(); final Repository repository = repositoryService.getRepository(space, targetRoot); final Optional<Branch> branch = repository.getBranch(Paths.convert(nioTargetRepositoryRoot.getRoot())); if (branch.isPresent()) { newBranchEventEvent.fire(new NewBranchEvent(repository, branch.get().getName(), sessionInfo.getIdentity())); } else { throw new IllegalStateException("Could not find a branch that was just created. The Path used was " + nioTargetRepositoryRoot.getRoot()); } }
@Test public void testGetComplexPath() { final URI newRepo = URI.create("git://new-complex-get-repo-name"); provider.newFileSystem(newRepo, EMPTY_ENV); final Path path = provider.getPath(URI.create("git://origin/master@new-complex-get-repo-name/home")); AssertionsForClassTypes.assertThat(path).isNotNull(); assertThat(path.getRoot().toString()).isEqualTo("/"); assertThat(path.toString()).isEqualTo("/home"); final Path pathRelative = provider.getPath(URI.create("git://origin/master@new-complex-get-repo-name/:home")); AssertionsForClassTypes.assertThat(pathRelative).isNotNull(); assertThat(pathRelative.getRoot().toString()).isEqualTo(""); assertThat(pathRelative.toString()).isEqualTo("home"); }
@Test public void testGetComplexPath() { final URI newRepo = URI.create("git://new-complex-get-repo-name"); provider.newFileSystem(newRepo, EMPTY_ENV); final Path path = provider.getPath(URI.create("git://origin/master@new-complex-get-repo-name/home")); AssertionsForClassTypes.assertThat(path).isNotNull(); assertThat(path.getRoot().toString()).isEqualTo("/"); assertThat(path.toString()).isEqualTo("/home"); final Path pathRelative = provider.getPath(URI.create("git://origin/master@new-complex-get-repo-name/:home")); AssertionsForClassTypes.assertThat(pathRelative).isNotNull(); assertThat(pathRelative.getRoot().toString()).isEqualTo(""); assertThat(pathRelative.toString()).isEqualTo("home"); }
@Test public void checkRootPath() { URI composedName = URI.create("git://dora-repo/subdir1"); FileSystem fsComposedName = provider.newFileSystem(composedName, EMPTY_ENV); Path path = provider.getPath(URI.create("git://dora-repo/subdir1/file.txt")); Path path1 = provider.getPath(URI.create("git://origin/bla@dora-repo/subdir1/file2.txt")); assertEquals(fsComposedName, path.getRoot().getFileSystem()); assertEquals(fsComposedName, path1.getRoot().getFileSystem()); }
@Test public void checkRootPath() { URI composedName = URI.create("git://dora-repo/subdir1"); FileSystem fsComposedName = provider.newFileSystem(composedName, EMPTY_ENV); Path path = provider.getPath(URI.create("git://dora-repo/subdir1/file.txt")); Path path1 = provider.getPath(URI.create("git://origin/bla@dora-repo/subdir1/file2.txt")); assertEquals(fsComposedName, path.getRoot().getFileSystem()); assertEquals(fsComposedName, path1.getRoot().getFileSystem()); }
@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(); } }
@Override public WorkspaceProject resolveProject(final Space space, final Path path) { final org.uberfire.java.nio.file.Path repositoryRoot = Paths.convert(path).getRoot(); final Repository repository = repositoryService.getRepository(space, Paths.convert(repositoryRoot)); final Branch branch = resolveBranch(repositoryRoot, repository); return new WorkspaceProject(organizationalUnitService.getOrganizationalUnit(repository.getSpace().getName()), repository, branch, moduleService.resolveModule(Paths.convert(Paths.convert(branch.getPath()).getRoot()))); }
@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(); } }
@Override public WorkspaceProject resolveProject(final Space space, final Path path) { final org.uberfire.java.nio.file.Path repositoryRoot = Paths.convert(path).getRoot(); final Repository repository = repositoryService.getRepository(space, Paths.convert(repositoryRoot)); final Branch branch = resolveBranch(repositoryRoot, repository); return new WorkspaceProject(organizationalUnitService.getOrganizationalUnit(repository.getSpace().getName()), repository, branch, moduleService.resolveModule(Paths.convert(Paths.convert(branch.getPath()).getRoot()))); }
@Test public void testSimpleBranchedGit() { final Path path = JGitPathImpl.create(fs, "", "master@my-host", false); assertThat(path).isNotNull(); assertThat(path.isAbsolute()).isTrue(); assertThat(path.toString()).isEqualTo("/"); assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/"); assertThat(path.getRoot()).isEqualTo(path); assertThat(path.getNameCount()).isEqualTo(0); assertThat(path.getRoot()).isEqualTo(path); }
@Test public void testSimpleBranchedGit() { final Path path = JGitPathImpl.create(fs, "", "master@my-host", false); assertThat(path).isNotNull(); assertThat(path.isAbsolute()).isTrue(); assertThat(path.toString()).isEqualTo("/"); assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/"); assertThat(path.getRoot()).isEqualTo(path); assertThat(path.getNameCount()).isEqualTo(0); assertThat(path.getRoot()).isEqualTo(path); }
@Test public void testSimpleBranchedGitRoot() { when(fs.getSeparator()).thenReturn("/"); final Path path = JGitPathImpl.create(fs, "/", "master@my-host", false); assertThat(path).isNotNull(); assertThat(path.isAbsolute()).isTrue(); assertThat(path.toString()).isEqualTo("/"); assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/"); assertThat(path.getRoot().toString()).isEqualTo("/"); assertThat(path.getNameCount()).isEqualTo(0); }
@Test public void testSimpleBranchedGitRelative() { when(fs.getSeparator()).thenReturn("/"); final Path path = JGitPathImpl.create(fs, "home", "master@my-host", false); assertThat(path).isNotNull(); assertThat(path.isAbsolute()).isFalse(); assertThat(path.toString()).isEqualTo("home"); assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/:home"); assertThat(path.getRoot().toString()).isEqualTo(""); assertThat(path.getNameCount()).isEqualTo(1); }