use of org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.DeleteKeyFn in project beam by apache.
the class DatastoreV1Test method testDeleteKeys.
/**
* Test that valid keys are transformed to delete mutations.
*/
@Test
public void testDeleteKeys() throws Exception {
Key key = makeKey("bird", "finch").build();
DeleteKeyFn deleteKeyFn = new DeleteKeyFn();
Mutation exceptedMutation = makeDelete(key).build();
assertEquals(deleteKeyFn.apply(key), exceptedMutation);
}
use of org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.DeleteKeyFn in project beam by apache.
the class DatastoreV1Test method testDeleteIncompleteKeys.
/**
* Test that incomplete keys cannot be deleted.
*/
@Test
public void testDeleteIncompleteKeys() throws Exception {
Key key = makeKey("bird").build();
DeleteKeyFn deleteKeyFn = new DeleteKeyFn();
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Keys to be deleted from the Cloud Datastore must be complete");
deleteKeyFn.apply(key);
}
Aggregations