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();
}
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();
}
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));
}
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();
}
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();
}
Aggregations