Search in sources :

Example 1 with ListHotTabletsPagedResponse

use of com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListHotTabletsPagedResponse in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method listHotTabletsTest.

@Test
public void listHotTabletsTest() throws Exception {
    HotTablet responsesElement = HotTablet.newBuilder().build();
    ListHotTabletsResponse expectedResponse = ListHotTabletsResponse.newBuilder().setNextPageToken("").addAllHotTablets(Arrays.asList(responsesElement)).build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
    ListHotTabletsPagedResponse pagedListResponse = client.listHotTablets(parent);
    List<HotTablet> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getHotTabletsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListHotTabletsRequest actualRequest = ((ListHotTabletsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : HotTablet(com.google.bigtable.admin.v2.HotTablet) ListHotTabletsPagedResponse(com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListHotTabletsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) ListHotTabletsRequest(com.google.bigtable.admin.v2.ListHotTabletsRequest) ClusterName(com.google.bigtable.admin.v2.ClusterName) ListHotTabletsResponse(com.google.bigtable.admin.v2.ListHotTabletsResponse) Test(org.junit.Test)

Example 2 with ListHotTabletsPagedResponse

use of com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListHotTabletsPagedResponse in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method listHotTabletsTest2.

@Test
public void listHotTabletsTest2() throws Exception {
    HotTablet responsesElement = HotTablet.newBuilder().build();
    ListHotTabletsResponse expectedResponse = ListHotTabletsResponse.newBuilder().setNextPageToken("").addAllHotTablets(Arrays.asList(responsesElement)).build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListHotTabletsPagedResponse pagedListResponse = client.listHotTablets(parent);
    List<HotTablet> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getHotTabletsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListHotTabletsRequest actualRequest = ((ListHotTabletsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : HotTablet(com.google.bigtable.admin.v2.HotTablet) ListHotTabletsPagedResponse(com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListHotTabletsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) ListHotTabletsRequest(com.google.bigtable.admin.v2.ListHotTabletsRequest) ByteString(com.google.protobuf.ByteString) ListHotTabletsResponse(com.google.bigtable.admin.v2.ListHotTabletsResponse) Test(org.junit.Test)

Aggregations

HotTablet (com.google.bigtable.admin.v2.HotTablet)2 ListHotTabletsRequest (com.google.bigtable.admin.v2.ListHotTabletsRequest)2 ListHotTabletsResponse (com.google.bigtable.admin.v2.ListHotTabletsResponse)2 ListHotTabletsPagedResponse (com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListHotTabletsPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2 ClusterName (com.google.bigtable.admin.v2.ClusterName)1 ByteString (com.google.protobuf.ByteString)1