Search in sources :

Example 1 with BigtableBlockingStub

use of com.google.bigtable.v2.BigtableGrpc.BigtableBlockingStub in project grpc-gcp-java by GoogleCloudPlatform.

the class BigtableIntegrationTest method getBigtableBlockingStub.

private BigtableBlockingStub getBigtableBlockingStub() {
    GoogleCredentials creds = getCreds();
    BigtableBlockingStub stub = BigtableGrpc.newBlockingStub(gcpChannel).withCallCredentials(MoreCallCredentials.from(creds));
    return stub;
}
Also used : BigtableBlockingStub(com.google.bigtable.v2.BigtableGrpc.BigtableBlockingStub) GoogleCredentials(com.google.auth.oauth2.GoogleCredentials)

Example 2 with BigtableBlockingStub

use of com.google.bigtable.v2.BigtableGrpc.BigtableBlockingStub in project grpc-gcp-java by GoogleCloudPlatform.

the class BigtableIntegrationTest method testReadRows.

@Test
public void testReadRows() throws Exception {
    BigtableBlockingStub stub = getBigtableBlockingStub();
    ReadRowsRequest request = ReadRowsRequest.newBuilder().setTableName(TABLE_NAME).setRows(RowSet.newBuilder().addRowKeys(ByteString.copyFromUtf8("test-row"))).build();
    Iterator<ReadRowsResponse> response = stub.readRows(request);
    assertEquals(1, gcpChannel.channelRefs.size());
}
Also used : ReadRowsResponse(com.google.bigtable.v2.ReadRowsResponse) BigtableBlockingStub(com.google.bigtable.v2.BigtableGrpc.BigtableBlockingStub) ReadRowsRequest(com.google.bigtable.v2.ReadRowsRequest) Test(org.junit.Test)

Example 3 with BigtableBlockingStub

use of com.google.bigtable.v2.BigtableGrpc.BigtableBlockingStub in project grpc-gcp-java by GoogleCloudPlatform.

the class BigtableIntegrationTest method testMutateRowReuse.

@Test
public void testMutateRowReuse() throws Exception {
    BigtableBlockingStub stub = getBigtableBlockingStub();
    MutateRowRequest request = getMutateRequest("test-mutation", 100, "test-row");
    for (int i = 0; i < DEFAULT_MAX_CHANNEL + 1; i++) {
        MutateRowResponse response = stub.mutateRow(request);
        assertThat(response).isNotEqualTo(null);
        assertEquals(1, gcpChannel.channelRefs.size());
    }
}
Also used : MutateRowRequest(com.google.bigtable.v2.MutateRowRequest) MutateRowResponse(com.google.bigtable.v2.MutateRowResponse) BigtableBlockingStub(com.google.bigtable.v2.BigtableGrpc.BigtableBlockingStub) Test(org.junit.Test)

Example 4 with BigtableBlockingStub

use of com.google.bigtable.v2.BigtableGrpc.BigtableBlockingStub in project grpc-gcp-java by GoogleCloudPlatform.

the class BigtableLoadTest method getReadRowsResponses.

private static List<Iterator<ReadRowsResponse>> getReadRowsResponses(ManagedChannel channel) {
    GoogleCredentials creds = getCreds();
    BigtableBlockingStub stub = BigtableGrpc.newBlockingStub(channel).withCallCredentials(MoreCallCredentials.from(creds));
    List<Iterator<ReadRowsResponse>> res = new ArrayList<>();
    ReadRowsRequest request = ReadRowsRequest.newBuilder().setTableName(LARGE_TABLE_NAME).build();
    for (int i = 0; i < DEFAULT_MAX_STREAM + 5; i++) {
        Iterator<ReadRowsResponse> iter = stub.readRows(request);
        res.add(iter);
    }
    return res;
}
Also used : ReadRowsResponse(com.google.bigtable.v2.ReadRowsResponse) BigtableBlockingStub(com.google.bigtable.v2.BigtableGrpc.BigtableBlockingStub) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) GoogleCredentials(com.google.auth.oauth2.GoogleCredentials) ReadRowsRequest(com.google.bigtable.v2.ReadRowsRequest)

Aggregations

BigtableBlockingStub (com.google.bigtable.v2.BigtableGrpc.BigtableBlockingStub)4 GoogleCredentials (com.google.auth.oauth2.GoogleCredentials)2 ReadRowsRequest (com.google.bigtable.v2.ReadRowsRequest)2 ReadRowsResponse (com.google.bigtable.v2.ReadRowsResponse)2 Test (org.junit.Test)2 MutateRowRequest (com.google.bigtable.v2.MutateRowRequest)1 MutateRowResponse (com.google.bigtable.v2.MutateRowResponse)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1