use of io.grpc.testing.integration.Messages.ResponseParameters in project grpc-java by grpc.
the class TestServiceImpl method toChunkQueue.
/**
* Breaks down the request and creates a queue of response chunks for the given request.
*/
public Queue<Chunk> toChunkQueue(StreamingOutputCallRequest request) {
Queue<Chunk> chunkQueue = new LinkedList<Chunk>();
int offset = 0;
boolean compressable = compressableResponse(request.getResponseType());
for (ResponseParameters params : request.getResponseParametersList()) {
chunkQueue.add(new Chunk(params.getIntervalUs(), offset, params.getSize(), compressable));
// Increment the offset past this chunk.
// Both buffers need to be circular.
offset = (offset + params.getSize()) % (compressable ? compressableBuffer.size() : uncompressableBuffer.size());
}
return chunkQueue;
}
use of io.grpc.testing.integration.Messages.ResponseParameters in project grpc-java by grpc.
the class AbstractInteropTest method deadlineExceededServerStreaming.
@Test(timeout = 10000)
public void deadlineExceededServerStreaming() throws Exception {
// warm up the channel and JVM
blockingStub.emptyCall(Empty.getDefaultInstance());
ResponseParameters.Builder responseParameters = ResponseParameters.newBuilder().setSize(1).setIntervalUs(10000);
StreamingOutputCallRequest request = StreamingOutputCallRequest.newBuilder().setResponseType(PayloadType.COMPRESSABLE).addResponseParameters(responseParameters).addResponseParameters(responseParameters).addResponseParameters(responseParameters).addResponseParameters(responseParameters).build();
StreamRecorder<StreamingOutputCallResponse> recorder = StreamRecorder.create();
TestServiceGrpc.newStub(channel).withDeadlineAfter(30, TimeUnit.MILLISECONDS).streamingOutputCall(request, recorder);
recorder.awaitCompletion();
assertEquals(Status.DEADLINE_EXCEEDED.getCode(), Status.fromThrowable(recorder.getError()).getCode());
if (metricsExpected()) {
assertMetrics("grpc.testing.TestService/EmptyCall", Status.Code.OK);
assertClientMetrics("grpc.testing.TestService/StreamingOutputCall", Status.Code.DEADLINE_EXCEEDED);
// Do not check server-side metrics, because the status on the server side is undetermined.
}
}
Aggregations