use of com.google.api.gax.rpc.InternalException in project java-bigquerystorage by googleapis.
the class BigQueryReadClientTest method readRowsRetryingEOSExceptionTest.
@Test
@SuppressWarnings("all")
public void readRowsRetryingEOSExceptionTest() throws ExecutionException, InterruptedException {
ApiException exception = new InternalException(new StatusRuntimeException(Status.INTERNAL.withDescription("Received unexpected EOS on DATA frame from server")), GrpcStatusCode.of(Code.INTERNAL), /* retryable = */
false);
mockBigQueryRead.addException(exception);
long rowCount = 1340416618L;
ReadRowsResponse expectedResponse = ReadRowsResponse.newBuilder().setRowCount(rowCount).build();
mockBigQueryRead.addResponse(expectedResponse);
ReadRowsRequest request = ReadRowsRequest.newBuilder().build();
MockStreamObserver<ReadRowsResponse> responseObserver = new MockStreamObserver<>();
ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> callable = client.readRowsCallable();
callable.serverStreamingCall(request, responseObserver);
List<ReadRowsResponse> actualResponses = responseObserver.future().get();
Assert.assertEquals(1, actualResponses.size());
Assert.assertEquals(retryCount, 1);
Assert.assertEquals(lastRetryStatusCode, Code.INTERNAL);
}
use of com.google.api.gax.rpc.InternalException in project java-bigquerystorage by googleapis.
the class BigQueryReadClientTest method readRowsRetryingHttp2StreamRstTest.
@Test
@SuppressWarnings("all")
public void readRowsRetryingHttp2StreamRstTest() throws ExecutionException, InterruptedException {
ApiException exception = new InternalException(new StatusRuntimeException(Status.INTERNAL.withDescription("HTTP/2 error code: INTERNAL_ERROR\nReceived Rst Stream")), GrpcStatusCode.of(Code.INTERNAL), /* retryable = */
false);
mockBigQueryRead.addException(exception);
long rowCount = 1340416618L;
ReadRowsResponse expectedResponse = ReadRowsResponse.newBuilder().setRowCount(rowCount).build();
mockBigQueryRead.addResponse(expectedResponse);
ReadRowsRequest request = ReadRowsRequest.newBuilder().build();
MockStreamObserver<ReadRowsResponse> responseObserver = new MockStreamObserver<>();
ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> callable = client.readRowsCallable();
callable.serverStreamingCall(request, responseObserver);
List<ReadRowsResponse> actualResponses = responseObserver.future().get();
Assert.assertEquals(1, actualResponses.size());
Assert.assertEquals(retryCount, 1);
Assert.assertEquals(lastRetryStatusCode, Code.INTERNAL);
}
use of com.google.api.gax.rpc.InternalException in project java-bigquerystorage by googleapis.
the class BigQueryStorageClientTest method readRowsRetryingEOSExceptionTest.
@Test
@SuppressWarnings("all")
public void readRowsRetryingEOSExceptionTest() throws ExecutionException, InterruptedException {
ApiException exception = new InternalException(new StatusRuntimeException(Status.INTERNAL.withDescription("Received unexpected EOS on DATA frame from server")), GrpcStatusCode.of(Code.INTERNAL), /* retryable = */
false);
mockBigQueryStorage.addException(exception);
long rowCount = 1340416618L;
ReadRowsResponse expectedResponse = ReadRowsResponse.newBuilder().setRowCount(rowCount).build();
mockBigQueryStorage.addResponse(expectedResponse);
ReadRowsRequest request = ReadRowsRequest.newBuilder().build();
MockStreamObserver<ReadRowsResponse> responseObserver = new MockStreamObserver<>();
ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> callable = client.readRowsCallable();
callable.serverStreamingCall(request, responseObserver);
List<ReadRowsResponse> actualResponses = responseObserver.future().get();
Assert.assertEquals(1, actualResponses.size());
Assert.assertEquals(retryCount, 1);
Assert.assertEquals(lastRetryStatusCode, Code.INTERNAL);
}
use of com.google.api.gax.rpc.InternalException in project java-bigquerystorage by googleapis.
the class BigQueryStorageClientTest method readRowsRetryingHttp2StreamRstTest.
@Test
@SuppressWarnings("all")
public void readRowsRetryingHttp2StreamRstTest() throws ExecutionException, InterruptedException {
ApiException exception = new InternalException(new StatusRuntimeException(Status.INTERNAL.withDescription("HTTP/2 error code: INTERNAL_ERROR\nReceived Rst Stream")), GrpcStatusCode.of(Code.INTERNAL), /* retryable = */
false);
mockBigQueryStorage.addException(exception);
long rowCount = 1340416618L;
ReadRowsResponse expectedResponse = ReadRowsResponse.newBuilder().setRowCount(rowCount).build();
mockBigQueryStorage.addResponse(expectedResponse);
ReadRowsRequest request = ReadRowsRequest.newBuilder().build();
MockStreamObserver<ReadRowsResponse> responseObserver = new MockStreamObserver<>();
ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> callable = client.readRowsCallable();
callable.serverStreamingCall(request, responseObserver);
List<ReadRowsResponse> actualResponses = responseObserver.future().get();
Assert.assertEquals(1, actualResponses.size());
Assert.assertEquals(retryCount, 1);
Assert.assertEquals(lastRetryStatusCode, Code.INTERNAL);
}
use of com.google.api.gax.rpc.InternalException in project java-bigquerystorage by googleapis.
the class BigQueryReadClientTest method readRowsRetryingEOSExceptionTest.
@Test
@SuppressWarnings("all")
public void readRowsRetryingEOSExceptionTest() throws ExecutionException, InterruptedException {
ApiException exception = new InternalException(new StatusRuntimeException(Status.INTERNAL.withDescription("Received unexpected EOS on DATA frame from server")), GrpcStatusCode.of(Code.INTERNAL), /* retryable = */
false);
mockBigQueryRead.addException(exception);
long rowCount = 1340416618L;
ReadRowsResponse expectedResponse = ReadRowsResponse.newBuilder().setRowCount(rowCount).build();
mockBigQueryRead.addResponse(expectedResponse);
ReadRowsRequest request = ReadRowsRequest.newBuilder().build();
MockStreamObserver<ReadRowsResponse> responseObserver = new MockStreamObserver<>();
ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> callable = client.readRowsCallable();
callable.serverStreamingCall(request, responseObserver);
List<ReadRowsResponse> actualResponses = responseObserver.future().get();
Assert.assertEquals(1, actualResponses.size());
Assert.assertEquals(retryCount, 1);
Assert.assertEquals(lastRetryStatusCode, Code.INTERNAL);
}
Aggregations