public @Override void after() { repos.values().forEach(r -> r.getRepo().close()); tmp.delete(); }
private GeogigTransaction getTransaction() { GeogigTransaction prtx = request.getTransaction(origin.getRepo().context()); assertNotNull(prtx); return prtx; }
@Given("^There is an empty repository named ([^\"]*)$") public void setUpEmptyRepo(String name) throws Throwable { context.createRepo(name).init("webuser", "webuser@test.com").getRepo().close(); openedRepos.add(name); }
private GeogigTransaction getTransaction() { GeogigTransaction prtx = request.getTransaction(origin.getRepo().context()); assertNotNull(prtx); return prtx; }
@Given("I have \"([^\"]*)\" that is not managed$") public void setupExtraUnMangedRepo(String repoName) throws Exception { context.createUnmanagedRepo(repoName) .init("geogigUser", "repo1_Owner@geogig.org") .loadDefaultData() .getRepo().close(); openedRepos.add(repoName); }
private PRStatus getPrStatus() { PRStatus status = origin.getRepo().command(PRHealthCheckOp.class).setId(request.getId()) .call(); return status; }
private PRStatus getPrStatus() { PRStatus status = origin.getRepo().command(PRHealthCheckOp.class).setId(request.getId()) .call(); return status; }
private PRStatus prepare() { return origin.getRepo().command(PRPrepareOp.class).setId(request.getId()).call(); }
public @Test void testListPullRequests() { PR pr1 = createPr(1, "branch1"); PR pr2 = createPr(2, "branch2"); assertEquals(Lists.newArrayList(pr1, pr2), origin.getRepo().command(PRListOp.class).call()); }
private PRStatus merge() { return origin.getRepo().command(PRMergeOp.class).setId(request.getId()).call(); }
/** * Set up multiple repositories for testing. * * @return Collection of repository names created. * * @throws Exception */ public Collection<String> setUpDefaultMultiRepoServer() throws Exception { createRepo("repo1")// .init("geogigUser", "repo1_Owner@geogig.org")// .loadDefaultData()// .getRepo().close(); createRepo("repo2")// .init("geogigUser", "repo2_Owner@geogig.org")// .loadDefaultData()// .getRepo().close(); return Arrays.asList("repo1", "repo2"); }
@Given("There is a repo with some data") public void setUpRepoWithData() throws Exception { Repository repo = context.createRepo("repo1").init("myuser", "the_user@testing.com") .getRepo(); TestData data = new TestData(repo); data.addAndCommit("Added Point.1", TestData.point1); }
private PR createPr(int id, String branch) { PRInitOp prinit = PRInitOp.builder()// .id(id)// .remoteURI(origin.getRepo().getLocation())// .remoteBranch(branch)// .targetBranch("master")// .title("PR " + id)// .description(null)// .build(); prinit.setContext(origin.getRepo().context()); return prinit.call(); } }
/** * Set up multiple repositories with a shallow clone for testing. * * @return Collection of repository names created. * * @throws Exception */ public Collection<String> setUpDefaultMultiRepoServerWithShallowClone() throws Exception { Repository repo1 = createRepo("full")// .init("geogigUser", "full_Owner@geogig.org")// .loadDefaultData()// .getRepo(); Repository repo2 = createRepo("shallow")// .init("geogigUser", "shallow_Owner@geogig.org").getRepo(); repo2.command(CloneOp.class).setRemoteURI(repo1.getLocation()).setDepth(1).call(); repo1.close(); repo2.close(); return Arrays.asList("full", "shallow"); }
public @Test void healthUpToDate() { fakeUpToDate();// pull from remote PRStatus status = origin.getRepo().command(PRHealthCheckOp.class).setId(request.getId()) .call(); assertNotNull(status); assertEquals(request, status.getRequest()); assertEquals(Sets.newHashSet("Lines", "Points", "Polygons"), Sets.newHashSet(status.getAffectedLayers())); Optional<ObjectId> mergeCommit = status.getMergeCommit(); assertFalse(mergeCommit.toString(), mergeCommit.isPresent()); assertEquals(0, status.getCommitsBehindRemoteBranch()); assertEquals(0, status.getCommitsBehindTargetBranch()); assertEquals(0, status.getNumConflicts()); }
private void fakeUpToDate() { Remote remote = request.buildRemote(); GeogigTransaction tx = request.getTransaction(origin.getRepo().context()); tx.command(FetchOp.class).setFetchIndexes(true).addRemote(remote).call(); Ref remoteBranchState = clone.getRef(request.getRemoteBranch()); Ref localRemoteBranchState = tx.command(RefParse.class).setName(request.getOriginRef()) .call().get(); assertEquals(remoteBranchState.getObjectId(), localRemoteBranchState.getObjectId()); } }
public @Test void healthCheckAfterInitBeforePrepare() { PRStatus status = origin.getRepo().command(PRHealthCheckOp.class).setId(request.getId()) .call(); assertNotNull(status); assertEquals(request, status.getRequest()); Optional<ObjectId> mergeCommit = status.getMergeCommit(); assertFalse(mergeCommit.toString(), mergeCommit.isPresent()); // PR was just inited, not prepared, so it's behind the remote branch assertEquals(3, status.getCommitsBehindRemoteBranch()); assertEquals(0, status.getCommitsBehindTargetBranch()); assertEquals(0, status.getNumConflicts()); }
public @Test void healthCheckBehindTargetBranch() { // fake PRPrepareOp fakeUpToDate(); origin.checkout("master").insert(TestData.line2).add().commit("l2").insert(TestData.line3) .add().commit("l3"); PRStatus status = origin.getRepo().command(PRHealthCheckOp.class).setId(request.getId()) .call(); assertNotNull(status); assertEquals(request, status.getRequest()); assertEquals(Sets.newHashSet("Lines", "Points", "Polygons"), Sets.newHashSet(status.getAffectedLayers())); Optional<ObjectId> mergeCommit = status.getMergeCommit(); assertFalse(mergeCommit.toString(), mergeCommit.isPresent()); assertEquals(0, status.getCommitsBehindRemoteBranch()); assertEquals(2, status.getCommitsBehindTargetBranch()); assertEquals(0, status.getNumConflicts()); }
@Given("^There is a repository with multiple branches named ([^\"]*)$") public void setUpMultipleBranches(String name) throws Throwable { Repository repo = context.createRepo(name).init("webuser", "webuser@test.com").getRepo(); TestData data = new TestData(repo); data.addAndCommit("Added Point.1", TestData.point1); data.branch("non_conflicting"); data.branch("conflicting"); data.addAndCommit("Modified Point.1", TestData.point1_modified); data.branch("master_original"); data.checkout("conflicting"); data.remove(TestData.point1); data.add(); data.commit("Removed Point.1"); data.checkout("non_conflicting"); data.addAndCommit("Added Point.2", TestData.point2); data.checkout("master"); repo.close(); openedRepos.add(name); }