Search in sources :

Example 1 with FetchOp

use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.

the class FetchOpTest method testFetchDepthWithFullRepo.

@Test
public void testFetchDepthWithFullRepo() throws Exception {
    prepareForFetch(true);
    FetchOp fetch = fetch();
    fetch.setDepth(2);
    fetch.call();
    verifyFetch();
}
Also used : FetchOp(org.locationtech.geogig.api.porcelain.FetchOp) Test(org.junit.Test)

Example 2 with FetchOp

use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.

the class FetchOpTest method testFetchSpecificRemoteAndAll.

@Test
public void testFetchSpecificRemoteAndAll() throws Exception {
    prepareForFetch(true);
    // fetch from the remote
    FetchOp fetch = fetch();
    fetch.addRemote("origin").setAll(true).call();
    verifyFetch();
}
Also used : FetchOp(org.locationtech.geogig.api.porcelain.FetchOp) Test(org.junit.Test)

Example 3 with FetchOp

use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.

the class FetchOpTest method testFetchNewRefWithShallowClone.

@Test
public void testFetchNewRefWithShallowClone() throws Exception {
    // Commit several features to the remote
    expectedMaster = new LinkedList<RevCommit>();
    expectedBranch = new LinkedList<RevCommit>();
    insertAndAdd(remoteGeogig.geogig, points1);
    RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call();
    RevCommit originCommit = commit;
    expectedMaster.addFirst(commit);
    expectedBranch.addFirst(commit);
    insertAndAdd(remoteGeogig.geogig, lines1);
    commit = remoteGeogig.geogig.command(CommitOp.class).call();
    expectedMaster.addFirst(commit);
    insertAndAdd(remoteGeogig.geogig, lines2);
    commit = remoteGeogig.geogig.command(CommitOp.class).call();
    expectedMaster.addFirst(commit);
    // Make sure master has all of the commits
    Iterator<RevCommit> logs = remoteGeogig.geogig.command(LogOp.class).call();
    List<RevCommit> logged = Lists.newArrayList(logs);
    assertEquals(expectedMaster, logged);
    // clone the repository
    CloneOp clone = clone();
    clone.setDepth(2);
    clone.setRepositoryURL(remoteGeogig.envHome.getCanonicalPath()).call();
    // Create and checkout branch1
    remoteGeogig.geogig.command(BranchCreateOp.class).setAutoCheckout(true).setName("Branch1").setSource(originCommit.getId().toString()).call();
    // Commit some changes to branch1
    insertAndAdd(remoteGeogig.geogig, points2);
    commit = remoteGeogig.geogig.command(CommitOp.class).call();
    expectedBranch.addFirst(commit);
    insertAndAdd(remoteGeogig.geogig, points3);
    commit = remoteGeogig.geogig.command(CommitOp.class).call();
    expectedBranch.addFirst(commit);
    // Make sure Branch1 has all of the commits
    logs = remoteGeogig.geogig.command(LogOp.class).call();
    logged = Lists.newArrayList(logs);
    assertEquals(expectedBranch, logged);
    FetchOp fetch = fetch();
    fetch.call();
    // Make sure the local repository got all of the commits from master
    localGeogig.geogig.command(CheckoutOp.class).setSource("refs/remotes/origin/master").call();
    logs = localGeogig.geogig.command(LogOp.class).call();
    logged = Lists.newArrayList(logs);
    assertEquals(2, logged.size());
    assertEquals(expectedMaster.get(0), logged.get(0));
    assertEquals(expectedMaster.get(1), logged.get(1));
    // Make sure the local repository got all of the commits from Branch1
    localGeogig.geogig.command(CheckoutOp.class).setSource("refs/remotes/origin/Branch1").call();
    logs = localGeogig.geogig.command(LogOp.class).call();
    logged = Lists.newArrayList(logs);
    assertEquals(2, logged.size());
    assertEquals(expectedBranch.get(0), logged.get(0));
    assertEquals(expectedBranch.get(1), logged.get(1));
}
Also used : CloneOp(org.locationtech.geogig.api.porcelain.CloneOp) FetchOp(org.locationtech.geogig.api.porcelain.FetchOp) LogOp(org.locationtech.geogig.api.porcelain.LogOp) CommitOp(org.locationtech.geogig.api.porcelain.CommitOp) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Example 4 with FetchOp

use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.

the class FetchOpTest method testFetchNoRemotes.

@Test
public void testFetchNoRemotes() throws Exception {
    FetchOp fetch = fetch();
    exception.expect(IllegalStateException.class);
    fetch.call();
}
Also used : FetchOp(org.locationtech.geogig.api.porcelain.FetchOp) Test(org.junit.Test)

Example 5 with FetchOp

use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.

the class FetchOpTest method testFetchAll.

@Test
public void testFetchAll() throws Exception {
    prepareForFetch(true);
    // fetch from the remote
    FetchOp fetch = fetch();
    fetch.setAll(true).call();
    verifyFetch();
}
Also used : FetchOp(org.locationtech.geogig.api.porcelain.FetchOp) Test(org.junit.Test)

Aggregations

FetchOp (org.locationtech.geogig.api.porcelain.FetchOp)21 Test (org.junit.Test)15 CloneOp (org.locationtech.geogig.api.porcelain.CloneOp)6 RevCommit (org.locationtech.geogig.api.RevCommit)4 LsRemote (org.locationtech.geogig.api.plumbing.LsRemote)4 LogOp (org.locationtech.geogig.api.porcelain.LogOp)4 CommitOp (org.locationtech.geogig.api.porcelain.CommitOp)3 Remote (org.locationtech.geogig.api.Remote)2 SynchronizationException (org.locationtech.geogig.api.porcelain.SynchronizationException)2 TransferSummary (org.locationtech.geogig.api.porcelain.TransferSummary)2 ConsoleReader (jline.console.ConsoleReader)1 Context (org.locationtech.geogig.api.Context)1 Ref (org.locationtech.geogig.api.Ref)1 SendPack (org.locationtech.geogig.api.plumbing.SendPack)1 PullOp (org.locationtech.geogig.api.porcelain.PullOp)1 PushOp (org.locationtech.geogig.api.porcelain.PushOp)1 CommandFailedException (org.locationtech.geogig.cli.CommandFailedException)1 DeduplicationService (org.locationtech.geogig.storage.DeduplicationService)1 CommandContext (org.locationtech.geogig.web.api.CommandContext)1 CommandResponse (org.locationtech.geogig.web.api.CommandResponse)1