use of com.google.bigtable.admin.v2.ListHotTabletsResponse 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()));
}
use of com.google.bigtable.admin.v2.ListHotTabletsResponse 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()));
}
Aggregations