Search in sources :

Example 1 with ListBackupsResponse

use of com.google.bigtable.admin.v2.ListBackupsResponse in project java-bigtable by googleapis.

the class BaseBigtableTableAdminClientTest method listBackupsTest2.

@Test
public void listBackupsTest2() throws Exception {
    Backup responsesElement = Backup.newBuilder().build();
    ListBackupsResponse expectedResponse = ListBackupsResponse.newBuilder().setNextPageToken("").addAllBackups(Arrays.asList(responsesElement)).build();
    mockBigtableTableAdmin.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListBackupsPagedResponse pagedListResponse = client.listBackups(parent);
    List<Backup> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getBackupsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockBigtableTableAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListBackupsRequest actualRequest = ((ListBackupsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) Backup(com.google.bigtable.admin.v2.Backup) ListBackupsRequest(com.google.bigtable.admin.v2.ListBackupsRequest) ListBackupsResponse(com.google.bigtable.admin.v2.ListBackupsResponse) ListBackupsPagedResponse(com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListBackupsPagedResponse) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 2 with ListBackupsResponse

use of com.google.bigtable.admin.v2.ListBackupsResponse in project java-bigtable by googleapis.

the class BaseBigtableTableAdminClientTest method listBackupsTest.

@Test
public void listBackupsTest() throws Exception {
    Backup responsesElement = Backup.newBuilder().build();
    ListBackupsResponse expectedResponse = ListBackupsResponse.newBuilder().setNextPageToken("").addAllBackups(Arrays.asList(responsesElement)).build();
    mockBigtableTableAdmin.addResponse(expectedResponse);
    ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
    ListBackupsPagedResponse pagedListResponse = client.listBackups(parent);
    List<Backup> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getBackupsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockBigtableTableAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListBackupsRequest actualRequest = ((ListBackupsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) Backup(com.google.bigtable.admin.v2.Backup) ListBackupsRequest(com.google.bigtable.admin.v2.ListBackupsRequest) ClusterName(com.google.bigtable.admin.v2.ClusterName) ListBackupsResponse(com.google.bigtable.admin.v2.ListBackupsResponse) ListBackupsPagedResponse(com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListBackupsPagedResponse) Test(org.junit.Test)

Aggregations

Backup (com.google.bigtable.admin.v2.Backup)2 ListBackupsRequest (com.google.bigtable.admin.v2.ListBackupsRequest)2 ListBackupsResponse (com.google.bigtable.admin.v2.ListBackupsResponse)2 ListBackupsPagedResponse (com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListBackupsPagedResponse)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