android-interop-testing: include android interop testing in main build (#6829)

Proto generated code for android-interop-testing is checked in.
This commit is contained in:
Chengyuan Zhang 2020-03-19 12:37:48 -07:00 committed by GitHub
parent e739eeabf9
commit d537adedb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 4258 additions and 157 deletions

View File

@ -32,10 +32,7 @@ them before continuing, and set them again when resuming.
$ MAJOR=1 MINOR=7 PATCH=0 # Set appropriately for new release $ MAJOR=1 MINOR=7 PATCH=0 # Set appropriately for new release
$ VERSION_FILES=( $ VERSION_FILES=(
build.gradle build.gradle
android/build.gradle
android-interop-testing/app/build.gradle
core/src/main/java/io/grpc/internal/GrpcUtil.java core/src/main/java/io/grpc/internal/GrpcUtil.java
cronet/build.gradle
examples/build.gradle examples/build.gradle
examples/pom.xml examples/pom.xml
examples/android/clientcache/app/build.gradle examples/android/clientcache/app/build.gradle

View File

@ -3,8 +3,6 @@ gRPC Android test App
Implements gRPC integration tests in an Android App. Implements gRPC integration tests in an Android App.
TODO(madongfly) integrate this App into the gRPC-Java build system.
In order to build this app, you need a local.properties file under this directory which specifies In order to build this app, you need a local.properties file under this directory which specifies
the location of your android sdk: the location of your android sdk:
``` ```

View File

@ -1,88 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
android {
sourceSets {
main {
java {
srcDirs += "${projectDir}/../../interop-testing/src/main/java/"
setIncludes(["io/grpc/android/integrationtest/**",
"io/grpc/testing/integration/AbstractInteropTest.java",
"io/grpc/testing/integration/TestServiceImpl.java",
"io/grpc/testing/integration/Util.java"])
}
proto {
srcDirs += "${projectDir}/../../interop-testing/src/main/proto/"
}
}
}
compileSdkVersion 26
defaultConfig {
applicationId "io.grpc.android.integrationtest"
// API level 14+ is required for TLS since Google Play Services v10.2
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
debug { minifyEnabled false }
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions { disable 'InvalidPackage', 'HardcodedText' }
}
protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.11.0' }
plugins {
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.29.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
java { option 'lite' }
}
task.plugins {
grpc {
// Options added to --grpc_out
option 'lite'
}
}
}
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation ('com.google.auth:google-auth-library-oauth2-http:0.9.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
implementation 'com.google.truth:truth:1.0.1'
implementation 'javax.annotation:javax.annotation-api:1.2'
implementation 'junit:junit:4.12'
// You need to build grpc-java to obtain the grpc libraries below.
implementation 'io.grpc:grpc-auth:1.29.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-census:1.29.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-okhttp:1.29.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-protobuf-lite:1.29.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-stub:1.29.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-testing:1.29.0-SNAPSHOT' // CURRENT_GRPC_VERSION
androidTestImplementation 'androidx.test:rules:1.1.0-alpha1'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha1'
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:deprecation" }
}

View File

@ -1,53 +1,90 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. plugins {
id "com.android.application"
buildscript { id "com.google.protobuf"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.8"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
} }
allprojects { description = 'gRPC: Android Integration Testing'
repositories {
google() repositories {
mavenLocal() google()
jcenter() jcenter()
}
} }
subprojects { android {
apply plugin: "checkstyle" sourceSets {
main {
checkstyle { java {
configDir = file("$rootDir/../buildscripts") srcDirs += "${projectDir}/../interop-testing/src/main/java/"
toolVersion = "6.17" setIncludes(["io/grpc/android/integrationtest/**",
ignoreFailures = false "io/grpc/testing/integration/AbstractInteropTest.java",
if (rootProject.hasProperty("checkstyle.ignoreFailures")) { "io/grpc/testing/integration/TestServiceImpl.java",
ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean() "io/grpc/testing/integration/Util.java"])
}
proto {
srcDirs += "${projectDir}/../interop-testing/src/main/proto/"
}
} }
} }
compileSdkVersion 26
// Checkstyle doesn't run automatically with android defaultConfig {
task checkStyleMain(type: Checkstyle) { applicationId "io.grpc.android.integrationtest"
source 'src/main/java' // API level 14+ is required for TLS since Google Play Services v10.2
include '**/*.java' minSdkVersion 14
classpath = files() targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
} }
buildTypes {
task checkStyleTest(type: Checkstyle) { debug { minifyEnabled false }
source 'src/test/java' release {
include '**/*.java' minifyEnabled true
classpath = files() proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
afterEvaluate { project ->
project.tasks['check'].dependsOn checkStyleMain, checkStyleTest
} }
lintOptions { disable 'InvalidPackage', 'HardcodedText' }
} }
dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation project(':grpc-auth'),
project(':grpc-census'),
project(':grpc-okhttp'),
project(':grpc-protobuf-lite'),
project(':grpc-stub'),
project(':grpc-testing'),
libraries.junit,
libraries.truth
implementation (libraries.google_auth_oauth2_http) {
exclude group: 'org.apache.httpcomponents'
}
compileOnly libraries.javax_annotation
androidTestImplementation 'androidx.test:rules:1.1.0-alpha1'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha1'
}
// Checkstyle doesn't run automatically with android
task checkStyleMain(type: Checkstyle) {
source 'src/main/java'
include '**/*.java'
classpath = files()
}
task checkStyleTest(type: Checkstyle) {
source 'src/androidTest/java'
include '**/*.java'
classpath = files()
}
project.tasks['check'].dependsOn checkStyleMain, checkStyleTest
configureProtoCompilation()

View File

@ -1 +0,0 @@
include ':app'

View File

@ -0,0 +1,278 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/test.proto")
public final class LoadBalancerStatsServiceGrpc {
private LoadBalancerStatsServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.LoadBalancerStatsService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> getGetClientStatsMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetClientStats",
requestType = io.grpc.testing.integration.Messages.LoadBalancerStatsRequest.class,
responseType = io.grpc.testing.integration.Messages.LoadBalancerStatsResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> getGetClientStatsMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.LoadBalancerStatsRequest, io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> getGetClientStatsMethod;
if ((getGetClientStatsMethod = LoadBalancerStatsServiceGrpc.getGetClientStatsMethod) == null) {
synchronized (LoadBalancerStatsServiceGrpc.class) {
if ((getGetClientStatsMethod = LoadBalancerStatsServiceGrpc.getGetClientStatsMethod) == null) {
LoadBalancerStatsServiceGrpc.getGetClientStatsMethod = getGetClientStatsMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.LoadBalancerStatsRequest, io.grpc.testing.integration.Messages.LoadBalancerStatsResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetClientStats"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse.getDefaultInstance()))
.build();
}
}
}
return getGetClientStatsMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static LoadBalancerStatsServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceStub>() {
@java.lang.Override
public LoadBalancerStatsServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceStub(channel, callOptions);
}
};
return LoadBalancerStatsServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static LoadBalancerStatsServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingStub>() {
@java.lang.Override
public LoadBalancerStatsServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceBlockingStub(channel, callOptions);
}
};
return LoadBalancerStatsServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static LoadBalancerStatsServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceFutureStub>() {
@java.lang.Override
public LoadBalancerStatsServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceFutureStub(channel, callOptions);
}
};
return LoadBalancerStatsServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static abstract class LoadBalancerStatsServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* Gets the backend distribution for RPCs sent by a test client.
* </pre>
*/
public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> responseObserver) {
asyncUnimplementedUnaryCall(getGetClientStatsMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetClientStatsMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse>(
this, METHODID_GET_CLIENT_STATS)))
.build();
}
}
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static final class LoadBalancerStatsServiceStub extends io.grpc.stub.AbstractAsyncStub<LoadBalancerStatsServiceStub> {
private LoadBalancerStatsServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LoadBalancerStatsServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceStub(channel, callOptions);
}
/**
* <pre>
* Gets the backend distribution for RPCs sent by a test client.
* </pre>
*/
public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetClientStatsMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static final class LoadBalancerStatsServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingStub> {
private LoadBalancerStatsServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LoadBalancerStatsServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* Gets the backend distribution for RPCs sent by a test client.
* </pre>
*/
public io.grpc.testing.integration.Messages.LoadBalancerStatsResponse getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request) {
return blockingUnaryCall(
getChannel(), getGetClientStatsMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static final class LoadBalancerStatsServiceFutureStub extends io.grpc.stub.AbstractFutureStub<LoadBalancerStatsServiceFutureStub> {
private LoadBalancerStatsServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LoadBalancerStatsServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* Gets the backend distribution for RPCs sent by a test client.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> getClientStats(
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request) {
return futureUnaryCall(
getChannel().newCall(getGetClientStatsMethod(), getCallOptions()), request);
}
}
private static final int METHODID_GET_CLIENT_STATS = 0;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final LoadBalancerStatsServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(LoadBalancerStatsServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_GET_CLIENT_STATS:
serviceImpl.getClientStats((io.grpc.testing.integration.Messages.LoadBalancerStatsRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (LoadBalancerStatsServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getGetClientStatsMethod())
.build();
}
}
}
return result;
}
}

