Search in sources :

Example 6 with CannotApplyPatchException

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

the class ApplyPatchOpTest method testAddedFeatureExists.

@Test
public void testAddedFeatureExists() throws Exception {
    insert(points1);
    Patch patch = new Patch();
    String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID());
    patch.addAddedFeature(path, points1, RevFeatureTypeImpl.build(pointsType));
    try {
        geogig.command(ApplyPatchOp.class).setPatch(patch).call();
        fail();
    } catch (CannotApplyPatchException e) {
        assertTrue(true);
    }
}
Also used : CannotApplyPatchException(org.locationtech.geogig.api.porcelain.CannotApplyPatchException) Patch(org.locationtech.geogig.api.plumbing.diff.Patch) Test(org.junit.Test)

Example 7 with CannotApplyPatchException

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

the class ApplyPatchOpTest method testRemovedFeatureDoesNotExists.

@Test
public void testRemovedFeatureDoesNotExists() throws Exception {
    Patch patch = new Patch();
    String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID());
    patch.addRemovedFeature(path, points1, RevFeatureTypeImpl.build(pointsType));
    try {
        geogig.command(ApplyPatchOp.class).setPatch(patch).call();
        fail();
    } catch (CannotApplyPatchException e) {
        assertTrue(true);
    }
}
Also used : CannotApplyPatchException(org.locationtech.geogig.api.porcelain.CannotApplyPatchException) Patch(org.locationtech.geogig.api.plumbing.diff.Patch) Test(org.junit.Test)

Aggregations

Patch (org.locationtech.geogig.api.plumbing.diff.Patch)7 CannotApplyPatchException (org.locationtech.geogig.api.porcelain.CannotApplyPatchException)7 Test (org.junit.Test)6 AttributeDiff (org.locationtech.geogig.api.plumbing.diff.AttributeDiff)4 FeatureDiff (org.locationtech.geogig.api.plumbing.diff.FeatureDiff)4 GenericAttributeDiffImpl (org.locationtech.geogig.api.plumbing.diff.GenericAttributeDiffImpl)4 PropertyDescriptor (org.opengis.feature.type.PropertyDescriptor)4 BufferedReader (java.io.BufferedReader)1 BufferedWriter (java.io.BufferedWriter)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStreamReader (java.io.InputStreamReader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ConsoleReader (jline.console.ConsoleReader)1 GeoGIG (org.locationtech.geogig.api.GeoGIG)1 VerifyPatchOp (org.locationtech.geogig.api.plumbing.diff.VerifyPatchOp)1 VerifyPatchResults (org.locationtech.geogig.api.plumbing.diff.VerifyPatchResults)1 CommandFailedException (org.locationtech.geogig.cli.CommandFailedException)1