use of com.google.bigtable.admin.v2.GetAppProfileRequest in project java-bigtable by googleapis.
the class BaseBigtableInstanceAdminClientTest method getAppProfileTest.
@Test
public void getAppProfileTest() throws Exception {
AppProfile expectedResponse = AppProfile.newBuilder().setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()).setEtag("etag3123477").setDescription("description-1724546052").build();
mockBigtableInstanceAdmin.addResponse(expectedResponse);
AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
AppProfile actualResponse = client.getAppProfile(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetAppProfileRequest actualRequest = ((GetAppProfileRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.GetAppProfileRequest in project java-bigtable by googleapis.
the class BaseBigtableInstanceAdminClientTest method getAppProfileTest2.
@Test
public void getAppProfileTest2() throws Exception {
AppProfile expectedResponse = AppProfile.newBuilder().setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()).setEtag("etag3123477").setDescription("description-1724546052").build();
mockBigtableInstanceAdmin.addResponse(expectedResponse);
String name = "name3373707";
AppProfile actualResponse = client.getAppProfile(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetAppProfileRequest actualRequest = ((GetAppProfileRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.GetAppProfileRequest in project java-bigtable by googleapis.
the class BigtableInstanceAdminClient method getAppProfileAsync.
/**
* Asynchronously gets the app profile by ID.
*
* <p>Sample code:
*
* <pre>{@code
* ApiFuture<AppProfile> appProfileFuture = client.getAppProfileAsync("my-instance", "my-app-profile");
*
* AppProfile appProfile = appProfileFuture.get();
* }</pre>
*
* @see AppProfile
*/
@SuppressWarnings("WeakerAccess")
public ApiFuture<AppProfile> getAppProfileAsync(String instanceId, String appProfileId) {
String name = NameUtil.formatAppProfileName(projectId, instanceId, appProfileId);
GetAppProfileRequest request = GetAppProfileRequest.newBuilder().setName(name).build();
return ApiFutures.transform(stub.getAppProfileCallable().futureCall(request), new ApiFunction<com.google.bigtable.admin.v2.AppProfile, AppProfile>() {
@Override
public AppProfile apply(com.google.bigtable.admin.v2.AppProfile proto) {
return AppProfile.fromProto(proto);
}
}, MoreExecutors.directExecutor());
}
Aggregations