View File

@ -0,0 +1,341 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/metrics.proto")
public final class MetricsServiceGrpc {
private MetricsServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.MetricsService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse> getGetAllGaugesMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetAllGauges",
requestType = io.grpc.testing.integration.Metrics.EmptyMessage.class,
responseType = io.grpc.testing.integration.Metrics.GaugeResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse> getGetAllGaugesMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage, io.grpc.testing.integration.Metrics.GaugeResponse> getGetAllGaugesMethod;
if ((getGetAllGaugesMethod = MetricsServiceGrpc.getGetAllGaugesMethod) == null) {
synchronized (MetricsServiceGrpc.class) {
if ((getGetAllGaugesMethod = MetricsServiceGrpc.getGetAllGaugesMethod) == null) {
MetricsServiceGrpc.getGetAllGaugesMethod = getGetAllGaugesMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Metrics.EmptyMessage, io.grpc.testing.integration.Metrics.GaugeResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetAllGauges"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Metrics.EmptyMessage.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Metrics.GaugeResponse.getDefaultInstance()))
.build();
}
}
}
return getGetAllGaugesMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse> getGetGaugeMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetGauge",
requestType = io.grpc.testing.integration.Metrics.GaugeRequest.class,
responseType = io.grpc.testing.integration.Metrics.GaugeResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse> getGetGaugeMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest, io.grpc.testing.integration.Metrics.GaugeResponse> getGetGaugeMethod;
if ((getGetGaugeMethod = MetricsServiceGrpc.getGetGaugeMethod) == null) {
synchronized (MetricsServiceGrpc.class) {
if ((getGetGaugeMethod = MetricsServiceGrpc.getGetGaugeMethod) == null) {
MetricsServiceGrpc.getGetGaugeMethod = getGetGaugeMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Metrics.GaugeRequest, io.grpc.testing.integration.Metrics.GaugeResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetGauge"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Metrics.GaugeRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Metrics.GaugeResponse.getDefaultInstance()))
.build();
}
}
}
return getGetGaugeMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static MetricsServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<MetricsServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<MetricsServiceStub>() {
@java.lang.Override
public MetricsServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceStub(channel, callOptions);
}
};
return MetricsServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static MetricsServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingStub>() {
@java.lang.Override
public MetricsServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceBlockingStub(channel, callOptions);
}
};
return MetricsServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static MetricsServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<MetricsServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<MetricsServiceFutureStub>() {
@java.lang.Override
public MetricsServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceFutureStub(channel, callOptions);
}
};
return MetricsServiceFutureStub.newStub(factory, channel);
}
/**
*/
public static abstract class MetricsServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnimplementedUnaryCall(getGetAllGaugesMethod(), responseObserver);
}
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnimplementedUnaryCall(getGetGaugeMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetAllGaugesMethod(),
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse>(
this, METHODID_GET_ALL_GAUGES)))
.addMethod(
getGetGaugeMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse>(
this, METHODID_GET_GAUGE)))
.build();
}
}
/**
*/
public static final class MetricsServiceStub extends io.grpc.stub.AbstractAsyncStub<MetricsServiceStub> {
private MetricsServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected MetricsServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceStub(channel, callOptions);
}
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncServerStreamingCall(
getChannel().newCall(getGetAllGaugesMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetGaugeMethod(), getCallOptions()), request, responseObserver);
}
}
/**
*/
public static final class MetricsServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingStub> {
private MetricsServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected MetricsServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Metrics.GaugeResponse> getAllGauges(
io.grpc.testing.integration.Metrics.EmptyMessage request) {
return blockingServerStreamingCall(
getChannel(), getGetAllGaugesMethod(), getCallOptions(), request);
}
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request) {
return blockingUnaryCall(
getChannel(), getGetGaugeMethod(), getCallOptions(), request);
}
}
/**
*/
public static final class MetricsServiceFutureStub extends io.grpc.stub.AbstractFutureStub<MetricsServiceFutureStub> {
private MetricsServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected MetricsServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Metrics.GaugeResponse> getGauge(
io.grpc.testing.integration.Metrics.GaugeRequest request) {
return futureUnaryCall(
getChannel().newCall(getGetGaugeMethod(), getCallOptions()), request);
}
}
private static final int METHODID_GET_ALL_GAUGES = 0;
private static final int METHODID_GET_GAUGE = 1;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final MetricsServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(MetricsServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_GET_ALL_GAUGES:
serviceImpl.getAllGauges((io.grpc.testing.integration.Metrics.EmptyMessage) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse>) responseObserver);
break;
case METHODID_GET_GAUGE:
serviceImpl.getGauge((io.grpc.testing.integration.Metrics.GaugeRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (MetricsServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getGetAllGaugesMethod())
.addMethod(getGetGaugeMethod())
.build();
}
}
}
return result;
}
}

View File

@ -0,0 +1,339 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/test.proto")
public final class ReconnectServiceGrpc {
private ReconnectServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.ReconnectService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Start",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
synchronized (ReconnectServiceGrpc.class) {
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
ReconnectServiceGrpc.getStartMethod = getStartMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Start"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build();
}
}
}
return getStartMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.Messages.ReconnectInfo> getStopMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Stop",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.Messages.ReconnectInfo.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.Messages.ReconnectInfo> getStopMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.Messages.ReconnectInfo> getStopMethod;
if ((getStopMethod = ReconnectServiceGrpc.getStopMethod) == null) {
synchronized (ReconnectServiceGrpc.class) {
if ((getStopMethod = ReconnectServiceGrpc.getStopMethod) == null) {
ReconnectServiceGrpc.getStopMethod = getStopMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.Messages.ReconnectInfo>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Stop"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.ReconnectInfo.getDefaultInstance()))
.build();
}
}
}
return getStopMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static ReconnectServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceStub>() {
@java.lang.Override
public ReconnectServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceStub(channel, callOptions);
}
};
return ReconnectServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static ReconnectServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingStub>() {
@java.lang.Override
public ReconnectServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceBlockingStub(channel, callOptions);
}
};
return ReconnectServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static ReconnectServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceFutureStub>() {
@java.lang.Override
public ReconnectServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceFutureStub(channel, callOptions);
}
};
return ReconnectServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static abstract class ReconnectServiceImplBase implements io.grpc.BindableService {
/**
*/
public void start(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getStartMethod(), responseObserver);
}
/**
*/
public void stop(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver) {
asyncUnimplementedUnaryCall(getStopMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getStartMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_START)))
.addMethod(
getStopMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.Messages.ReconnectInfo>(
this, METHODID_STOP)))
.build();
}
}
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static final class ReconnectServiceStub extends io.grpc.stub.AbstractAsyncStub<ReconnectServiceStub> {
private ReconnectServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ReconnectServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceStub(channel, callOptions);
}
/**
*/
public void start(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void stop(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getStopMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static final class ReconnectServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<ReconnectServiceBlockingStub> {
private ReconnectServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ReconnectServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceBlockingStub(channel, callOptions);
}
/**
*/
public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getStartMethod(), getCallOptions(), request);
}
/**
*/
public io.grpc.testing.integration.Messages.ReconnectInfo stop(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getStopMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static final class ReconnectServiceFutureStub extends io.grpc.stub.AbstractFutureStub<ReconnectServiceFutureStub> {
private ReconnectServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ReconnectServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceFutureStub(channel, callOptions);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> start(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.ReconnectInfo> stop(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getStopMethod(), getCallOptions()), request);
}
}
private static final int METHODID_START = 0;
private static final int METHODID_STOP = 1;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final ReconnectServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(ReconnectServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_START:
serviceImpl.start((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break;
case METHODID_STOP:
serviceImpl.stop((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (ReconnectServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getStartMethod())
.addMethod(getStopMethod())
.build();
}
}
}
return result;
}
}

