FeatureTypeDiff diff = new FeatureTypeDiff(headerTokens[0], ObjectId.valueOf(headerTokens[1]), ObjectId.valueOf(headerTokens[2])); patch.addAlteredTree(diff); } else {// feature String element = Joiner.on("\n").join(lines.subList(1, lines.size()));
FeatureTypeDiff diff = new FeatureTypeDiff(headerTokens[0], ObjectId.valueOf(headerTokens[1]), ObjectId.valueOf(headerTokens[2])); patch.addAlteredTree(diff); } else {// feature String element = Joiner.on("\n").join(lines.subList(1, lines.size()));
patch.addFeatureType(oldFeatureType); patch.addFeatureType(newFeatureType); patch.addAlteredTree(diffEntry); RevFeatureType featureType = command(RevObjectParse.class) .setObjectId(metadataId).call(RevFeatureType.class).get(); patch.addAlteredTree(diffEntry); patch.addFeatureType(featureType); RevFeatureType featureType = command(RevObjectParse.class) .setObjectId(metadataId).call(RevFeatureType.class).get(); patch.addAlteredTree(diffEntry); patch.addFeatureType(featureType);
patch.addFeatureType(oldFeatureType); patch.addFeatureType(newFeatureType); patch.addAlteredTree(diffEntry); RevFeatureType featureType = command(RevObjectParse.class) .setObjectId(metadataId).call(RevFeatureType.class).get(); patch.addAlteredTree(diffEntry); patch.addFeatureType(featureType); RevFeatureType featureType = command(RevObjectParse.class) .setObjectId(metadataId).call(RevFeatureType.class).get(); patch.addAlteredTree(diffEntry); patch.addFeatureType(featureType);
: ObjectId.NULL; if (Objects.equal(metadataId, diff.getOldFeatureType())) { toApply.addAlteredTree(diff); } else { toReject.addAlteredTree(diff);
@Test public void testAddEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, null, featureType.getId())); testPatch(patch); }
@Test public void testRemoveEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null)); testPatch(patch); }
: ObjectId.NULL; if (Objects.equal(metadataId, diff.getOldFeatureType())) { toApply.addAlteredTree(diff); } else { toReject.addAlteredTree(diff);
@Test public void testModifiedFeatureType() throws Exception { insert(points2, points3, points1B); Patch patch = new Patch(); RevFeatureType oldFeatureType = RevFeatureTypeBuilder.build(pointsType); RevFeatureType featureType = RevFeatureTypeBuilder.build(modifiedPointsType); patch.addFeatureType(featureType); patch.addAlteredTree( new FeatureTypeDiff(pointsName, oldFeatureType.getId(), featureType.getId())); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTree = findTreeChild(root, pointsName); assertTrue(typeTree.isPresent()); assertEquals(featureType.getId(), typeTree.get().getMetadataId().get()); Optional<Node> featureNode = findTreeChild(root, NodeRef.appendChild(pointsName, idP2)); assertTrue(featureNode.isPresent()); assertEquals(oldFeatureType.getId(), featureNode.get().getMetadataId().get()); featureNode = findTreeChild(root, NodeRef.appendChild(pointsName, idP1)); assertTrue(featureNode.isPresent()); assertFalse(featureNode.get().getMetadataId().isPresent()); }
@Test public void testAddEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, null, featureType.getId())); testPatch(patch); }
@Test public void testAddEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, null, featureType.getId())); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTreeId = findTreeChild(root, pointsName); RevTree typeTree = repo.getTree(typeTreeId.get().getObjectId()); assertNotNull(typeTree); assertEquals(featureType.getId(), typeTreeId.get().getMetadataId().get()); }
@Test public void testRemoveEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null)); testPatch(patch); }
@Test public void testModifiedFeatureType() throws Exception { insert(points2, points3, points1B); Patch patch = new Patch(); RevFeatureType oldFeatureType = RevFeatureType.builder().type(pointsType).build(); RevFeatureType featureType = RevFeatureType.builder().type(modifiedPointsType).build(); patch.addFeatureType(featureType); patch.addAlteredTree( new FeatureTypeDiff(pointsName, oldFeatureType.getId(), featureType.getId())); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTree = findTreeChild(root, pointsName); assertTrue(typeTree.isPresent()); assertEquals(featureType.getId(), typeTree.get().getMetadataId().get()); Optional<Node> featureNode = findTreeChild(root, NodeRef.appendChild(pointsName, idP2)); assertTrue(featureNode.isPresent()); assertEquals(oldFeatureType.getId(), featureNode.get().getMetadataId().get()); featureNode = findTreeChild(root, NodeRef.appendChild(pointsName, idP1)); assertTrue(featureNode.isPresent()); assertFalse(featureNode.get().getMetadataId().isPresent()); }
@Test public void testAddEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, null, featureType.getId())); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTreeId = findTreeChild(root, pointsName); RevTree typeTree = repo.getTree(typeTreeId.get().getObjectId()); assertNotNull(typeTree); assertEquals(featureType.getId(), typeTreeId.get().getMetadataId().get()); }
@Test public void testModifiedEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); RevFeatureType modifiedFeatureType = RevFeatureTypeBuilder.build(modifiedPointsType); patch.addFeatureType(featureType); patch.addFeatureType(modifiedFeatureType); patch.addAlteredTree( new FeatureTypeDiff(pointsName, featureType.getId(), modifiedFeatureType.getId())); testPatch(patch); }
@Test public void testModifiedEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); RevFeatureType modifiedFeatureType = RevFeatureType.builder().type(modifiedPointsType) .build(); patch.addFeatureType(featureType); patch.addFeatureType(modifiedFeatureType); patch.addAlteredTree( new FeatureTypeDiff(pointsName, featureType.getId(), modifiedFeatureType.getId())); testPatch(patch); }
@Test public void testRemoveEmptyFeatureTypePatch() throws Exception { WorkingTree workingTree = geogig.getRepository().workingTree(); workingTree.createTypeTree(pointsName, pointsType); geogig.command(AddOp.class).setUpdateOnly(false).call(); Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null)); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTree = findTreeChild(root, pointsName); assertFalse(typeTree.isPresent()); }
@Test public void testRemoveEmptyFeatureTypePatch() throws Exception { WorkingTree workingTree = geogig.getRepository().workingTree(); workingTree.createTypeTree(pointsName, pointsType); geogig.command(AddOp.class).setUpdateOnly(false).call(); Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null)); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTree = findTreeChild(root, pointsName); assertFalse(typeTree.isPresent()); }