Search in sources :

Example 11 with MergeScenarioReport

use of org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport 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());
}
Also used : CommitOp(org.locationtech.geogig.api.porcelain.CommitOp) MergeScenarioReport(org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport) Feature(org.opengis.feature.Feature) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Example 12 with MergeScenarioReport

use of org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport in project GeoGig by boundlessgeo.

the class ReportCommitConflictsOpTest method testAddedSameFeature.

@Test
public void testAddedSameFeature() throws Exception {
    insertAndAdd(points1);
    geogig.command(CommitOp.class).call();
    geogig.command(BranchCreateOp.class).setName("TestBranch").call();
    insertAndAdd(points2);
    geogig.command(CommitOp.class).call();
    geogig.command(CheckoutOp.class).setSource("TestBranch").call();
    insertAndAdd(points2);
    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(0, conflicts.getUnconflicted().size());
}
Also used : CommitOp(org.locationtech.geogig.api.porcelain.CommitOp) MergeScenarioReport(org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Example 13 with MergeScenarioReport

use of org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport in project GeoGig by boundlessgeo.

the class ReportCommitConflictsOpTest method testModifiedSameAttributeCompatible.

@Test
public void testModifiedSameAttributeCompatible() 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();
    Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_2", new Integer(2000), "POINT(1 1)");
    insertAndAdd(points1ModifiedB);
    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());
}
Also used : CommitOp(org.locationtech.geogig.api.porcelain.CommitOp) MergeScenarioReport(org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport) Feature(org.opengis.feature.Feature) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Example 14 with MergeScenarioReport

use of org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport in project GeoGig by boundlessgeo.

the class ReportCommitConflictsOpTest method testRemovedSameFeature.

@Test
public void testRemovedSameFeature() throws Exception {
    insertAndAdd(points1);
    geogig.command(CommitOp.class).call();
    geogig.command(BranchCreateOp.class).setName("TestBranch").call();
    deleteAndAdd(points1);
    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(0, conflicts.getConflicts().size());
    assertEquals(0, conflicts.getUnconflicted().size());
}
Also used : CommitOp(org.locationtech.geogig.api.porcelain.CommitOp) MergeScenarioReport(org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Example 15 with MergeScenarioReport

use of org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport in project GeoGig by boundlessgeo.

the class ReportCommitConflictsOpTest method testModifiedSameFeatureIncompatible.

@Test
public void testModifiedSameFeatureIncompatible() 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();
    Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(1000), "POINT(1 1)");
    insertAndAdd(points1ModifiedB);
    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());
}
Also used : CommitOp(org.locationtech.geogig.api.porcelain.CommitOp) MergeScenarioReport(org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport) Feature(org.opengis.feature.Feature) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Aggregations

RevCommit (org.locationtech.geogig.api.RevCommit)30 MergeScenarioReport (org.locationtech.geogig.api.plumbing.merge.MergeScenarioReport)30 Test (org.junit.Test)23 CommitOp (org.locationtech.geogig.api.porcelain.CommitOp)23 ReportMergeScenarioOp (org.locationtech.geogig.api.plumbing.merge.ReportMergeScenarioOp)14 Feature (org.opengis.feature.Feature)9 AddOp (org.locationtech.geogig.api.porcelain.AddOp)8 ObjectId (org.locationtech.geogig.api.ObjectId)5 Optional (com.google.common.base.Optional)4 Ref (org.locationtech.geogig.api.Ref)4 DiffEntry (org.locationtech.geogig.api.plumbing.diff.DiffEntry)4 CommandResponse (org.locationtech.geogig.web.api.CommandResponse)4 ResponseWriter (org.locationtech.geogig.web.api.ResponseWriter)4 Context (org.locationtech.geogig.api.Context)3 SymRef (org.locationtech.geogig.api.SymRef)3 UpdateRef (org.locationtech.geogig.api.plumbing.UpdateRef)3 Conflict (org.locationtech.geogig.api.plumbing.merge.Conflict)3 CommandContext (org.locationtech.geogig.web.api.CommandContext)3 CommandSpecException (org.locationtech.geogig.web.api.CommandSpecException)3 CommitBuilder (org.locationtech.geogig.api.CommitBuilder)2