View File

@ -0,0 +1,829 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/test.proto")
public final class TestServiceGrpc {
private TestServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.TestService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getEmptyCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "EmptyCall",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getEmptyCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getEmptyCallMethod;
if ((getEmptyCallMethod = TestServiceGrpc.getEmptyCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getEmptyCallMethod = TestServiceGrpc.getEmptyCallMethod) == null) {
TestServiceGrpc.getEmptyCallMethod = getEmptyCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "EmptyCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build();
}
}
}
return getEmptyCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse> getUnaryCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "UnaryCall",
requestType = io.grpc.testing.integration.Messages.SimpleRequest.class,
responseType = io.grpc.testing.integration.Messages.SimpleResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse> getUnaryCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest, io.grpc.testing.integration.Messages.SimpleResponse> getUnaryCallMethod;
if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
TestServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.SimpleRequest, io.grpc.testing.integration.Messages.SimpleResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnaryCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.SimpleRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.SimpleResponse.getDefaultInstance()))
.build();
}
}
}
return getUnaryCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse> getCacheableUnaryCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "CacheableUnaryCall",
requestType = io.grpc.testing.integration.Messages.SimpleRequest.class,
responseType = io.grpc.testing.integration.Messages.SimpleResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse> getCacheableUnaryCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest, io.grpc.testing.integration.Messages.SimpleResponse> getCacheableUnaryCallMethod;
if ((getCacheableUnaryCallMethod = TestServiceGrpc.getCacheableUnaryCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getCacheableUnaryCallMethod = TestServiceGrpc.getCacheableUnaryCallMethod) == null) {
TestServiceGrpc.getCacheableUnaryCallMethod = getCacheableUnaryCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.SimpleRequest, io.grpc.testing.integration.Messages.SimpleResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "CacheableUnaryCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.SimpleRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.SimpleResponse.getDefaultInstance()))
.build();
}
}
}
return getCacheableUnaryCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getStreamingOutputCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "StreamingOutputCall",
requestType = io.grpc.testing.integration.Messages.StreamingOutputCallRequest.class,
responseType = io.grpc.testing.integration.Messages.StreamingOutputCallResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getStreamingOutputCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getStreamingOutputCallMethod;
if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
TestServiceGrpc.getStreamingOutputCallMethod = getStreamingOutputCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingOutputCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallResponse.getDefaultInstance()))
.build();
}
}
}
return getStreamingOutputCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingInputCallRequest,
io.grpc.testing.integration.Messages.StreamingInputCallResponse> getStreamingInputCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "StreamingInputCall",
requestType = io.grpc.testing.integration.Messages.StreamingInputCallRequest.class,
responseType = io.grpc.testing.integration.Messages.StreamingInputCallResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingInputCallRequest,
io.grpc.testing.integration.Messages.StreamingInputCallResponse> getStreamingInputCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingInputCallRequest, io.grpc.testing.integration.Messages.StreamingInputCallResponse> getStreamingInputCallMethod;
if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
TestServiceGrpc.getStreamingInputCallMethod = getStreamingInputCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.StreamingInputCallRequest, io.grpc.testing.integration.Messages.StreamingInputCallResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingInputCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingInputCallRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingInputCallResponse.getDefaultInstance()))
.build();
}
}
}
return getStreamingInputCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getFullDuplexCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "FullDuplexCall",
requestType = io.grpc.testing.integration.Messages.StreamingOutputCallRequest.class,
responseType = io.grpc.testing.integration.Messages.StreamingOutputCallResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getFullDuplexCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getFullDuplexCallMethod;
if ((getFullDuplexCallMethod = TestServiceGrpc.getFullDuplexCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getFullDuplexCallMethod = TestServiceGrpc.getFullDuplexCallMethod) == null) {
TestServiceGrpc.getFullDuplexCallMethod = getFullDuplexCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "FullDuplexCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallResponse.getDefaultInstance()))
.build();
}
}
}
return getFullDuplexCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getHalfDuplexCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "HalfDuplexCall",
requestType = io.grpc.testing.integration.Messages.StreamingOutputCallRequest.class,
responseType = io.grpc.testing.integration.Messages.StreamingOutputCallResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getHalfDuplexCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getHalfDuplexCallMethod;
if ((getHalfDuplexCallMethod = TestServiceGrpc.getHalfDuplexCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getHalfDuplexCallMethod = TestServiceGrpc.getHalfDuplexCallMethod) == null) {
TestServiceGrpc.getHalfDuplexCallMethod = getHalfDuplexCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "HalfDuplexCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallResponse.getDefaultInstance()))
.build();
}
}
}
return getHalfDuplexCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "UnimplementedCall",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod;
if ((getUnimplementedCallMethod = TestServiceGrpc.getUnimplementedCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getUnimplementedCallMethod = TestServiceGrpc.getUnimplementedCallMethod) == null) {
TestServiceGrpc.getUnimplementedCallMethod = getUnimplementedCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnimplementedCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build();
}
}
}
return getUnimplementedCallMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static TestServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TestServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TestServiceStub>() {
@java.lang.Override
public TestServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceStub(channel, callOptions);
}
};
return TestServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static TestServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingStub>() {
@java.lang.Override
public TestServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceBlockingStub(channel, callOptions);
}
};
return TestServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static TestServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TestServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TestServiceFutureStub>() {
@java.lang.Override
public TestServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceFutureStub(channel, callOptions);
}
};
return TestServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static abstract class TestServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public void emptyCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getEmptyCallMethod(), responseObserver);
}
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
}
/**
* <pre>
* One request followed by one response. Response has cache control
* headers set such that a caching HTTP proxy (such as GFE) can
* satisfy subsequent requests.
* </pre>
*/
public void cacheableUnaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(getCacheableUnaryCallMethod(), responseObserver);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(getStreamingOutputCallMethod(), responseObserver);
}
/**
* <pre>
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(getStreamingInputCallMethod(), responseObserver);
}
/**
* <pre>
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full duplexing.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> fullDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(getFullDuplexCallMethod(), responseObserver);
}
/**
* <pre>
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> halfDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(getHalfDuplexCallMethod(), responseObserver);
}
/**
* <pre>
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
* </pre>
*/
public void unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getUnimplementedCallMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getEmptyCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_EMPTY_CALL)))
.addMethod(
getUnaryCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse>(
this, METHODID_UNARY_CALL)))
.addMethod(
getCacheableUnaryCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse>(
this, METHODID_CACHEABLE_UNARY_CALL)))
.addMethod(
getStreamingOutputCallMethod(),
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
this, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
getStreamingInputCallMethod(),
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingInputCallRequest,
io.grpc.testing.integration.Messages.StreamingInputCallResponse>(
this, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
getFullDuplexCallMethod(),
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
this, METHODID_FULL_DUPLEX_CALL)))
.addMethod(
getHalfDuplexCallMethod(),
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
this, METHODID_HALF_DUPLEX_CALL)))
.addMethod(
getUnimplementedCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_UNIMPLEMENTED_CALL)))
.build();
}
}
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static final class TestServiceStub extends io.grpc.stub.AbstractAsyncStub<TestServiceStub> {
private TestServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TestServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceStub(channel, callOptions);
}
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public void emptyCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getEmptyCallMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* One request followed by one response. Response has cache control
* headers set such that a caching HTTP proxy (such as GFE) can
* satisfy subsequent requests.
* </pre>
*/
public void cacheableUnaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getCacheableUnaryCallMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
asyncServerStreamingCall(
getChannel().newCall(getStreamingOutputCallMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse> responseObserver) {
return asyncClientStreamingCall(
getChannel().newCall(getStreamingInputCallMethod(), getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full duplexing.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> fullDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(getFullDuplexCallMethod(), getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> halfDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(getHalfDuplexCallMethod(), getCallOptions()), responseObserver);
}
/**
* <pre>
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
* </pre>
*/
public void unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getUnimplementedCallMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static final class TestServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingStub> {
private TestServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TestServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public io.grpc.testing.integration.EmptyProtos.Empty emptyCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getEmptyCallMethod(), getCallOptions(), request);
}
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public io.grpc.testing.integration.Messages.SimpleResponse unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
return blockingUnaryCall(
getChannel(), getUnaryCallMethod(), getCallOptions(), request);
}
/**
* <pre>
* One request followed by one response. Response has cache control
* headers set such that a caching HTTP proxy (such as GFE) can
* satisfy subsequent requests.
* </pre>
*/
public io.grpc.testing.integration.Messages.SimpleResponse cacheableUnaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
return blockingUnaryCall(
getChannel(), getCacheableUnaryCallMethod(), getCallOptions(), request);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest request) {
return blockingServerStreamingCall(
getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
}
/**
* <pre>
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
* </pre>
*/
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static final class TestServiceFutureStub extends io.grpc.stub.AbstractFutureStub<TestServiceFutureStub> {
private TestServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TestServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> emptyCall(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getEmptyCallMethod(), getCallOptions()), request);
}
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.SimpleResponse> unaryCall(
io.grpc.testing.integration.Messages.SimpleRequest request) {
return futureUnaryCall(
getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
}
/**
* <pre>
* One request followed by one response. Response has cache control
* headers set such that a caching HTTP proxy (such as GFE) can
* satisfy subsequent requests.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.SimpleResponse> cacheableUnaryCall(
io.grpc.testing.integration.Messages.SimpleRequest request) {
return futureUnaryCall(
getChannel().newCall(getCacheableUnaryCallMethod(), getCallOptions()), request);
}
/**
* <pre>
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> unimplementedCall(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getUnimplementedCallMethod(), getCallOptions()), request);
}
}
private static final int METHODID_EMPTY_CALL = 0;
private static final int METHODID_UNARY_CALL = 1;
private static final int METHODID_CACHEABLE_UNARY_CALL = 2;
private static final int METHODID_STREAMING_OUTPUT_CALL = 3;
private static final int METHODID_UNIMPLEMENTED_CALL = 4;
private static final int METHODID_STREAMING_INPUT_CALL = 5;
private static final int METHODID_FULL_DUPLEX_CALL = 6;
private static final int METHODID_HALF_DUPLEX_CALL = 7;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final TestServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(TestServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_EMPTY_CALL:
serviceImpl.emptyCall((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break;
case METHODID_UNARY_CALL:
serviceImpl.unaryCall((io.grpc.testing.integration.Messages.SimpleRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse>) responseObserver);
break;
case METHODID_CACHEABLE_UNARY_CALL:
serviceImpl.cacheableUnaryCall((io.grpc.testing.integration.Messages.SimpleRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse>) responseObserver);
break;
case METHODID_STREAMING_OUTPUT_CALL:
serviceImpl.streamingOutputCall((io.grpc.testing.integration.Messages.StreamingOutputCallRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse>) responseObserver);
break;
case METHODID_UNIMPLEMENTED_CALL:
serviceImpl.unimplementedCall((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_STREAMING_INPUT_CALL:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse>) responseObserver);
case METHODID_FULL_DUPLEX_CALL:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullDuplexCall(
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse>) responseObserver);
case METHODID_HALF_DUPLEX_CALL:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfDuplexCall(
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse>) responseObserver);
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (TestServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getEmptyCallMethod())
.addMethod(getUnaryCallMethod())
.addMethod(getCacheableUnaryCallMethod())
.addMethod(getStreamingOutputCallMethod())
.addMethod(getStreamingInputCallMethod())
.addMethod(getFullDuplexCallMethod())
.addMethod(getHalfDuplexCallMethod())
.addMethod(getUnimplementedCallMethod())
.build();
}
}
}
return result;
}
}

View File

@ -0,0 +1,283 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/test.proto")
public final class UnimplementedServiceGrpc {
private UnimplementedServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.UnimplementedService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "UnimplementedCall",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod;
if ((getUnimplementedCallMethod = UnimplementedServiceGrpc.getUnimplementedCallMethod) == null) {
synchronized (UnimplementedServiceGrpc.class) {
if ((getUnimplementedCallMethod = UnimplementedServiceGrpc.getUnimplementedCallMethod) == null) {
UnimplementedServiceGrpc.getUnimplementedCallMethod = getUnimplementedCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnimplementedCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build();
}
}
}
return getUnimplementedCallMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static UnimplementedServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceStub>() {
@java.lang.Override
public UnimplementedServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceStub(channel, callOptions);
}
};
return UnimplementedServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static UnimplementedServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingStub>() {
@java.lang.Override
public UnimplementedServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceBlockingStub(channel, callOptions);
}
};
return UnimplementedServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static UnimplementedServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceFutureStub>() {
@java.lang.Override
public UnimplementedServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceFutureStub(channel, callOptions);
}
};
return UnimplementedServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static abstract class UnimplementedServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public void unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getUnimplementedCallMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getUnimplementedCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_UNIMPLEMENTED_CALL)))
.build();
}
}
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static final class UnimplementedServiceStub extends io.grpc.stub.AbstractAsyncStub<UnimplementedServiceStub> {
private UnimplementedServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected UnimplementedServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceStub(channel, callOptions);
}
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public void unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getUnimplementedCallMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static final class UnimplementedServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<UnimplementedServiceBlockingStub> {
private UnimplementedServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected UnimplementedServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static final class UnimplementedServiceFutureStub extends io.grpc.stub.AbstractFutureStub<UnimplementedServiceFutureStub> {
private UnimplementedServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected UnimplementedServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> unimplementedCall(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getUnimplementedCallMethod(), getCallOptions()), request);
}
}
private static final int METHODID_UNIMPLEMENTED_CALL = 0;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final UnimplementedServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(UnimplementedServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_UNIMPLEMENTED_CALL:
serviceImpl.unimplementedCall((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (UnimplementedServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getUnimplementedCallMethod())
.build();
}
}
}
return result;
}
}

View File

@ -0,0 +1,278 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/test.proto")
public final class LoadBalancerStatsServiceGrpc {
private LoadBalancerStatsServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.LoadBalancerStatsService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> getGetClientStatsMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetClientStats",
requestType = io.grpc.testing.integration.Messages.LoadBalancerStatsRequest.class,
responseType = io.grpc.testing.integration.Messages.LoadBalancerStatsResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> getGetClientStatsMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.LoadBalancerStatsRequest, io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> getGetClientStatsMethod;
if ((getGetClientStatsMethod = LoadBalancerStatsServiceGrpc.getGetClientStatsMethod) == null) {
synchronized (LoadBalancerStatsServiceGrpc.class) {
if ((getGetClientStatsMethod = LoadBalancerStatsServiceGrpc.getGetClientStatsMethod) == null) {
LoadBalancerStatsServiceGrpc.getGetClientStatsMethod = getGetClientStatsMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.LoadBalancerStatsRequest, io.grpc.testing.integration.Messages.LoadBalancerStatsResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetClientStats"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse.getDefaultInstance()))
.build();
}
}
}
return getGetClientStatsMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static LoadBalancerStatsServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceStub>() {
@java.lang.Override
public LoadBalancerStatsServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceStub(channel, callOptions);
}
};
return LoadBalancerStatsServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static LoadBalancerStatsServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingStub>() {
@java.lang.Override
public LoadBalancerStatsServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceBlockingStub(channel, callOptions);
}
};
return LoadBalancerStatsServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static LoadBalancerStatsServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceFutureStub>() {
@java.lang.Override
public LoadBalancerStatsServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceFutureStub(channel, callOptions);
}
};
return LoadBalancerStatsServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static abstract class LoadBalancerStatsServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* Gets the backend distribution for RPCs sent by a test client.
* </pre>
*/
public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> responseObserver) {
asyncUnimplementedUnaryCall(getGetClientStatsMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetClientStatsMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse>(
this, METHODID_GET_CLIENT_STATS)))
.build();
}
}
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static final class LoadBalancerStatsServiceStub extends io.grpc.stub.AbstractAsyncStub<LoadBalancerStatsServiceStub> {
private LoadBalancerStatsServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LoadBalancerStatsServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceStub(channel, callOptions);
}
/**
* <pre>
* Gets the backend distribution for RPCs sent by a test client.
* </pre>
*/
public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetClientStatsMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static final class LoadBalancerStatsServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingStub> {
private LoadBalancerStatsServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LoadBalancerStatsServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* Gets the backend distribution for RPCs sent by a test client.
* </pre>
*/
public io.grpc.testing.integration.Messages.LoadBalancerStatsResponse getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request) {
return blockingUnaryCall(
getChannel(), getGetClientStatsMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static final class LoadBalancerStatsServiceFutureStub extends io.grpc.stub.AbstractFutureStub<LoadBalancerStatsServiceFutureStub> {
private LoadBalancerStatsServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LoadBalancerStatsServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LoadBalancerStatsServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* Gets the backend distribution for RPCs sent by a test client.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> getClientStats(
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request) {
return futureUnaryCall(
getChannel().newCall(getGetClientStatsMethod(), getCallOptions()), request);
}
}
private static final int METHODID_GET_CLIENT_STATS = 0;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final LoadBalancerStatsServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(LoadBalancerStatsServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_GET_CLIENT_STATS:
serviceImpl.getClientStats((io.grpc.testing.integration.Messages.LoadBalancerStatsRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (LoadBalancerStatsServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getGetClientStatsMethod())
.build();
}
}
}
return result;
}
}

