use of com.google.logging.v2.UndeleteBucketRequest in project gapic-generator-java by googleapis.
the class ConfigClientTest method undeleteBucketTest.
@Test
public void undeleteBucketTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockConfigServiceV2.addResponse(expectedResponse);
UndeleteBucketRequest request = UndeleteBucketRequest.newBuilder().setName(LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]").toString()).build();
client.undeleteBucket(request);
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
UndeleteBucketRequest actualRequest = ((UndeleteBucketRequest) actualRequests.get(0));
Assert.assertEquals(request.getName(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.logging.v2.UndeleteBucketRequest in project gapic-generator-java by googleapis.
the class ConfigClientTest method undeleteBucketExceptionTest.
@Test
public void undeleteBucketExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
UndeleteBucketRequest request = UndeleteBucketRequest.newBuilder().setName(LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]").toString()).build();
client.undeleteBucket(request);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.logging.v2.UndeleteBucketRequest in project gapic-generator-java by googleapis.
the class AsyncUndeleteBucket method asyncUndeleteBucket.
public static void asyncUndeleteBucket() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
UndeleteBucketRequest request = UndeleteBucketRequest.newBuilder().setName(LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]").toString()).build();
ApiFuture<Empty> future = configClient.undeleteBucketCallable().futureCall(request);
// Do something.
future.get();
}
}
use of com.google.logging.v2.UndeleteBucketRequest in project java-logging by googleapis.
the class ConfigClientTest method undeleteBucketExceptionTest.
@Test
public void undeleteBucketExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
UndeleteBucketRequest request = UndeleteBucketRequest.newBuilder().setName(LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]").toString()).build();
client.undeleteBucket(request);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.logging.v2.UndeleteBucketRequest in project java-logging by googleapis.
the class ConfigClientTest method undeleteBucketTest.
@Test
public void undeleteBucketTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockConfigServiceV2.addResponse(expectedResponse);
UndeleteBucketRequest request = UndeleteBucketRequest.newBuilder().setName(LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]").toString()).build();
client.undeleteBucket(request);
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
UndeleteBucketRequest actualRequest = ((UndeleteBucketRequest) actualRequests.get(0));
Assert.assertEquals(request.getName(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations