private void setBranches(final FileSystem fileSystem) { final Map<String, Branch> branches = getBranches(fileSystem); repo.setBranches(branches); }
private void setBranches(final FileSystem fileSystem) { final Map<String, Path> branches = getBranches(fileSystem); repo.setBranches(branches); repo.setRoot(getDefaultRoot(fileSystem, branches)); }
private ConfigGroup addRepository(final String alias, final String... branches) { final ConfigGroup configGroup = new ConfigGroup(); final GitRepository repository = new GitRepository(alias); final HashMap<String, Path> branchMap = new HashMap<>(); for (String branch : branches) { branchMap.put(branch, mock(Path.class)); } repository.setBranches(branchMap); repository.setRoot(branchMap.get("master")); when(repositoryFactory.newRepository(configGroup)).thenReturn(repository); return configGroup; }
public static GitRepository makeGitRepository() { final GitRepository repository = new GitRepository("guvnorng-playground", new Space("space")); final Map<String, Branch> branches = Collections.singletonMap("master", new Branch("master", mock(Path.class))); repository.setBranches(branches); return repository; } }
@Test public void testNewRepository() throws Exception { final GuvnorStructureContextChangeHandler handler = mock(GuvnorStructureContextChangeHandler.class); context.addGuvnorStructureContextChangeHandler(handler); final GitRepository newRepository = new GitRepository(); final HashMap<String, Branch> branches = new HashMap<>(); branches.put("master", new Branch("master", mock(Path.class))); newRepository.setBranches(branches); context.onNewRepository(new NewRepositoryEvent(newRepository)); verify(handler).onNewRepositoryAdded(newRepository); }
private GitRepository getGitRepository(final String alias) { final GitRepository repository = new GitRepository(alias, new Space("scheme")); final HashMap<String, Branch> branches = new HashMap<>(); final Path path = PathFactory.newPath("/", "file://master@module/"); branches.put("master", new Branch("master", path)); repository.setBranches(branches); return repository; } }
private GitRepository getGitRepository() { final GitRepository repository = new GitRepository("alias", space); final HashMap<String, Branch> branches = new HashMap<>(); masterBranch = new Branch("master", PathFactory.newPath("/", "file://master@module/")); devBranch = new Branch("dev-1.0.0", PathFactory.newPath("/", "file://dev-1.0.0@module/")); branches.put("master", masterBranch); branches.put("dev-1.0.0", devBranch); repository.setBranches(branches); return repository; } }
private ConfigGroup addRepository(final Space space, final String alias, final List<Contributor> contributors, final String... branches) { final ConfigGroup configGroup = spy(new ConfigGroup()); if (contributors != null && !contributors.isEmpty()) { configGroup.addConfigItem(configurationFactory.newConfigItem("contributors", contributors)); } final GitRepository repository = new GitRepository(alias, space); final HashMap<String, Branch> branchMap = new HashMap<>(); for (String branch : branches) { Path path = PathFactory.newPath(alias + ".txt", "default://master@myteam/mortgages/" + alias + ".txt"); branchMap.put(branch, new Branch(branch, path)); } repository.setBranches(branchMap); when(repositoryFactory.newRepository(configGroup)).thenReturn(repository); return configGroup; }
private ConfigGroup addRepository(final Space space, final String alias, final List<Contributor> contributors, final String... branches) { final ConfigGroup configGroup = spy(new ConfigGroup()); if (contributors != null && !contributors.isEmpty()) { configGroup.addConfigItem(configurationFactory.newConfigItem("contributors", contributors)); } final GitRepository repository = new GitRepository(alias, space); final HashMap<String, Branch> branchMap = new HashMap<>(); for (String branch : branches) { Path path = PathFactory.newPath(alias + ".txt", "default://master@myteam/mortgages/" + alias + ".txt"); branchMap.put(branch, new Branch(branch, path)); } repository.setBranches(branchMap); when(repositoryFactory.newRepository(configGroup)).thenReturn(repository); return configGroup; }
repo.setBranches( branches );
@Test public void resolveProjectRepository() throws Exception { final GitRepository repository = new GitRepository("alias", space); final HashMap<String, Branch> branches = new HashMap<>(); branches.put("master", new Branch("master", path)); repository.setBranches(branches); final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(repository); assertEquals(ou, workspaceProject.getOrganizationalUnit()); assertEquals(this.repository, workspaceProject.getRepository()); assertEquals(branch, workspaceProject.getBranch()); assertEquals(module, workspaceProject.getMainModule()); }
@Test public void resolveProjectRepository() throws Exception { final GitRepository repository = new GitRepository("alias", space); final HashMap<String, Branch> branches = new HashMap<>(); branches.put("master", new Branch("master", path)); repository.setBranches(branches); final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(repository); assertEquals(ou, workspaceProject.getOrganizationalUnit()); assertEquals(this.repository, workspaceProject.getRepository()); assertEquals(branch, workspaceProject.getBranch()); assertEquals(module, workspaceProject.getMainModule()); }