View File

@ -0,0 +1,341 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/metrics.proto")
public final class MetricsServiceGrpc {
private MetricsServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.MetricsService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse> getGetAllGaugesMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetAllGauges",
requestType = io.grpc.testing.integration.Metrics.EmptyMessage.class,
responseType = io.grpc.testing.integration.Metrics.GaugeResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse> getGetAllGaugesMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage, io.grpc.testing.integration.Metrics.GaugeResponse> getGetAllGaugesMethod;
if ((getGetAllGaugesMethod = MetricsServiceGrpc.getGetAllGaugesMethod) == null) {
synchronized (MetricsServiceGrpc.class) {
if ((getGetAllGaugesMethod = MetricsServiceGrpc.getGetAllGaugesMethod) == null) {
MetricsServiceGrpc.getGetAllGaugesMethod = getGetAllGaugesMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Metrics.EmptyMessage, io.grpc.testing.integration.Metrics.GaugeResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetAllGauges"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Metrics.EmptyMessage.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Metrics.GaugeResponse.getDefaultInstance()))
.build();
}
}
}
return getGetAllGaugesMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse> getGetGaugeMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetGauge",
requestType = io.grpc.testing.integration.Metrics.GaugeRequest.class,
responseType = io.grpc.testing.integration.Metrics.GaugeResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse> getGetGaugeMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest, io.grpc.testing.integration.Metrics.GaugeResponse> getGetGaugeMethod;
if ((getGetGaugeMethod = MetricsServiceGrpc.getGetGaugeMethod) == null) {
synchronized (MetricsServiceGrpc.class) {
if ((getGetGaugeMethod = MetricsServiceGrpc.getGetGaugeMethod) == null) {
MetricsServiceGrpc.getGetGaugeMethod = getGetGaugeMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Metrics.GaugeRequest, io.grpc.testing.integration.Metrics.GaugeResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetGauge"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Metrics.GaugeRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Metrics.GaugeResponse.getDefaultInstance()))
.build();
}
}
}
return getGetGaugeMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static MetricsServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<MetricsServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<MetricsServiceStub>() {
@java.lang.Override
public MetricsServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceStub(channel, callOptions);
}
};
return MetricsServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static MetricsServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingStub>() {
@java.lang.Override
public MetricsServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceBlockingStub(channel, callOptions);
}
};
return MetricsServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static MetricsServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<MetricsServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<MetricsServiceFutureStub>() {
@java.lang.Override
public MetricsServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceFutureStub(channel, callOptions);
}
};
return MetricsServiceFutureStub.newStub(factory, channel);
}
/**
*/
public static abstract class MetricsServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnimplementedUnaryCall(getGetAllGaugesMethod(), responseObserver);
}
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnimplementedUnaryCall(getGetGaugeMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetAllGaugesMethod(),
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse>(
this, METHODID_GET_ALL_GAUGES)))
.addMethod(
getGetGaugeMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse>(
this, METHODID_GET_GAUGE)))
.build();
}
}
/**
*/
public static final class MetricsServiceStub extends io.grpc.stub.AbstractAsyncStub<MetricsServiceStub> {
private MetricsServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected MetricsServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceStub(channel, callOptions);
}
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncServerStreamingCall(
getChannel().newCall(getGetAllGaugesMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetGaugeMethod(), getCallOptions()), request, responseObserver);
}
}
/**
*/
public static final class MetricsServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingStub> {
private MetricsServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected MetricsServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Metrics.GaugeResponse> getAllGauges(
io.grpc.testing.integration.Metrics.EmptyMessage request) {
return blockingServerStreamingCall(
getChannel(), getGetAllGaugesMethod(), getCallOptions(), request);
}
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request) {
return blockingUnaryCall(
getChannel(), getGetGaugeMethod(), getCallOptions(), request);
}
}
/**
*/
public static final class MetricsServiceFutureStub extends io.grpc.stub.AbstractFutureStub<MetricsServiceFutureStub> {
private MetricsServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected MetricsServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MetricsServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Metrics.GaugeResponse> getGauge(
io.grpc.testing.integration.Metrics.GaugeRequest request) {
return futureUnaryCall(
getChannel().newCall(getGetGaugeMethod(), getCallOptions()), request);
}
}
private static final int METHODID_GET_ALL_GAUGES = 0;
private static final int METHODID_GET_GAUGE = 1;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final MetricsServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(MetricsServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_GET_ALL_GAUGES:
serviceImpl.getAllGauges((io.grpc.testing.integration.Metrics.EmptyMessage) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse>) responseObserver);
break;
case METHODID_GET_GAUGE:
serviceImpl.getGauge((io.grpc.testing.integration.Metrics.GaugeRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (MetricsServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getGetAllGaugesMethod())
.addMethod(getGetGaugeMethod())
.build();
}
}
}
return result;
}
}

