Search in sources :

Example 1 with EntityResult

use of com.google.datastore.v1.EntityResult in project beam by apache.

the class DatastoreV1Test method makeLatestTimestampResponse.

/**
 * Builds a response of the given timestamp.
 */
private static RunQueryResponse makeLatestTimestampResponse(long timestamp) {
    RunQueryResponse.Builder timestampResponse = RunQueryResponse.newBuilder();
    Entity.Builder entity = Entity.newBuilder();
    entity.setKey(makeKey("dummyKind", "dummyId"));
    entity.putProperties("timestamp", makeValue(new Date(timestamp * 1000)).build());
    EntityResult.Builder entityResult = EntityResult.newBuilder();
    entityResult.setEntity(entity);
    QueryResultBatch.Builder batch = QueryResultBatch.newBuilder();
    batch.addEntityResults(entityResult);
    timestampResponse.setBatch(batch);
    return timestampResponse.build();
}
Also used : Entity(com.google.datastore.v1.Entity) DeleteEntity(org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.DeleteEntity) QueryResultBatch(com.google.datastore.v1.QueryResultBatch) RunQueryResponse(com.google.datastore.v1.RunQueryResponse) EntityResult(com.google.datastore.v1.EntityResult) Date(java.util.Date)

Aggregations

Entity (com.google.datastore.v1.Entity)1 EntityResult (com.google.datastore.v1.EntityResult)1 QueryResultBatch (com.google.datastore.v1.QueryResultBatch)1 RunQueryResponse (com.google.datastore.v1.RunQueryResponse)1 Date (java.util.Date)1 DeleteEntity (org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.DeleteEntity)1