mirror of https://github.com/grpc/grpc-java.git
cronet: Fix compilation errors
This commit is contained in:
parent
aeaced1c5d
commit
09a7a22210
|
|
@ -17,6 +17,7 @@
|
||||||
package io.grpc.cronet;
|
package io.grpc.cronet;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
|
|
@ -37,7 +38,6 @@ import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.concurrent.GuardedBy;
|
import javax.annotation.concurrent.GuardedBy;
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ class CronetClientTransport implements ConnectionClientTransport, InternalWithLo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Future<InternalTransportStats> getTransportStats() {
|
public ListenableFuture<InternalTransportStats> getStats() {
|
||||||
SettableFuture<InternalTransportStats> f = SettableFuture.create();
|
SettableFuture<InternalTransportStats> f = SettableFuture.create();
|
||||||
f.set(null);
|
f.set(null);
|
||||||
return f;
|
return f;
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ public final class CronetClientStreamTest {
|
||||||
buffers[i] = allocator.allocate(requests[i].length());
|
buffers[i] = allocator.allocate(requests[i].length());
|
||||||
buffers[i].write(requests[i].getBytes(Charset.forName("UTF-8")), 0, requests[i].length());
|
buffers[i].write(requests[i].getBytes(Charset.forName("UTF-8")), 0, requests[i].length());
|
||||||
// The 3rd and 5th writeFrame calls have flush=true.
|
// The 3rd and 5th writeFrame calls have flush=true.
|
||||||
clientStream.abstractClientStreamSink().writeFrame(buffers[i], false, i == 2 || i == 4);
|
clientStream.abstractClientStreamSink().writeFrame(buffers[i], false, i == 2 || i == 4, 1);
|
||||||
}
|
}
|
||||||
// BidirectionalStream.write is not called because stream is not ready yet.
|
// BidirectionalStream.write is not called because stream is not ready yet.
|
||||||
verify(cronetStream, times(0)).write(isA(ByteBuffer.class), isA(Boolean.class));
|
verify(cronetStream, times(0)).write(isA(ByteBuffer.class), isA(Boolean.class));
|
||||||
|
|
@ -187,7 +187,7 @@ public final class CronetClientStreamTest {
|
||||||
verify(cronetStream, times(5)).write(isA(ByteBuffer.class), eq(false));
|
verify(cronetStream, times(5)).write(isA(ByteBuffer.class), eq(false));
|
||||||
|
|
||||||
// Send end of stream. write will be immediately called since stream is ready.
|
// Send end of stream. write will be immediately called since stream is ready.
|
||||||
clientStream.abstractClientStreamSink().writeFrame(null, true, true);
|
clientStream.abstractClientStreamSink().writeFrame(null, true, true, 1);
|
||||||
verify(cronetStream, times(1)).write(isA(ByteBuffer.class), eq(true));
|
verify(cronetStream, times(1)).write(isA(ByteBuffer.class), eq(true));
|
||||||
verify(cronetStream, times(3)).flush();
|
verify(cronetStream, times(3)).flush();
|
||||||
}
|
}
|
||||||
|
|
@ -286,7 +286,7 @@ public final class CronetClientStreamTest {
|
||||||
String request = new String("request");
|
String request = new String("request");
|
||||||
WritableBuffer writableBuffer = allocator.allocate(request.length());
|
WritableBuffer writableBuffer = allocator.allocate(request.length());
|
||||||
writableBuffer.write(request.getBytes(Charset.forName("UTF-8")), 0, request.length());
|
writableBuffer.write(request.getBytes(Charset.forName("UTF-8")), 0, request.length());
|
||||||
clientStream.abstractClientStreamSink().writeFrame(writableBuffer, false, true);
|
clientStream.abstractClientStreamSink().writeFrame(writableBuffer, false, true, 1);
|
||||||
ArgumentCaptor<ByteBuffer> bufferCaptor = ArgumentCaptor.forClass(ByteBuffer.class);
|
ArgumentCaptor<ByteBuffer> bufferCaptor = ArgumentCaptor.forClass(ByteBuffer.class);
|
||||||
verify(cronetStream, times(1)).write(bufferCaptor.capture(), isA(Boolean.class));
|
verify(cronetStream, times(1)).write(bufferCaptor.capture(), isA(Boolean.class));
|
||||||
ByteBuffer buffer = bufferCaptor.getValue();
|
ByteBuffer buffer = bufferCaptor.getValue();
|
||||||
|
|
@ -311,7 +311,7 @@ public final class CronetClientStreamTest {
|
||||||
|
|
||||||
// Send endOfStream
|
// Send endOfStream
|
||||||
callback.onWriteCompleted(cronetStream, null, buffer, false);
|
callback.onWriteCompleted(cronetStream, null, buffer, false);
|
||||||
clientStream.abstractClientStreamSink().writeFrame(null, true, true);
|
clientStream.abstractClientStreamSink().writeFrame(null, true, true, 1);
|
||||||
verify(cronetStream, times(2)).write(isA(ByteBuffer.class), isA(Boolean.class));
|
verify(cronetStream, times(2)).write(isA(ByteBuffer.class), isA(Boolean.class));
|
||||||
verify(cronetStream, times(2)).flush();
|
verify(cronetStream, times(2)).flush();
|
||||||
|
|
||||||
|
|
@ -346,7 +346,7 @@ public final class CronetClientStreamTest {
|
||||||
|
|
||||||
callback.onStreamReady(cronetStream);
|
callback.onStreamReady(cronetStream);
|
||||||
verify(cronetStream, times(0)).write(isA(ByteBuffer.class), isA(Boolean.class));
|
verify(cronetStream, times(0)).write(isA(ByteBuffer.class), isA(Boolean.class));
|
||||||
clientStream.abstractClientStreamSink().writeFrame(null, true, true);
|
clientStream.abstractClientStreamSink().writeFrame(null, true, true, 1);
|
||||||
verify(cronetStream, times(1)).write(isA(ByteBuffer.class), isA(Boolean.class));
|
verify(cronetStream, times(1)).write(isA(ByteBuffer.class), isA(Boolean.class));
|
||||||
verify(cronetStream, times(1)).flush();
|
verify(cronetStream, times(1)).flush();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue