use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class ReportCommitConflictsOpTest method testModifiedAndNonExistant.
@Test
public void testModifiedAndNonExistant() throws Exception {
insertAndAdd(points2);
geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
insertAndAdd(points1);
geogig.command(CommitOp.class).call();
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
insertAndAdd(points1Modified);
RevCommit branchCommit = geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("master").call();
MergeScenarioReport conflicts = geogig.command(ReportCommitConflictsOp.class).setCommit(branchCommit).call();
assertEquals(0, conflicts.getConflicts().size());
assertEquals(1, conflicts.getUnconflicted().size());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class ReportMergeConflictsOpTest method testModifiedSameFeatureCompatible.
@Test
public void testModifiedSameFeatureCompatible() throws Exception {
insertAndAdd(points1);
geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
insertAndAdd(points1Modified);
RevCommit masterCommit = geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_1", new Integer(2000), "POINT(1 1)");
insertAndAdd(points1ModifiedB);
RevCommit branchCommit = geogig.command(CommitOp.class).call();
MergeScenarioReport conflicts = geogig.command(ReportMergeScenarioOp.class).setMergeIntoCommit(masterCommit).setToMergeCommit(branchCommit).call();
assertEquals(0, conflicts.getConflicts().size());
assertEquals(0, conflicts.getUnconflicted().size());
assertEquals(1, conflicts.getMerged().size());
Feature pointsMerged = feature(pointsType, idP1, "StringProp1_2", new Integer(2000), "POINT(1 1)");
assertEquals(pointsMerged, conflicts.getMerged().get(0).getFeature());
Boolean hasConflictsOrAutomerge = geogig.command(CheckMergeScenarioOp.class).setCommits(Lists.newArrayList(masterCommit, branchCommit)).call();
assertTrue(hasConflictsOrAutomerge.booleanValue());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class RebaseOpTest method testRebaseWithConflictAndContinue.
@Test
public void testRebaseWithConflictAndContinue() throws Exception {
// Create the following revision graph
// o
// |
// o - Points 1,2 added
// |\
// | o - branch1 - Points 1 modifiedB, 2 removed, 3 added
// |
// o - Points 1 modified, 2 removed
// |
// o - master - HEAD - Lines 1 added
insertAndAdd(points1, points2);
geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("branch1").call();
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
insert(points1Modified);
delete(points2);
geogig.command(AddOp.class).call();
RevCommit masterCommit2 = geogig.command(CommitOp.class).setMessage("adding points1 modified, deleting point2").call();
insert(lines1);
geogig.command(AddOp.class).call();
RevCommit masterCommit = geogig.command(CommitOp.class).setMessage("adding lines.1").call();
geogig.command(CheckoutOp.class).setSource("branch1").call();
insert(points3);
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
insert(points1ModifiedB);
delete(points2);
geogig.command(AddOp.class).call();
RevCommit branchCommit = geogig.command(CommitOp.class).setMessage("branch commit").call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch1 = geogig.command(RefParse.class).setName("branch1").call().get();
try {
geogig.command(RebaseOp.class).setUpstream(Suppliers.ofInstance(branch1.getObjectId())).call();
fail();
} catch (RebaseConflictsException e) {
assertTrue(e.getMessage().contains("conflict"));
}
Optional<Ref> ref = geogig.command(RefParse.class).setName(Ref.ORIG_HEAD).call();
assertTrue(ref.isPresent());
assertEquals(masterCommit.getId(), ref.get().getObjectId());
List<Conflict> conflicts = geogig.command(ConflictsReadOp.class).call();
assertEquals(1, conflicts.size());
String path = NodeRef.appendChild(pointsName, idP1);
assertEquals(conflicts.get(0).getPath(), path);
assertEquals(conflicts.get(0).getOurs(), RevFeatureBuilder.build(points1Modified).getId());
assertEquals(conflicts.get(0).getTheirs(), RevFeatureBuilder.build(points1ModifiedB).getId());
// solve, and continue
Feature points1Merged = feature(pointsType, idP1, "StringProp1_2", new Integer(2000), "POINT(1 1)");
insert(points1Merged);
geogig.command(AddOp.class).call();
geogig.command(RebaseOp.class).setContinue(true).call();
Iterator<RevCommit> log = geogig.command(LogOp.class).call();
RevCommit logCommit1 = log.next();
assertEquals(masterCommit.getAuthor(), logCommit1.getAuthor());
assertEquals(masterCommit.getCommitter().getName(), logCommit1.getCommitter().getName());
assertEquals(masterCommit.getMessage(), logCommit1.getMessage());
assertEquals(masterCommit.getAuthor().getTimeZoneOffset(), logCommit1.getAuthor().getTimeZoneOffset());
assertEquals(masterCommit.getAuthor().getTimestamp(), logCommit1.getAuthor().getTimestamp());
assertEquals(masterCommit.getCommitter().getTimeZoneOffset(), logCommit1.getCommitter().getTimeZoneOffset());
assertNotSame(masterCommit.getCommitter().getTimestamp(), logCommit1.getCommitter().getTimestamp());
assertNotSame(masterCommit.getTreeId(), logCommit1.getTreeId());
RevCommit logCommit2 = log.next();
assertEquals(masterCommit2.getAuthor(), logCommit2.getAuthor());
assertEquals(masterCommit2.getCommitter().getName(), logCommit2.getCommitter().getName());
assertEquals(masterCommit2.getMessage(), logCommit2.getMessage());
RevCommit logCommit3 = log.next();
assertEquals(branchCommit.getAuthor(), logCommit3.getAuthor());
assertEquals(branchCommit.getCommitter().getName(), logCommit3.getCommitter().getName());
assertEquals(branchCommit.getMessage(), logCommit3.getMessage());
ref = geogig.command(RefParse.class).setName(Ref.ORIG_HEAD).call();
assertFalse(ref.isPresent());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class RebaseOpTest method testRebaseAbort.
@Test
public void testRebaseAbort() throws Exception {
// Create the following revision graph
// o
// |
// o - Points 1,2 added
// |\
// | o - branch1 - Points 1 modifiedB, 2 removed, 3 added
// |
// o - Points 1 modified, 2 removed
// |
// o - master - HEAD - Lines 1 added
insertAndAdd(points1, points2);
RevCommit firstCommit = geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("branch1").call();
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
insert(points1Modified);
delete(points2);
geogig.command(AddOp.class).call();
RevCommit masterCommit2 = geogig.command(CommitOp.class).setMessage("adding points1 modified, deleting point2").call();
insert(lines1);
geogig.command(AddOp.class).call();
RevCommit masterCommit = geogig.command(CommitOp.class).setMessage("adding lines.1").call();
geogig.command(CheckoutOp.class).setSource("branch1").call();
insert(points3);
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
insert(points1ModifiedB);
delete(points2);
geogig.command(AddOp.class).call();
geogig.command(CommitOp.class).setMessage("branch commit").call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch1 = geogig.command(RefParse.class).setName("branch1").call().get();
try {
geogig.command(RebaseOp.class).setUpstream(Suppliers.ofInstance(branch1.getObjectId())).call();
fail();
} catch (RebaseConflictsException e) {
assertTrue(e.getMessage().contains("conflict"));
}
geogig.command(RebaseOp.class).setAbort(true).call();
Optional<Ref> head = geogig.command(RefParse.class).setName(Ref.HEAD).call();
assertTrue(head.isPresent());
assertEquals(head.get().getObjectId(), masterCommit.getId());
Iterator<RevCommit> log = geogig.command(LogOp.class).call();
RevCommit logCommit1 = log.next();
assertEquals(masterCommit.getMessage(), logCommit1.getMessage());
RevCommit logCommit2 = log.next();
assertEquals(masterCommit2.getMessage(), logCommit2.getMessage());
RevCommit logCommit3 = log.next();
assertEquals(firstCommit.getMessage(), logCommit3.getMessage());
String path = NodeRef.appendChild(pointsName, idP1);
Optional<RevFeature> points = geogig.command(RevObjectParse.class).setRefSpec(Ref.HEAD + ":" + path).call(RevFeature.class);
assertTrue(points.isPresent());
assertEquals(RevFeatureBuilder.build(points1Modified), points.get());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class ReportCommitConflictsOpTest method testModifiedAndRemoved.
@Test
public void testModifiedAndRemoved() throws Exception {
insertAndAdd(points1);
geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
insertAndAdd(points1Modified);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
deleteAndAdd(points1);
RevCommit branchCommit = geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("master").call();
MergeScenarioReport conflicts = geogig.command(ReportCommitConflictsOp.class).setCommit(branchCommit).call();
assertEquals(1, conflicts.getConflicts().size());
assertEquals(0, conflicts.getUnconflicted().size());
}
Aggregations