Search in sources :

Example 6 with DiffOp

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

the class CreatePatchOpTest method testCreatePatchModifyFeatureType.

@Test
public void testCreatePatchModifyFeatureType() throws Exception {
    DiffOp op = geogig.command(DiffOp.class).setReportTrees(true);
    insertAndAdd(points1, points2);
    geogig.getRepository().workingTree().updateTypeTree(pointsName, modifiedPointsType);
    Iterator<DiffEntry> diffs = op.call();
    Patch patch = geogig.command(CreatePatchOp.class).setDiffs(diffs).call();
    assertEquals(1, patch.getAlteredTrees().size());
    assertEquals(RevFeatureTypeImpl.build(pointsType).getId(), patch.getAlteredTrees().get(0).getOldFeatureType());
    assertEquals(RevFeatureTypeImpl.build(modifiedPointsType).getId(), patch.getAlteredTrees().get(0).getNewFeatureType());
    assertEquals(2, patch.getFeatureTypes().size());
}
Also used : DiffOp(org.locationtech.geogig.api.porcelain.DiffOp) Patch(org.locationtech.geogig.api.plumbing.diff.Patch) DiffEntry(org.locationtech.geogig.api.plumbing.diff.DiffEntry) Test(org.junit.Test)

Example 7 with DiffOp

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

the class CreatePatchOpTest method testCreatePatchAddNewFeatureToEmptyRepo.

@Test
public void testCreatePatchAddNewFeatureToEmptyRepo() throws Exception {
    insert(points1);
    DiffOp op = geogig.command(DiffOp.class);
    Iterator<DiffEntry> diffs = op.call();
    Patch patch = geogig.command(CreatePatchOp.class).setDiffs(diffs).call();
    assertEquals(1, patch.getAddedFeatures().size());
}
Also used : DiffOp(org.locationtech.geogig.api.porcelain.DiffOp) Patch(org.locationtech.geogig.api.plumbing.diff.Patch) DiffEntry(org.locationtech.geogig.api.plumbing.diff.DiffEntry) Test(org.junit.Test)

Example 8 with DiffOp

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

the class CreatePatchOpTest method testCreatePatchAddNewEmptyFeatureTypeToEmptyRepo.

@Test
public void testCreatePatchAddNewEmptyFeatureTypeToEmptyRepo() throws Exception {
    WorkingTree workingTree = geogig.getRepository().workingTree();
    workingTree.createTypeTree(linesName, linesType);
    DiffOp op = geogig.command(DiffOp.class).setReportTrees(true);
    Iterator<DiffEntry> diffs = op.call();
    Patch patch = geogig.command(CreatePatchOp.class).setDiffs(diffs).call();
    assertEquals(1, patch.getAlteredTrees().size());
    assertEquals(ObjectId.NULL, patch.getAlteredTrees().get(0).getOldFeatureType());
    assertEquals(RevFeatureTypeImpl.build(linesType).getId(), patch.getAlteredTrees().get(0).getNewFeatureType());
    assertEquals(1, patch.getFeatureTypes().size());
}
Also used : WorkingTree(org.locationtech.geogig.repository.WorkingTree) DiffOp(org.locationtech.geogig.api.porcelain.DiffOp) Patch(org.locationtech.geogig.api.plumbing.diff.Patch) DiffEntry(org.locationtech.geogig.api.plumbing.diff.DiffEntry) Test(org.junit.Test)

Example 9 with DiffOp

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

the class CreatePatchOpTest method testCreatePatchRemoveEmptyFeatureType.

@Test
public void testCreatePatchRemoveEmptyFeatureType() throws Exception {
    WorkingTree workingTree = geogig.getRepository().workingTree();
    workingTree.createTypeTree(linesName, linesType);
    geogig.command(AddOp.class).setUpdateOnly(false).call();
    workingTree.delete(linesName);
    DiffOp op = geogig.command(DiffOp.class).setReportTrees(true);
    Iterator<DiffEntry> diffs = op.call();
    Patch patch = geogig.command(CreatePatchOp.class).setDiffs(diffs).call();
    assertEquals(1, patch.getAlteredTrees().size());
    assertEquals(RevFeatureTypeImpl.build(linesType).getId(), patch.getAlteredTrees().get(0).getOldFeatureType());
    assertEquals(ObjectId.NULL, patch.getAlteredTrees().get(0).getNewFeatureType());
    assertEquals(1, patch.getFeatureTypes().size());
}
Also used : WorkingTree(org.locationtech.geogig.repository.WorkingTree) DiffOp(org.locationtech.geogig.api.porcelain.DiffOp) Patch(org.locationtech.geogig.api.plumbing.diff.Patch) DiffEntry(org.locationtech.geogig.api.plumbing.diff.DiffEntry) Test(org.junit.Test)

Aggregations

DiffEntry (org.locationtech.geogig.api.plumbing.diff.DiffEntry)9 DiffOp (org.locationtech.geogig.api.porcelain.DiffOp)9 Patch (org.locationtech.geogig.api.plumbing.diff.Patch)7 Test (org.junit.Test)6 GeoGIG (org.locationtech.geogig.api.GeoGIG)2 WorkingTree (org.locationtech.geogig.repository.WorkingTree)2 Feature (org.opengis.feature.Feature)2 FileOutputStream (java.io.FileOutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 ConsoleReader (jline.console.ConsoleReader)1 FeatureBuilder (org.locationtech.geogig.api.FeatureBuilder)1 RevFeature (org.locationtech.geogig.api.RevFeature)1 RevFeatureType (org.locationtech.geogig.api.RevFeatureType)1 DiffBounds (org.locationtech.geogig.api.plumbing.DiffBounds)1 DiffCount (org.locationtech.geogig.api.plumbing.DiffCount)1 RevObjectParse (org.locationtech.geogig.api.plumbing.RevObjectParse)1 DiffObjectCount (org.locationtech.geogig.api.plumbing.diff.DiffObjectCount)1 BoundingBox (org.opengis.geometry.BoundingBox)1 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)1