View File

@ -0,0 +1,339 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/test.proto")
public final class ReconnectServiceGrpc {
private ReconnectServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.ReconnectService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Start",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
synchronized (ReconnectServiceGrpc.class) {
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
ReconnectServiceGrpc.getStartMethod = getStartMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Start"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build();
}
}
}
return getStartMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.Messages.ReconnectInfo> getStopMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Stop",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.Messages.ReconnectInfo.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.Messages.ReconnectInfo> getStopMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.Messages.ReconnectInfo> getStopMethod;
if ((getStopMethod = ReconnectServiceGrpc.getStopMethod) == null) {
synchronized (ReconnectServiceGrpc.class) {
if ((getStopMethod = ReconnectServiceGrpc.getStopMethod) == null) {
ReconnectServiceGrpc.getStopMethod = getStopMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.Messages.ReconnectInfo>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Stop"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.ReconnectInfo.getDefaultInstance()))
.build();
}
}
}
return getStopMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static ReconnectServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceStub>() {
@java.lang.Override
public ReconnectServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceStub(channel, callOptions);
}
};
return ReconnectServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static ReconnectServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingStub>() {
@java.lang.Override
public ReconnectServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceBlockingStub(channel, callOptions);
}
};
return ReconnectServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static ReconnectServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceFutureStub>() {
@java.lang.Override
public ReconnectServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceFutureStub(channel, callOptions);
}
};
return ReconnectServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static abstract class ReconnectServiceImplBase implements io.grpc.BindableService {
/**
*/
public void start(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getStartMethod(), responseObserver);
}
/**
*/
public void stop(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver) {
asyncUnimplementedUnaryCall(getStopMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getStartMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_START)))
.addMethod(
getStopMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.Messages.ReconnectInfo>(
this, METHODID_STOP)))
.build();
}
}
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static final class ReconnectServiceStub extends io.grpc.stub.AbstractAsyncStub<ReconnectServiceStub> {
private ReconnectServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ReconnectServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceStub(channel, callOptions);
}
/**
*/
public void start(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void stop(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getStopMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static final class ReconnectServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<ReconnectServiceBlockingStub> {
private ReconnectServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ReconnectServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceBlockingStub(channel, callOptions);
}
/**
*/
public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getStartMethod(), getCallOptions(), request);
}
/**
*/
public io.grpc.testing.integration.Messages.ReconnectInfo stop(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getStopMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static final class ReconnectServiceFutureStub extends io.grpc.stub.AbstractFutureStub<ReconnectServiceFutureStub> {
private ReconnectServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ReconnectServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ReconnectServiceFutureStub(channel, callOptions);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> start(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.ReconnectInfo> stop(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getStopMethod(), getCallOptions()), request);
}
}
private static final int METHODID_START = 0;
private static final int METHODID_STOP = 1;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final ReconnectServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(ReconnectServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_START:
serviceImpl.start((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break;
case METHODID_STOP:
serviceImpl.stop((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (ReconnectServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getStartMethod())
.addMethod(getStopMethod())
.build();
}
}
}
return result;
}
}

