Search in sources :

Example 11 with AppProfile

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

the class BaseBigtableInstanceAdminClientTest method createAppProfileTest2.

@Test
public void createAppProfileTest2() throws Exception {
    AppProfile expectedResponse = AppProfile.newBuilder().setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()).setEtag("etag3123477").setDescription("description-1724546052").build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    String parent = "parent-995424086";
    String appProfileId = "appProfileId704923523";
    AppProfile appProfile = AppProfile.newBuilder().build();
    AppProfile actualResponse = client.createAppProfile(parent, appProfileId, appProfile);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateAppProfileRequest actualRequest = ((CreateAppProfileRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(appProfileId, actualRequest.getAppProfileId());
    Assert.assertEquals(appProfile, actualRequest.getAppProfile());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) AppProfile(com.google.bigtable.admin.v2.AppProfile) CreateAppProfileRequest(com.google.bigtable.admin.v2.CreateAppProfileRequest) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 12 with AppProfile

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

the class BaseBigtableInstanceAdminClientTest method createAppProfileTest.

@Test
public void createAppProfileTest() throws Exception {
    AppProfile expectedResponse = AppProfile.newBuilder().setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()).setEtag("etag3123477").setDescription("description-1724546052").build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
    String appProfileId = "appProfileId704923523";
    AppProfile appProfile = AppProfile.newBuilder().build();
    AppProfile actualResponse = client.createAppProfile(parent, appProfileId, appProfile);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateAppProfileRequest actualRequest = ((CreateAppProfileRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(appProfileId, actualRequest.getAppProfileId());
    Assert.assertEquals(appProfile, actualRequest.getAppProfile());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : InstanceName(com.google.bigtable.admin.v2.InstanceName) AbstractMessage(com.google.protobuf.AbstractMessage) AppProfile(com.google.bigtable.admin.v2.AppProfile) CreateAppProfileRequest(com.google.bigtable.admin.v2.CreateAppProfileRequest) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Aggregations

AppProfile (com.google.bigtable.admin.v2.AppProfile)10 Test (org.junit.Test)10 AbstractMessage (com.google.protobuf.AbstractMessage)7 ByteString (com.google.protobuf.ByteString)6 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)3 GetAppProfileRequest (com.google.bigtable.admin.v2.GetAppProfileRequest)3 InstanceName (com.google.bigtable.admin.v2.InstanceName)3 ListAppProfilesRequest (com.google.bigtable.admin.v2.ListAppProfilesRequest)3 ListAppProfilesPagedResponse (com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListAppProfilesPagedResponse)3 StatusRuntimeException (io.grpc.StatusRuntimeException)3 CreateAppProfileRequest (com.google.bigtable.admin.v2.CreateAppProfileRequest)2 ListAppProfilesResponse (com.google.bigtable.admin.v2.ListAppProfilesResponse)2 AppProfile (com.google.cloud.bigtable.admin.v2.models.AppProfile)2 FieldMask (com.google.protobuf.FieldMask)2 ApiFuture (com.google.api.core.ApiFuture)1 AppProfileName (com.google.bigtable.admin.v2.AppProfileName)1 UpdateAppProfileRequest (com.google.bigtable.admin.v2.UpdateAppProfileRequest)1 ListAppProfilesPage (com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListAppProfilesPage)1 ImmutableList (com.google.common.collect.ImmutableList)1 Operation (com.google.longrunning.Operation)1