use of org.locationtech.geogig.api.plumbing.diff.GenericAttributeDiffImpl in project GeoGig by boundlessgeo.
the class ApplyPatchOpTest method testRemoveFeatureAttributePatch.
@Test
public void testRemoveFeatureAttributePatch() throws Exception {
insert(points1B);
Patch patch = new Patch();
String path = NodeRef.appendChild(pointsName, points1B.getIdentifier().getID());
Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap();
Optional<?> oldValue = Optional.fromNullable(points1B.getProperty("extra").getValue());
GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, null);
map.put(modifiedPointsType.getDescriptor("extra"), diff);
FeatureDiff featureDiff = new FeatureDiff(path, map, RevFeatureTypeImpl.build(modifiedPointsType), RevFeatureTypeImpl.build(pointsType));
patch.addModifiedFeature(featureDiff);
geogig.command(ApplyPatchOp.class).setPatch(patch).call();
Optional<RevFeature> feature = geogig.command(RevObjectParse.class).setRefSpec("WORK_HEAD:" + path).call(RevFeature.class);
assertTrue(feature.isPresent());
ImmutableList<Optional<Object>> values = feature.get().getValues();
assertEquals(points1.getProperties().size(), values.size());
assertFalse(values.contains("ExtraString"));
}
Aggregations