View File

@ -0,0 +1,829 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/test.proto")
public final class TestServiceGrpc {
private TestServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.TestService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getEmptyCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "EmptyCall",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getEmptyCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getEmptyCallMethod;
if ((getEmptyCallMethod = TestServiceGrpc.getEmptyCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getEmptyCallMethod = TestServiceGrpc.getEmptyCallMethod) == null) {
TestServiceGrpc.getEmptyCallMethod = getEmptyCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "EmptyCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build();
}
}
}
return getEmptyCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse> getUnaryCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "UnaryCall",
requestType = io.grpc.testing.integration.Messages.SimpleRequest.class,
responseType = io.grpc.testing.integration.Messages.SimpleResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse> getUnaryCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest, io.grpc.testing.integration.Messages.SimpleResponse> getUnaryCallMethod;
if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
TestServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.SimpleRequest, io.grpc.testing.integration.Messages.SimpleResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnaryCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.SimpleRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.SimpleResponse.getDefaultInstance()))
.build();
}
}
}
return getUnaryCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse> getCacheableUnaryCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "CacheableUnaryCall",
requestType = io.grpc.testing.integration.Messages.SimpleRequest.class,
responseType = io.grpc.testing.integration.Messages.SimpleResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse> getCacheableUnaryCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.SimpleRequest, io.grpc.testing.integration.Messages.SimpleResponse> getCacheableUnaryCallMethod;
if ((getCacheableUnaryCallMethod = TestServiceGrpc.getCacheableUnaryCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getCacheableUnaryCallMethod = TestServiceGrpc.getCacheableUnaryCallMethod) == null) {
TestServiceGrpc.getCacheableUnaryCallMethod = getCacheableUnaryCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.SimpleRequest, io.grpc.testing.integration.Messages.SimpleResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "CacheableUnaryCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.SimpleRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.SimpleResponse.getDefaultInstance()))
.build();
}
}
}
return getCacheableUnaryCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getStreamingOutputCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "StreamingOutputCall",
requestType = io.grpc.testing.integration.Messages.StreamingOutputCallRequest.class,
responseType = io.grpc.testing.integration.Messages.StreamingOutputCallResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getStreamingOutputCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getStreamingOutputCallMethod;
if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
TestServiceGrpc.getStreamingOutputCallMethod = getStreamingOutputCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingOutputCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallResponse.getDefaultInstance()))
.build();
}
}
}
return getStreamingOutputCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingInputCallRequest,
io.grpc.testing.integration.Messages.StreamingInputCallResponse> getStreamingInputCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "StreamingInputCall",
requestType = io.grpc.testing.integration.Messages.StreamingInputCallRequest.class,
responseType = io.grpc.testing.integration.Messages.StreamingInputCallResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingInputCallRequest,
io.grpc.testing.integration.Messages.StreamingInputCallResponse> getStreamingInputCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingInputCallRequest, io.grpc.testing.integration.Messages.StreamingInputCallResponse> getStreamingInputCallMethod;
if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
TestServiceGrpc.getStreamingInputCallMethod = getStreamingInputCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.StreamingInputCallRequest, io.grpc.testing.integration.Messages.StreamingInputCallResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingInputCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingInputCallRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingInputCallResponse.getDefaultInstance()))
.build();
}
}
}
return getStreamingInputCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getFullDuplexCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "FullDuplexCall",
requestType = io.grpc.testing.integration.Messages.StreamingOutputCallRequest.class,
responseType = io.grpc.testing.integration.Messages.StreamingOutputCallResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getFullDuplexCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getFullDuplexCallMethod;
if ((getFullDuplexCallMethod = TestServiceGrpc.getFullDuplexCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getFullDuplexCallMethod = TestServiceGrpc.getFullDuplexCallMethod) == null) {
TestServiceGrpc.getFullDuplexCallMethod = getFullDuplexCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "FullDuplexCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallResponse.getDefaultInstance()))
.build();
}
}
}
return getFullDuplexCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getHalfDuplexCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "HalfDuplexCall",
requestType = io.grpc.testing.integration.Messages.StreamingOutputCallRequest.class,
responseType = io.grpc.testing.integration.Messages.StreamingOutputCallResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getHalfDuplexCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse> getHalfDuplexCallMethod;
if ((getHalfDuplexCallMethod = TestServiceGrpc.getHalfDuplexCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getHalfDuplexCallMethod = TestServiceGrpc.getHalfDuplexCallMethod) == null) {
TestServiceGrpc.getHalfDuplexCallMethod = getHalfDuplexCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "HalfDuplexCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.Messages.StreamingOutputCallResponse.getDefaultInstance()))
.build();
}
}
}
return getHalfDuplexCallMethod;
}
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "UnimplementedCall",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod;
if ((getUnimplementedCallMethod = TestServiceGrpc.getUnimplementedCallMethod) == null) {
synchronized (TestServiceGrpc.class) {
if ((getUnimplementedCallMethod = TestServiceGrpc.getUnimplementedCallMethod) == null) {
TestServiceGrpc.getUnimplementedCallMethod = getUnimplementedCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnimplementedCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build();
}
}
}
return getUnimplementedCallMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static TestServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TestServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TestServiceStub>() {
@java.lang.Override
public TestServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceStub(channel, callOptions);
}
};
return TestServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static TestServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingStub>() {
@java.lang.Override
public TestServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceBlockingStub(channel, callOptions);
}
};
return TestServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static TestServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TestServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TestServiceFutureStub>() {
@java.lang.Override
public TestServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceFutureStub(channel, callOptions);
}
};
return TestServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static abstract class TestServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public void emptyCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getEmptyCallMethod(), responseObserver);
}
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
}
/**
* <pre>
* One request followed by one response. Response has cache control
* headers set such that a caching HTTP proxy (such as GFE) can
* satisfy subsequent requests.
* </pre>
*/
public void cacheableUnaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(getCacheableUnaryCallMethod(), responseObserver);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(getStreamingOutputCallMethod(), responseObserver);
}
/**
* <pre>
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(getStreamingInputCallMethod(), responseObserver);
}
/**
* <pre>
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full duplexing.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> fullDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(getFullDuplexCallMethod(), responseObserver);
}
/**
* <pre>
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> halfDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(getHalfDuplexCallMethod(), responseObserver);
}
/**
* <pre>
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
* </pre>
*/
public void unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getUnimplementedCallMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getEmptyCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_EMPTY_CALL)))
.addMethod(
getUnaryCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse>(
this, METHODID_UNARY_CALL)))
.addMethod(
getCacheableUnaryCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse>(
this, METHODID_CACHEABLE_UNARY_CALL)))
.addMethod(
getStreamingOutputCallMethod(),
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
this, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
getStreamingInputCallMethod(),
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingInputCallRequest,
io.grpc.testing.integration.Messages.StreamingInputCallResponse>(
this, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
getFullDuplexCallMethod(),
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
this, METHODID_FULL_DUPLEX_CALL)))
.addMethod(
getHalfDuplexCallMethod(),
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
this, METHODID_HALF_DUPLEX_CALL)))
.addMethod(
getUnimplementedCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_UNIMPLEMENTED_CALL)))
.build();
}
}
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static final class TestServiceStub extends io.grpc.stub.AbstractAsyncStub<TestServiceStub> {
private TestServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TestServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceStub(channel, callOptions);
}
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public void emptyCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getEmptyCallMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* One request followed by one response. Response has cache control
* headers set such that a caching HTTP proxy (such as GFE) can
* satisfy subsequent requests.
* </pre>
*/
public void cacheableUnaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getCacheableUnaryCallMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
asyncServerStreamingCall(
getChannel().newCall(getStreamingOutputCallMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse> responseObserver) {
return asyncClientStreamingCall(
getChannel().newCall(getStreamingInputCallMethod(), getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full duplexing.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> fullDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(getFullDuplexCallMethod(), getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> halfDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(getHalfDuplexCallMethod(), getCallOptions()), responseObserver);
}
/**
* <pre>
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
* </pre>
*/
public void unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getUnimplementedCallMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static final class TestServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingStub> {
private TestServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TestServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public io.grpc.testing.integration.EmptyProtos.Empty emptyCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getEmptyCallMethod(), getCallOptions(), request);
}
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public io.grpc.testing.integration.Messages.SimpleResponse unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
return blockingUnaryCall(
getChannel(), getUnaryCallMethod(), getCallOptions(), request);
}
/**
* <pre>
* One request followed by one response. Response has cache control
* headers set such that a caching HTTP proxy (such as GFE) can
* satisfy subsequent requests.
* </pre>
*/
public io.grpc.testing.integration.Messages.SimpleResponse cacheableUnaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
return blockingUnaryCall(
getChannel(), getCacheableUnaryCallMethod(), getCallOptions(), request);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest request) {
return blockingServerStreamingCall(
getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
}
/**
* <pre>
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
* </pre>
*/
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static final class TestServiceFutureStub extends io.grpc.stub.AbstractFutureStub<TestServiceFutureStub> {
private TestServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TestServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TestServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> emptyCall(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getEmptyCallMethod(), getCallOptions()), request);
}
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.SimpleResponse> unaryCall(
io.grpc.testing.integration.Messages.SimpleRequest request) {
return futureUnaryCall(
getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
}
/**
* <pre>
* One request followed by one response. Response has cache control
* headers set such that a caching HTTP proxy (such as GFE) can
* satisfy subsequent requests.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.SimpleResponse> cacheableUnaryCall(
io.grpc.testing.integration.Messages.SimpleRequest request) {
return futureUnaryCall(
getChannel().newCall(getCacheableUnaryCallMethod(), getCallOptions()), request);
}
/**
* <pre>
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> unimplementedCall(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getUnimplementedCallMethod(), getCallOptions()), request);
}
}
private static final int METHODID_EMPTY_CALL = 0;
private static final int METHODID_UNARY_CALL = 1;
private static final int METHODID_CACHEABLE_UNARY_CALL = 2;
private static final int METHODID_STREAMING_OUTPUT_CALL = 3;
private static final int METHODID_UNIMPLEMENTED_CALL = 4;
private static final int METHODID_STREAMING_INPUT_CALL = 5;
private static final int METHODID_FULL_DUPLEX_CALL = 6;
private static final int METHODID_HALF_DUPLEX_CALL = 7;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final TestServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(TestServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_EMPTY_CALL:
serviceImpl.emptyCall((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break;
case METHODID_UNARY_CALL:
serviceImpl.unaryCall((io.grpc.testing.integration.Messages.SimpleRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse>) responseObserver);
break;
case METHODID_CACHEABLE_UNARY_CALL:
serviceImpl.cacheableUnaryCall((io.grpc.testing.integration.Messages.SimpleRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse>) responseObserver);
break;
case METHODID_STREAMING_OUTPUT_CALL:
serviceImpl.streamingOutputCall((io.grpc.testing.integration.Messages.StreamingOutputCallRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse>) responseObserver);
break;
case METHODID_UNIMPLEMENTED_CALL:
serviceImpl.unimplementedCall((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_STREAMING_INPUT_CALL:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse>) responseObserver);
case METHODID_FULL_DUPLEX_CALL:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullDuplexCall(
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse>) responseObserver);
case METHODID_HALF_DUPLEX_CALL:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfDuplexCall(
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse>) responseObserver);
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (TestServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getEmptyCallMethod())
.addMethod(getUnaryCallMethod())
.addMethod(getCacheableUnaryCallMethod())
.addMethod(getStreamingOutputCallMethod())
.addMethod(getStreamingInputCallMethod())
.addMethod(getFullDuplexCallMethod())
.addMethod(getHalfDuplexCallMethod())
.addMethod(getUnimplementedCallMethod())
.build();
}
}
}
return result;
}
}

View File

@ -0,0 +1,283 @@
package io.grpc.testing.integration;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/testing/test.proto")
public final class UnimplementedServiceGrpc {
private UnimplementedServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.UnimplementedService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "UnimplementedCall",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getUnimplementedCallMethod;
if ((getUnimplementedCallMethod = UnimplementedServiceGrpc.getUnimplementedCallMethod) == null) {
synchronized (UnimplementedServiceGrpc.class) {
if ((getUnimplementedCallMethod = UnimplementedServiceGrpc.getUnimplementedCallMethod) == null) {
UnimplementedServiceGrpc.getUnimplementedCallMethod = getUnimplementedCallMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnimplementedCall"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build();
}
}
}
return getUnimplementedCallMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static UnimplementedServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceStub>() {
@java.lang.Override
public UnimplementedServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceStub(channel, callOptions);
}
};
return UnimplementedServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static UnimplementedServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingStub>() {
@java.lang.Override
public UnimplementedServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceBlockingStub(channel, callOptions);
}
};
return UnimplementedServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static UnimplementedServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceFutureStub>() {
@java.lang.Override
public UnimplementedServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceFutureStub(channel, callOptions);
}
};
return UnimplementedServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static abstract class UnimplementedServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public void unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getUnimplementedCallMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getUnimplementedCallMethod(),
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty,
io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_UNIMPLEMENTED_CALL)))
.build();
}
}
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static final class UnimplementedServiceStub extends io.grpc.stub.AbstractAsyncStub<UnimplementedServiceStub> {
private UnimplementedServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected UnimplementedServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceStub(channel, callOptions);
}
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public void unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getUnimplementedCallMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static final class UnimplementedServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<UnimplementedServiceBlockingStub> {
private UnimplementedServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected UnimplementedServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static final class UnimplementedServiceFutureStub extends io.grpc.stub.AbstractFutureStub<UnimplementedServiceFutureStub> {
private UnimplementedServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected UnimplementedServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UnimplementedServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> unimplementedCall(
io.grpc.testing.integration.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(getUnimplementedCallMethod(), getCallOptions()), request);
}
}
private static final int METHODID_UNIMPLEMENTED_CALL = 0;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final UnimplementedServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(UnimplementedServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_UNIMPLEMENTED_CALL:
serviceImpl.unimplementedCall((io.grpc.testing.integration.EmptyProtos.Empty) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (UnimplementedServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.addMethod(getUnimplementedCallMethod())
.build();
}
}
}
return result;
}
}

View File

@ -3,9 +3,7 @@
package="io.grpc.android.integrationtest" > package="io.grpc.android.integrationtest" >
<!-- API level 14+ is required for TLS since Google Play Services v10.2 --> <!-- API level 14+ is required for TLS since Google Play Services v10.2 -->
<uses-sdk <uses-sdk android:targetSdkVersion="22"/>
android:minSdkVersion="14"
android:targetSdkVersion="22"/>
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />

View File

@ -145,7 +145,6 @@ final class InteropTask extends AsyncTask<Void, Void, String> {
} }
private static class Tester extends AbstractInteropTest { private static class Tester extends AbstractInteropTest {
private final ManagedChannel channel;
private Tester(ManagedChannel channel) { private Tester(ManagedChannel channel) {
this.channel = channel; this.channel = channel;

View File

@ -31,7 +31,7 @@ import android.widget.TextView;
import com.google.android.gms.security.ProviderInstaller; import com.google.android.gms.security.ProviderInstaller;
import io.grpc.ManagedChannel; import io.grpc.ManagedChannel;
import java.io.InputStream; import java.io.InputStream;
import java.util.LinkedList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class TesterActivity extends AppCompatActivity public class TesterActivity extends AppCompatActivity
@ -48,7 +48,7 @@ public class TesterActivity extends AppCompatActivity
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tester); setContentView(R.layout.activity_tester);
buttons = new LinkedList<>(); buttons = new ArrayList<>();
buttons.add((Button) findViewById(R.id.empty_unary_button)); buttons.add((Button) findViewById(R.id.empty_unary_button));
buttons.add((Button) findViewById(R.id.large_unary_button)); buttons.add((Button) findViewById(R.id.large_unary_button));
buttons.add((Button) findViewById(R.id.client_streaming_button)); buttons.add((Button) findViewById(R.id.client_streaming_button));

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -1,5 +1,6 @@
plugins { plugins {
id "com.android.library" apply false // Necessary for Android plugin to find its classes id "com.android.application" apply false // Necessary for Android plugin to find its classes
id "com.android.library" apply false
id "com.google.osdetector" apply false id "com.google.osdetector" apply false
id "me.champeau.gradle.japicmp" apply false id "me.champeau.gradle.japicmp" apply false
id "net.ltgt.errorprone" apply false id "net.ltgt.errorprone" apply false
@ -53,6 +54,7 @@ subprojects {
opencensusVersion = '0.24.0' opencensusVersion = '0.24.0'
configureProtoCompilation = { configureProtoCompilation = {
boolean isAndroid = project.getName().contains('android')
String generatedSourcePath = "${projectDir}/src/generated" String generatedSourcePath = "${projectDir}/src/generated"
project.protobuf { project.protobuf {
protoc { protoc {
@ -67,41 +69,57 @@ subprojects {
// Recompile protos when build.gradle has been changed, because // Recompile protos when build.gradle has been changed, because
// it's possible the version of protoc has been changed. // it's possible the version of protoc has been changed.
task.inputs.file "${rootProject.projectDir}/build.gradle" task.inputs.file "${rootProject.projectDir}/build.gradle"
if (isAndroid) {
task.builtins {
java { option 'lite' }
}
}
} }
} }
} }
if (rootProject.childProjects.containsKey('grpc-compiler')) { if (rootProject.childProjects.containsKey('grpc-compiler')) {
// Only when the codegen is built along with the project, will we be able to run // Only when the codegen is built along with the project, will we be able to run
// the grpc code generator. // the grpc code generator.
task syncGeneratedSources { }
project.protobuf { project.protobuf {
plugins { grpc { path = javaPluginPath } } plugins { grpc { path = javaPluginPath } }
generateProtoTasks { generateProtoTasks {
all().each { task -> all().each { task ->
project["syncGeneratedSources${task.sourceSet.name}"].dependsOn task String variantOrSourceSet = isAndroid ? task.variant.name : task.sourceSet.name
def syncTask = project.tasks.register("syncGeneratedSources${variantOrSourceSet}", Sync) {
from "$buildDir/generated/source/proto/${variantOrSourceSet}/grpc"
into "$generatedSourcePath/${variantOrSourceSet}/grpc"
}
syncGeneratedSources.dependsOn syncTask
task.dependsOn ':grpc-compiler:java_pluginExecutable' task.dependsOn ':grpc-compiler:java_pluginExecutable'
// Recompile protos when the codegen has been changed // Recompile protos when the codegen has been changed
task.inputs.file javaPluginPath task.inputs.file javaPluginPath
task.plugins { grpc { option 'noversion' } } task.plugins { grpc { option 'noversion' } }
if (isAndroid) {
task.plugins {
grpc {
option 'lite'
}
}
}
} }
} }
} }
task syncGeneratedSources { }
sourceSets.all { sourceSet ->
task "syncGeneratedSources${sourceSet.name}"(type: Sync) {
from "$buildDir/generated/source/proto/${sourceSet.name}/grpc"
into "$generatedSourcePath/${sourceSet.name}/grpc"
}
syncGeneratedSources.dependsOn "syncGeneratedSources${sourceSet.name}"
}
// Re-sync as part of a normal build, to avoid forgetting to run the sync // Re-sync as part of a normal build, to avoid forgetting to run the sync
assemble.dependsOn syncGeneratedSources assemble.dependsOn syncGeneratedSources
} else { } else {
// Otherwise, we just use the checked-in generated code. // Otherwise, we just use the checked-in generated code.
project.sourceSets { if (isAndroid) {
main { java { srcDir "${generatedSourcePath}/main/grpc" } } project.android.sourceSets {
test { java { srcDir "${generatedSourcePath}/test/grpc" } } debug { java { srcDir "${generatedSourcePath}/debug/grpc" } }
release { java { srcDir "${generatedSourcePath}/release/grpc" } }
}
} else {
project.sourceSets {
main { java { srcDir "${generatedSourcePath}/main/grpc" } }
test { java { srcDir "${generatedSourcePath}/test/grpc" } }
}
} }
} }

View File

@ -1,5 +1,6 @@
pluginManagement { pluginManagement {
plugins { plugins {
id "com.android.application" version "3.3.0"
id "com.android.library" version "3.3.0" id "com.android.library" version "3.3.0"
id "com.github.johnrengelman.shadow" version "2.0.4" id "com.github.johnrengelman.shadow" version "2.0.4"
id "com.github.kt3k.coveralls" version "2.0.1" id "com.github.kt3k.coveralls" version "2.0.1"
@ -88,4 +89,6 @@ if (settings.hasProperty('skipAndroid') && skipAndroid.toBoolean()) {
project(':grpc-cronet').projectDir = "$rootDir/cronet" as File project(':grpc-cronet').projectDir = "$rootDir/cronet" as File
include ":grpc-android" include ":grpc-android"
project(':grpc-android').projectDir = "$rootDir/android" as File project(':grpc-android').projectDir = "$rootDir/android" as File
include ":grpc-android-interop-testing"
project(':grpc-android-interop-testing').projectDir = "$rootDir/android-interop-testing" as File
} }