Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update java microgenerator to 1.0.2 Adds request initialization to sample code #938

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void reset() {
@Override
public void createReadSession(
CreateReadSessionRequest request, StreamObserver<ReadSession> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof ReadSession) {
requests.add(request);
responseObserver.onNext(((ReadSession) response));
Expand All @@ -73,15 +73,15 @@ public void createReadSession(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method CreateReadSession, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
ReadSession.class.getName(),
Exception.class.getName())));
}
}

@Override
public void readRows(ReadRowsRequest request, StreamObserver<ReadRowsResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof ReadRowsResponse) {
requests.add(request);
responseObserver.onNext(((ReadRowsResponse) response));
Expand All @@ -93,7 +93,7 @@ public void readRows(ReadRowsRequest request, StreamObserver<ReadRowsResponse> r
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method ReadRows, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
ReadRowsResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -102,7 +102,7 @@ public void readRows(ReadRowsRequest request, StreamObserver<ReadRowsResponse> r
@Override
public void splitReadStream(
SplitReadStreamRequest request, StreamObserver<SplitReadStreamResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof SplitReadStreamResponse) {
requests.add(request);
responseObserver.onNext(((SplitReadStreamResponse) response));
Expand All @@ -114,7 +114,7 @@ public void splitReadStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method SplitReadStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
SplitReadStreamResponse.class.getName(),
Exception.class.getName())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void reset() {
public void createWriteStream(
Storage.CreateWriteStreamRequest request,
StreamObserver<Stream.WriteStream> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Stream.WriteStream) {
requests.add(request);
responseObserver.onNext(((Stream.WriteStream) response));
Expand All @@ -74,7 +74,7 @@ public void createWriteStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method CreateWriteStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Stream.WriteStream.class.getName(),
Exception.class.getName())));
}
Expand All @@ -98,7 +98,7 @@ public void onNext(Storage.AppendRowsRequest value) {
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method AppendRows, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Storage.AppendRowsResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -120,7 +120,7 @@ public void onCompleted() {
@Override
public void getWriteStream(
Storage.GetWriteStreamRequest request, StreamObserver<Stream.WriteStream> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Stream.WriteStream) {
requests.add(request);
responseObserver.onNext(((Stream.WriteStream) response));
Expand All @@ -132,7 +132,7 @@ public void getWriteStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method GetWriteStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Stream.WriteStream.class.getName(),
Exception.class.getName())));
}
Expand All @@ -142,7 +142,7 @@ public void getWriteStream(
public void finalizeWriteStream(
Storage.FinalizeWriteStreamRequest request,
StreamObserver<Storage.FinalizeWriteStreamResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Storage.FinalizeWriteStreamResponse) {
requests.add(request);
responseObserver.onNext(((Storage.FinalizeWriteStreamResponse) response));
Expand All @@ -154,7 +154,7 @@ public void finalizeWriteStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method FinalizeWriteStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Storage.FinalizeWriteStreamResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -164,7 +164,7 @@ public void finalizeWriteStream(
public void batchCommitWriteStreams(
Storage.BatchCommitWriteStreamsRequest request,
StreamObserver<Storage.BatchCommitWriteStreamsResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Storage.BatchCommitWriteStreamsResponse) {
requests.add(request);
responseObserver.onNext(((Storage.BatchCommitWriteStreamsResponse) response));
Expand All @@ -176,7 +176,7 @@ public void batchCommitWriteStreams(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method BatchCommitWriteStreams, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Storage.BatchCommitWriteStreamsResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -186,7 +186,7 @@ public void batchCommitWriteStreams(
public void flushRows(
Storage.FlushRowsRequest request,
StreamObserver<Storage.FlushRowsResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Storage.FlushRowsResponse) {
requests.add(request);
responseObserver.onNext(((Storage.FlushRowsResponse) response));
Expand All @@ -198,7 +198,7 @@ public void flushRows(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method FlushRows, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Storage.FlushRowsResponse.class.getName(),
Exception.class.getName())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void reset() {
public void createReadSession(
Storage.CreateReadSessionRequest request,
StreamObserver<Storage.ReadSession> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Storage.ReadSession) {
requests.add(request);
responseObserver.onNext(((Storage.ReadSession) response));
Expand All @@ -75,7 +75,7 @@ public void createReadSession(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method CreateReadSession, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Storage.ReadSession.class.getName(),
Exception.class.getName())));
}
Expand All @@ -84,7 +84,7 @@ public void createReadSession(
@Override
public void readRows(
Storage.ReadRowsRequest request, StreamObserver<Storage.ReadRowsResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Storage.ReadRowsResponse) {
requests.add(request);
responseObserver.onNext(((Storage.ReadRowsResponse) response));
Expand All @@ -96,7 +96,7 @@ public void readRows(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method ReadRows, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Storage.ReadRowsResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -106,7 +106,7 @@ public void readRows(
public void batchCreateReadSessionStreams(
Storage.BatchCreateReadSessionStreamsRequest request,
StreamObserver<Storage.BatchCreateReadSessionStreamsResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Storage.BatchCreateReadSessionStreamsResponse) {
requests.add(request);
responseObserver.onNext(((Storage.BatchCreateReadSessionStreamsResponse) response));
Expand All @@ -118,7 +118,7 @@ public void batchCreateReadSessionStreams(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method BatchCreateReadSessionStreams, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Storage.BatchCreateReadSessionStreamsResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -127,7 +127,7 @@ public void batchCreateReadSessionStreams(
@Override
public void finalizeStream(
Storage.FinalizeStreamRequest request, StreamObserver<Empty> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Empty) {
requests.add(request);
responseObserver.onNext(((Empty) response));
Expand All @@ -139,7 +139,7 @@ public void finalizeStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method FinalizeStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Empty.class.getName(),
Exception.class.getName())));
}
Expand All @@ -149,7 +149,7 @@ public void finalizeStream(
public void splitReadStream(
Storage.SplitReadStreamRequest request,
StreamObserver<Storage.SplitReadStreamResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Storage.SplitReadStreamResponse) {
requests.add(request);
responseObserver.onNext(((Storage.SplitReadStreamResponse) response));
Expand All @@ -161,7 +161,7 @@ public void splitReadStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method SplitReadStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Storage.SplitReadStreamResponse.class.getName(),
Exception.class.getName())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void reset() {
@Override
public void createReadSession(
CreateReadSessionRequest request, StreamObserver<ReadSession> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof ReadSession) {
requests.add(request);
responseObserver.onNext(((ReadSession) response));
Expand All @@ -73,15 +73,15 @@ public void createReadSession(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method CreateReadSession, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
ReadSession.class.getName(),
Exception.class.getName())));
}
}

@Override
public void readRows(ReadRowsRequest request, StreamObserver<ReadRowsResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof ReadRowsResponse) {
requests.add(request);
responseObserver.onNext(((ReadRowsResponse) response));
Expand All @@ -93,7 +93,7 @@ public void readRows(ReadRowsRequest request, StreamObserver<ReadRowsResponse> r
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method ReadRows, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
ReadRowsResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -102,7 +102,7 @@ public void readRows(ReadRowsRequest request, StreamObserver<ReadRowsResponse> r
@Override
public void splitReadStream(
SplitReadStreamRequest request, StreamObserver<SplitReadStreamResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof SplitReadStreamResponse) {
requests.add(request);
responseObserver.onNext(((SplitReadStreamResponse) response));
Expand All @@ -114,7 +114,7 @@ public void splitReadStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method SplitReadStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
SplitReadStreamResponse.class.getName(),
Exception.class.getName())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void reset() {
@Override
public void createWriteStream(
CreateWriteStreamRequest request, StreamObserver<WriteStream> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof WriteStream) {
requests.add(request);
responseObserver.onNext(((WriteStream) response));
Expand All @@ -73,7 +73,7 @@ public void createWriteStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method CreateWriteStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
WriteStream.class.getName(),
Exception.class.getName())));
}
Expand All @@ -97,7 +97,7 @@ public void onNext(AppendRowsRequest value) {
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method AppendRows, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
AppendRowsResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -119,7 +119,7 @@ public void onCompleted() {
@Override
public void getWriteStream(
GetWriteStreamRequest request, StreamObserver<WriteStream> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof WriteStream) {
requests.add(request);
responseObserver.onNext(((WriteStream) response));
Expand All @@ -131,7 +131,7 @@ public void getWriteStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method GetWriteStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
WriteStream.class.getName(),
Exception.class.getName())));
}
Expand All @@ -141,7 +141,7 @@ public void getWriteStream(
public void finalizeWriteStream(
FinalizeWriteStreamRequest request,
StreamObserver<FinalizeWriteStreamResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof FinalizeWriteStreamResponse) {
requests.add(request);
responseObserver.onNext(((FinalizeWriteStreamResponse) response));
Expand All @@ -153,7 +153,7 @@ public void finalizeWriteStream(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method FinalizeWriteStream, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
FinalizeWriteStreamResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -163,7 +163,7 @@ public void finalizeWriteStream(
public void batchCommitWriteStreams(
BatchCommitWriteStreamsRequest request,
StreamObserver<BatchCommitWriteStreamsResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof BatchCommitWriteStreamsResponse) {
requests.add(request);
responseObserver.onNext(((BatchCommitWriteStreamsResponse) response));
Expand All @@ -175,7 +175,7 @@ public void batchCommitWriteStreams(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method BatchCommitWriteStreams, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
BatchCommitWriteStreamsResponse.class.getName(),
Exception.class.getName())));
}
Expand All @@ -184,7 +184,7 @@ public void batchCommitWriteStreams(
@Override
public void flushRows(
FlushRowsRequest request, StreamObserver<FlushRowsResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof FlushRowsResponse) {
requests.add(request);
responseObserver.onNext(((FlushRowsResponse) response));
Expand All @@ -196,7 +196,7 @@ public void flushRows(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method FlushRows, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
FlushRowsResponse.class.getName(),
Exception.class.getName())));
}
Expand Down
Loading