From 3db8085fb0c4ada19d3fc438e52ecb667995ed92 Mon Sep 17 00:00:00 2001 From: Michael Darakananda Date: Mon, 4 Jun 2018 19:21:27 -0700 Subject: [PATCH] bigtable: delete unnecessary test class (#3342) The file was copied from gax to help test BigTable. However, the deleted class isn't actually used anywhere, and will fail to compile when we update gax to stabilize bidi-streaming API. This commit simply deletes the problematic class. If we need it later to test BigTable, we can just copy it again. In this way, we don't need to go through the complicated breaking-change release process. --- .../gaxx/testing/FakeStreamingApi.java | 79 ------------------- 1 file changed, 79 deletions(-) diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/gaxx/testing/FakeStreamingApi.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/gaxx/testing/FakeStreamingApi.java index 4cda9d40b681..20c3a766372f 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/gaxx/testing/FakeStreamingApi.java +++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/gaxx/testing/FakeStreamingApi.java @@ -19,7 +19,6 @@ import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiExceptionFactory; import com.google.api.gax.rpc.ApiStreamObserver; -import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.ClientStreamingCallable; import com.google.api.gax.rpc.ResponseObserver; import com.google.api.gax.rpc.ServerStreamingCallable; @@ -36,84 +35,6 @@ @InternalApi("for testing") public class FakeStreamingApi { - - public static class BidiStreamingStashCallable - extends BidiStreamingCallable { - private ApiCallContext context; - private ApiStreamObserver responseObserver; - private AccumulatingStreamObserver requestObserver; - private List responseList; - - public BidiStreamingStashCallable() { - responseList = new ArrayList<>(); - } - - public BidiStreamingStashCallable(List responseList) { - this.responseList = responseList; - } - - @Override - public ApiStreamObserver bidiStreamingCall( - ApiStreamObserver responseObserver, ApiCallContext context) { - Preconditions.checkNotNull(responseObserver); - this.responseObserver = responseObserver; - this.context = context; - this.requestObserver = new AccumulatingStreamObserver<>(); - return requestObserver; - } - - public ApiCallContext getContext() { - return context; - } - - public ApiStreamObserver getActualObserver() { - return responseObserver; - } - - public List getActualRequests() { - return requestObserver.getValues(); - } - - private void sendResponses() { - for (ResponseT response : responseList) { - responseObserver.onNext(response); - } - responseObserver.onCompleted(); - } - - private class AccumulatingStreamObserver implements ApiStreamObserver { - private List requestList = new ArrayList<>(); - private Throwable error; - private boolean completed = false; - - @Override - public void onNext(T value) { - requestList.add(value); - } - - @Override - public void onError(Throwable t) { - error = t; - } - - @Override - public void onCompleted() { - completed = true; - BidiStreamingStashCallable.this.sendResponses(); - } - - public List getValues() { - if (!completed) { - throw new IllegalStateException("Stream not completed."); - } - if (error != null) { - throw ApiExceptionFactory.createException(error, FakeStatusCode.of(Code.UNKNOWN), false); - } - return requestList; - } - } - } - public static class ServerStreamingStashCallable extends ServerStreamingCallable { private ApiCallContext context;