Search in sources :

Example 1 with ListAppProfilesResponse

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

the class BaseBigtableInstanceAdminClientTest method listAppProfilesTest2.

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

Example 2 with ListAppProfilesResponse

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

the class BaseBigtableInstanceAdminClientTest method listAppProfilesTest.

@Test
public void listAppProfilesTest() throws Exception {
    AppProfile responsesElement = AppProfile.newBuilder().build();
    ListAppProfilesResponse expectedResponse = ListAppProfilesResponse.newBuilder().setNextPageToken("").addAllAppProfiles(Arrays.asList(responsesElement)).build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
    ListAppProfilesPagedResponse pagedListResponse = client.listAppProfiles(parent);
    List<AppProfile> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getAppProfilesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListAppProfilesRequest actualRequest = ((ListAppProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : InstanceName(com.google.bigtable.admin.v2.InstanceName) AbstractMessage(com.google.protobuf.AbstractMessage) ListAppProfilesPagedResponse(com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListAppProfilesPagedResponse) AppProfile(com.google.bigtable.admin.v2.AppProfile) ListAppProfilesRequest(com.google.bigtable.admin.v2.ListAppProfilesRequest) ListAppProfilesResponse(com.google.bigtable.admin.v2.ListAppProfilesResponse) Test(org.junit.Test)

Aggregations

AppProfile (com.google.bigtable.admin.v2.AppProfile)2 ListAppProfilesRequest (com.google.bigtable.admin.v2.ListAppProfilesRequest)2 ListAppProfilesResponse (com.google.bigtable.admin.v2.ListAppProfilesResponse)2 ListAppProfilesPagedResponse (com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListAppProfilesPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2 InstanceName (com.google.bigtable.admin.v2.InstanceName)1 ByteString (com.google.protobuf.ByteString)1