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