You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/07/08 14:10:47 UTC
[dubbo] branch 3.0 updated: Add test case for GrpcProtocol (#8228)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new e93b519 Add test case for GrpcProtocol (#8228)
e93b519 is described below
commit e93b5191e1f6157f1cc4c8555e6a5437ff774cbc
Author: xiaoheng1 <20...@qq.com>
AuthorDate: Thu Jul 8 22:10:36 2021 +0800
Add test case for GrpcProtocol (#8228)
---
.../dubbo/rpc/protocol/grpc/GrpcProtocolTest.java | 94 ++++
.../protocol/grpc/support/DubboGreeterGrpc.java | 224 ++++++++
.../rpc/protocol/grpc/support/GreeterGrpc.java | 330 +++++++++++
.../rpc/protocol/grpc/support/GrpcGreeterImpl.java | 31 ++
.../rpc/protocol/grpc/support/HelloReply.java | 616 +++++++++++++++++++++
.../protocol/grpc/support/HelloReplyOrBuilder.java | 37 ++
.../rpc/protocol/grpc/support/HelloRequest.java | 616 +++++++++++++++++++++
.../grpc/support/HelloRequestOrBuilder.java | 37 ++
.../rpc/protocol/grpc/support/HelloWorldProto.java | 90 +++
9 files changed, 2075 insertions(+)
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/GrpcProtocolTest.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/GrpcProtocolTest.java
new file mode 100644
index 0000000..9e018b7
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/GrpcProtocolTest.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.rpc.protocol.grpc;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.ExtensionLoader;
+import org.apache.dubbo.common.utils.NetUtils;
+import org.apache.dubbo.config.ReferenceConfigBase;
+import org.apache.dubbo.rpc.Protocol;
+import org.apache.dubbo.rpc.ProxyFactory;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+import org.apache.dubbo.rpc.model.ServiceDescriptor;
+import org.apache.dubbo.rpc.model.ServiceMetadata;
+import org.apache.dubbo.rpc.protocol.grpc.support.DubboGreeterGrpc;
+import org.apache.dubbo.rpc.protocol.grpc.support.GrpcGreeterImpl;
+import org.apache.dubbo.rpc.protocol.grpc.support.HelloReply;
+import org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class GrpcProtocolTest {
+ private Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
+ private ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
+
+ @Test
+ public void testDemoProtocol() throws Exception {
+ DubboGreeterGrpc.IGreeter serviceImpl = new GrpcGreeterImpl();
+
+ int availablePort = NetUtils.getAvailablePort();
+
+ URL url = URL.valueOf("grpc://127.0.0.1:" + availablePort + "/" + DubboGreeterGrpc.IGreeter.class.getName());
+
+ ServiceDescriptor serviceDescriptor = ApplicationModel.getServiceRepository().registerService(DubboGreeterGrpc.IGreeter.class);
+ ApplicationModel.getServiceRepository().registerProvider(
+ url.getServiceKey(),
+ serviceImpl,
+ serviceDescriptor,
+ null,
+ new ServiceMetadata()
+ );
+
+
+ MockReferenceConfig mockReferenceConfig = new MockReferenceConfig();
+ mockReferenceConfig.setInterface(DubboGreeterGrpc.IGreeter.class);
+
+ ServiceMetadata serviceMetadata = new ServiceMetadata();
+ serviceMetadata.setServiceKey(URL.buildKey(DubboGreeterGrpc.IGreeter.class.getName(), null, null));
+
+ ApplicationModel.getServiceRepository().registerConsumer(
+ url.getServiceKey(),
+ serviceDescriptor,
+ mockReferenceConfig,
+ null,
+ serviceMetadata
+ );
+
+ protocol.export(proxy.getInvoker(serviceImpl, DubboGreeterGrpc.IGreeter.class, url));
+ serviceImpl = proxy.getProxy(protocol.refer(DubboGreeterGrpc.IGreeter.class, url));
+
+ HelloReply hello = serviceImpl.sayHello(HelloRequest.newBuilder().setName("World").build());
+ Assertions.assertEquals("Hello World", hello.getMessage());
+
+ // resource recycle.
+ ApplicationModel.getServiceRepository().destroy();
+ }
+
+ class MockReferenceConfig extends ReferenceConfigBase {
+
+ @Override
+ public Object get() {
+ return null;
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+ }
+}
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/DubboGreeterGrpc.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/DubboGreeterGrpc.java
new file mode 100644
index 0000000..ac37cc3
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/DubboGreeterGrpc.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.rpc.protocol.grpc.support;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.config.ReferenceConfigBase;
+
+import java.util.concurrent.TimeUnit;
+
+import static org.apache.dubbo.rpc.protocol.grpc.support.GreeterGrpc.getServiceDescriptor;
+import static io.grpc.stub.ServerCalls.asyncUnaryCall;
+import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
+import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT;
+import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
+
+@javax.annotation.Generated(
+ value = "by DubboGrpc generator",
+ comments = "Source: helloworld.proto")
+public final class DubboGreeterGrpc {
+ private DubboGreeterGrpc() {
+ }
+
+ public static class DubboGreeterStub implements IGreeter {
+
+ protected URL url;
+ protected ReferenceConfigBase<?> referenceConfig;
+
+ protected GreeterGrpc.GreeterBlockingStub blockingStub;
+ protected GreeterGrpc.GreeterFutureStub futureStub;
+ protected GreeterGrpc.GreeterStub stub;
+
+ public DubboGreeterStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions, URL url, ReferenceConfigBase<?> referenceConfig) {
+ this.url = url;
+ this.referenceConfig = referenceConfig;
+
+ blockingStub = GreeterGrpc.newBlockingStub(channel).build(channel, callOptions);
+ futureStub = GreeterGrpc.newFutureStub(channel).build(channel, callOptions);
+ stub = GreeterGrpc.newStub(channel).build(channel, callOptions);
+ }
+
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ public org.apache.dubbo.rpc.protocol.grpc.support.HelloReply sayHello(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request) {
+ return blockingStub
+ .withDeadlineAfter(url.getParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS)
+ .sayHello(request);
+ }
+
+ public com.google.common.util.concurrent.ListenableFuture<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> sayHelloAsync(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request) {
+ return futureStub
+ .withDeadlineAfter(url.getParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS)
+ .sayHello(request);
+ }
+
+ public void sayHello(org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request,
+ io.grpc.stub.StreamObserver<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> responseObserver) {
+ stub
+ .withDeadlineAfter(url.getParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS)
+ .sayHello(request, responseObserver);
+ }
+
+ }
+
+ public static DubboGreeterStub getDubboStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions, URL url,
+ ReferenceConfigBase<?> referenceConfig) {
+ return new DubboGreeterStub(channel, callOptions, url, referenceConfig);
+ }
+
+ public interface IGreeter {
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ default public org.apache.dubbo.rpc.protocol.grpc.support.HelloReply sayHello(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request) {
+ throw new UnsupportedOperationException(
+ "No need to override this method, extend XxxImplBase and override all methods it allows.");
+ }
+
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ default public com.google.common.util.concurrent.ListenableFuture<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> sayHelloAsync(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request) {
+ throw new UnsupportedOperationException(
+ "No need to override this method, extend XxxImplBase and override all methods it allows.");
+ }
+
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ public void sayHello(org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request,
+ io.grpc.stub.StreamObserver<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> responseObserver);
+
+ }
+
+ /**
+ * <pre>
+ * The greeting service definition.
+ * </pre>
+ */
+ public static abstract class GreeterImplBase implements io.grpc.BindableService, IGreeter {
+
+ private IGreeter proxiedImpl;
+
+ public final void setProxiedImpl(IGreeter proxiedImpl) {
+ this.proxiedImpl = proxiedImpl;
+ }
+
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ @Override
+ public final org.apache.dubbo.rpc.protocol.grpc.support.HelloReply sayHello(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request) {
+ throw new UnsupportedOperationException(
+ "No need to override this method, extend XxxImplBase and override all methods it allows.");
+ }
+
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ @Override
+ public final com.google.common.util.concurrent.ListenableFuture<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> sayHelloAsync(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request) {
+ throw new UnsupportedOperationException(
+ "No need to override this method, extend XxxImplBase and override all methods it allows.");
+ }
+
+ public void sayHello(org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request,
+ io.grpc.stub.StreamObserver<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> responseObserver) {
+ asyncUnimplementedUnaryCall(org.apache.dubbo.rpc.protocol.grpc.support.GreeterGrpc.getSayHelloMethod(), responseObserver);
+ }
+
+ @Override
+ public final io.grpc.ServerServiceDefinition bindService() {
+ return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
+ .addMethod(
+ org.apache.dubbo.rpc.protocol.grpc.support.GreeterGrpc.getSayHelloMethod(),
+ asyncUnaryCall(
+ new MethodHandlers<
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest,
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloReply>(
+ proxiedImpl, METHODID_SAY_HELLO)))
+ .build();
+ }
+ }
+
+ private static final int METHODID_SAY_HELLO = 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 IGreeter serviceImpl;
+ private final int methodId;
+
+ MethodHandlers(IGreeter serviceImpl, int methodId) {
+ this.serviceImpl = serviceImpl;
+ this.methodId = methodId;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void invoke(Req request, io.grpc.stub.StreamObserver
+ <Resp> responseObserver) {
+ switch (methodId) {
+ case METHODID_SAY_HELLO:
+ serviceImpl.sayHello((org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest) request,
+ (io.grpc.stub.StreamObserver<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply>) responseObserver);
+ break;
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public io.grpc.stub.StreamObserver
+ <Req> invoke(io.grpc.stub.StreamObserver
+ <Resp> responseObserver) {
+ switch (methodId) {
+ default:
+ throw new AssertionError();
+ }
+ }
+ }
+
+}
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/GreeterGrpc.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/GreeterGrpc.java
new file mode 100644
index 0000000..887bc31
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/GreeterGrpc.java
@@ -0,0 +1,330 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.rpc.protocol.grpc.support;
+
+import static io.grpc.MethodDescriptor.generateFullMethodName;
+import static io.grpc.stub.ClientCalls.asyncUnaryCall;
+import static io.grpc.stub.ClientCalls.blockingUnaryCall;
+import static io.grpc.stub.ClientCalls.futureUnaryCall;
+import static io.grpc.stub.ServerCalls.asyncUnaryCall;
+import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
+
+/**
+ * <pre>
+ * The greeting service definition.
+ * </pre>
+ */
+@javax.annotation.Generated(
+ value = "by gRPC proto compiler (version 1.34.1)",
+ comments = "Source: helloworld.proto")
+public final class GreeterGrpc {
+
+ private GreeterGrpc() {
+ }
+
+ public static final String SERVICE_NAME = "helloworld.Greeter";
+
+ // Static method descriptors that strictly reflect the proto.
+ private static volatile io.grpc.MethodDescriptor<org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest,
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> getSayHelloMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "SayHello",
+ requestType = org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest.class,
+ responseType = org.apache.dubbo.rpc.protocol.grpc.support.HelloReply.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest,
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> getSayHelloMethod() {
+ io.grpc.MethodDescriptor<org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest, org.apache.dubbo.rpc.protocol.grpc.support.HelloReply>
+ getSayHelloMethod;
+ if ((getSayHelloMethod = org.apache.dubbo.rpc.protocol.grpc.support.GreeterGrpc.getSayHelloMethod) == null) {
+ synchronized (org.apache.dubbo.rpc.protocol.grpc.support.GreeterGrpc.class) {
+ if ((getSayHelloMethod = org.apache.dubbo.rpc.protocol.grpc.support.GreeterGrpc.getSayHelloMethod) == null) {
+ org.apache.dubbo.rpc.protocol.grpc.support.GreeterGrpc.getSayHelloMethod = getSayHelloMethod =
+ io.grpc.MethodDescriptor.<org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest, org.apache.dubbo.rpc.protocol.grpc.support.HelloReply>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SayHello"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloReply.getDefaultInstance()))
+ .setSchemaDescriptor(new GreeterMethodDescriptorSupplier("SayHello"))
+ .build();
+ }
+ }
+ }
+ return getSayHelloMethod;
+ }
+
+ /**
+ * Creates a new async stub that supports all call types for the service
+ */
+ public static GreeterStub newStub(io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory<GreeterStub> factory =
+ new io.grpc.stub.AbstractStub.StubFactory<GreeterStub>() {
+ @Override
+ public GreeterStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new GreeterStub(channel, callOptions);
+ }
+ };
+ return GreeterStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new blocking-style stub that supports unary and streaming output calls on the service
+ */
+ public static GreeterBlockingStub newBlockingStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory<GreeterBlockingStub> factory =
+ new io.grpc.stub.AbstractStub.StubFactory<GreeterBlockingStub>() {
+ @Override
+ public GreeterBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new GreeterBlockingStub(channel, callOptions);
+ }
+ };
+ return GreeterBlockingStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new ListenableFuture-style stub that supports unary calls on the service
+ */
+ public static GreeterFutureStub newFutureStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory<GreeterFutureStub> factory =
+ new io.grpc.stub.AbstractStub.StubFactory<GreeterFutureStub>() {
+ @Override
+ public GreeterFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new GreeterFutureStub(channel, callOptions);
+ }
+ };
+ return GreeterFutureStub.newStub(factory, channel);
+ }
+
+ /**
+ * <pre>
+ * The greeting service definition.
+ * </pre>
+ */
+ public static abstract class GreeterImplBase implements io.grpc.BindableService {
+
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ public void sayHello(org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request,
+ io.grpc.stub.StreamObserver<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> responseObserver) {
+ asyncUnimplementedUnaryCall(getSayHelloMethod(), responseObserver);
+ }
+
+ @Override
+ public final io.grpc.ServerServiceDefinition bindService() {
+ return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
+ .addMethod(
+ getSayHelloMethod(),
+ asyncUnaryCall(
+ new MethodHandlers<
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest,
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloReply>(
+ this, METHODID_SAY_HELLO)))
+ .build();
+ }
+ }
+
+ /**
+ * <pre>
+ * The greeting service definition.
+ * </pre>
+ */
+ public static final class GreeterStub extends io.grpc.stub.AbstractAsyncStub<GreeterStub> {
+ private GreeterStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @Override
+ protected GreeterStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new GreeterStub(channel, callOptions);
+ }
+
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ public void sayHello(org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request,
+ io.grpc.stub.StreamObserver<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> responseObserver) {
+ asyncUnaryCall(
+ getChannel().newCall(getSayHelloMethod(), getCallOptions()), request, responseObserver);
+ }
+ }
+
+ /**
+ * <pre>
+ * The greeting service definition.
+ * </pre>
+ */
+ public static final class GreeterBlockingStub extends io.grpc.stub.AbstractBlockingStub<GreeterBlockingStub> {
+ private GreeterBlockingStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @Override
+ protected GreeterBlockingStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new GreeterBlockingStub(channel, callOptions);
+ }
+
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ public org.apache.dubbo.rpc.protocol.grpc.support.HelloReply sayHello(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request) {
+ return blockingUnaryCall(
+ getChannel(), getSayHelloMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ * <pre>
+ * The greeting service definition.
+ * </pre>
+ */
+ public static final class GreeterFutureStub extends io.grpc.stub.AbstractFutureStub<GreeterFutureStub> {
+ private GreeterFutureStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @Override
+ protected GreeterFutureStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new GreeterFutureStub(channel, callOptions);
+ }
+
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ public com.google.common.util.concurrent.ListenableFuture<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply> sayHello(
+ org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest request) {
+ return futureUnaryCall(
+ getChannel().newCall(getSayHelloMethod(), getCallOptions()), request);
+ }
+ }
+
+ private static final int METHODID_SAY_HELLO = 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 GreeterImplBase serviceImpl;
+ private final int methodId;
+
+ MethodHandlers(GreeterImplBase serviceImpl, int methodId) {
+ this.serviceImpl = serviceImpl;
+ this.methodId = methodId;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
+ switch (methodId) {
+ case METHODID_SAY_HELLO:
+ serviceImpl.sayHello((org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest) request,
+ (io.grpc.stub.StreamObserver<org.apache.dubbo.rpc.protocol.grpc.support.HelloReply>) responseObserver);
+ break;
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public io.grpc.stub.StreamObserver<Req> invoke(
+ io.grpc.stub.StreamObserver<Resp> responseObserver) {
+ switch (methodId) {
+ default:
+ throw new AssertionError();
+ }
+ }
+ }
+
+ private static abstract class GreeterBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
+ GreeterBaseDescriptorSupplier() {
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
+ return org.apache.dubbo.rpc.protocol.grpc.support.HelloWorldProto.getDescriptor();
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
+ return getFileDescriptor().findServiceByName("Greeter");
+ }
+ }
+
+ private static final class GreeterFileDescriptorSupplier
+ extends GreeterBaseDescriptorSupplier {
+ GreeterFileDescriptorSupplier() {
+ }
+ }
+
+ private static final class GreeterMethodDescriptorSupplier
+ extends GreeterBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
+ private final String methodName;
+
+ GreeterMethodDescriptorSupplier(String methodName) {
+ this.methodName = methodName;
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
+ return getServiceDescriptor().findMethodByName(methodName);
+ }
+ }
+
+ private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
+
+ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
+ io.grpc.ServiceDescriptor result = serviceDescriptor;
+ if (result == null) {
+ synchronized (org.apache.dubbo.rpc.protocol.grpc.support.GreeterGrpc.class) {
+ result = serviceDescriptor;
+ if (result == null) {
+ serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
+ .setSchemaDescriptor(new GreeterFileDescriptorSupplier())
+ .addMethod(getSayHelloMethod())
+ .build();
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/GrpcGreeterImpl.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/GrpcGreeterImpl.java
new file mode 100644
index 0000000..af14ca6
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/GrpcGreeterImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.rpc.protocol.grpc.support;
+
+import io.grpc.stub.StreamObserver;
+
+public class GrpcGreeterImpl extends DubboGreeterGrpc.GreeterImplBase {
+
+ @Override
+ public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
+ System.out.println("Executing thread is " + Thread.currentThread().getName());
+ HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + request.getName()).build();
+ responseObserver.onNext(reply);
+ responseObserver.onCompleted();
+ }
+
+}
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloReply.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloReply.java
new file mode 100644
index 0000000..8be68f6
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloReply.java
@@ -0,0 +1,616 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: helloworld.proto
+
+package org.apache.dubbo.rpc.protocol.grpc.support;
+
+/**
+ * <pre>
+ * The response message containing the greetings
+ * </pre>
+ * <p>
+ * Protobuf type {@code helloworld.HelloReply}
+ */
+public final class HelloReply extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:helloworld.HelloReply)
+ HelloReplyOrBuilder {
+ private static final long serialVersionUID = 0L;
+
+ // Use HelloReply.newBuilder() to construct.
+ private HelloReply(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
+ super(builder);
+ }
+
+ private HelloReply() {
+ message_ = "";
+ }
+
+ @Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+
+ private HelloReply(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new NullPointerException();
+ }
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ String s = input.readStringRequireUtf8();
+
+ message_ = s;
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return HelloWorldProto.internal_static_helloworld_HelloReply_descriptor;
+ }
+
+ @Override
+ protected FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return HelloWorldProto.internal_static_helloworld_HelloReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ HelloReply.class, Builder.class);
+ }
+
+ public static final int MESSAGE_FIELD_NUMBER = 1;
+ private volatile Object message_;
+
+ /**
+ * <code>string message = 1;</code>
+ */
+ public String getMessage() {
+ Object ref = message_;
+ if (ref instanceof String) {
+ return (String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ }
+ }
+
+ /**
+ * <code>string message = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ Object ref = message_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+
+ @Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) {
+ return true;
+ }
+ if (isInitialized == 0) {
+ return false;
+ }
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!getMessageBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, message_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) {
+ return size;
+ }
+
+ size = 0;
+ if (!getMessageBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, message_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof HelloReply)) {
+ return super.equals(obj);
+ }
+ HelloReply other = (HelloReply) obj;
+
+ if (!getMessage()
+ .equals(other.getMessage())) {
+ return false;
+ }
+ if (!unknownFields.equals(other.unknownFields)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
+ hash = (53 * hash) + getMessage().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static HelloReply parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static HelloReply parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static HelloReply parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static HelloReply parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static HelloReply parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static HelloReply parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static HelloReply parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ public static HelloReply parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ public static HelloReply parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+
+ public static HelloReply parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ public static HelloReply parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ public static HelloReply parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @Override
+ public Builder newBuilderForType() {
+ return newBuilder();
+ }
+
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+
+ public static Builder newBuilder(HelloReply prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @Override
+ protected Builder newBuilderForType(
+ BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+
+ /**
+ * <pre>
+ * The response message containing the greetings
+ * </pre>
+ * <p>
+ * Protobuf type {@code helloworld.HelloReply}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
+ // @@protoc_insertion_point(builder_implements:helloworld.HelloReply)
+ HelloReplyOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return HelloWorldProto.internal_static_helloworld_HelloReply_descriptor;
+ }
+
+ @Override
+ protected FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return HelloWorldProto.internal_static_helloworld_HelloReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ HelloReply.class, Builder.class);
+ }
+
+ // Construct using org.apache.dubbo.demo.hello.HelloReply.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+
+ @Override
+ public Builder clear() {
+ super.clear();
+ message_ = "";
+
+ return this;
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return HelloWorldProto.internal_static_helloworld_HelloReply_descriptor;
+ }
+
+ @Override
+ public HelloReply getDefaultInstanceForType() {
+ return HelloReply.getDefaultInstance();
+ }
+
+ @Override
+ public HelloReply build() {
+ HelloReply result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @Override
+ public HelloReply buildPartial() {
+ HelloReply result = new HelloReply(this);
+ result.message_ = message_;
+ onBuilt();
+ return result;
+ }
+
+ @Override
+ public Builder clone() {
+ return super.clone();
+ }
+
+ @Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ Object value) {
+ return super.setField(field, value);
+ }
+
+ @Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+
+ @Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+
+ @Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+
+ @Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ Object value) {
+ return super.addRepeatedField(field, value);
+ }
+
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof HelloReply) {
+ return mergeFrom((HelloReply) other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(HelloReply other) {
+ if (other == HelloReply.getDefaultInstance()) {
+ return this;
+ }
+ if (!other.getMessage().isEmpty()) {
+ message_ = other.message_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ HelloReply parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (HelloReply) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private Object message_ = "";
+
+ /**
+ * <code>string message = 1;</code>
+ */
+ public String getMessage() {
+ Object ref = message_;
+ if (!(ref instanceof String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ } else {
+ return (String) ref;
+ }
+ }
+
+ /**
+ * <code>string message = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ Object ref = message_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ /**
+ * <code>string message = 1;</code>
+ */
+ public Builder setMessage(
+ String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+
+ /**
+ * <code>string message = 1;</code>
+ */
+ public Builder clearMessage() {
+
+ message_ = getDefaultInstance().getMessage();
+ onChanged();
+ return this;
+ }
+
+ /**
+ * <code>string message = 1;</code>
+ */
+ public Builder setMessageBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+
+ @Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:helloworld.HelloReply)
+ }
+
+ // @@protoc_insertion_point(class_scope:helloworld.HelloReply)
+ private static final HelloReply DEFAULT_INSTANCE;
+
+ static {
+ DEFAULT_INSTANCE = new HelloReply();
+ }
+
+ public static HelloReply getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser<HelloReply>
+ PARSER = new com.google.protobuf.AbstractParser<HelloReply>() {
+ @Override
+ public HelloReply parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new HelloReply(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser<HelloReply> parser() {
+ return PARSER;
+ }
+
+ @Override
+ public com.google.protobuf.Parser<HelloReply> getParserForType() {
+ return PARSER;
+ }
+
+ @Override
+ public HelloReply getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+}
+
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloReplyOrBuilder.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloReplyOrBuilder.java
new file mode 100644
index 0000000..5100483
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloReplyOrBuilder.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: helloworld.proto
+
+package org.apache.dubbo.rpc.protocol.grpc.support;
+
+public interface HelloReplyOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:helloworld.HelloReply)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ * <code>string message = 1;</code>
+ */
+ String getMessage();
+
+ /**
+ * <code>string message = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getMessageBytes();
+}
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloRequest.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloRequest.java
new file mode 100644
index 0000000..c97674a
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloRequest.java
@@ -0,0 +1,616 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: helloworld.proto
+
+package org.apache.dubbo.rpc.protocol.grpc.support;
+
+/**
+ * <pre>
+ * The request message containing the user's name.
+ * </pre>
+ * <p>
+ * Protobuf type {@code helloworld.HelloRequest}
+ */
+public final class HelloRequest extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:helloworld.HelloRequest)
+ HelloRequestOrBuilder {
+ private static final long serialVersionUID = 0L;
+
+ // Use HelloRequest.newBuilder() to construct.
+ private HelloRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
+ super(builder);
+ }
+
+ private HelloRequest() {
+ name_ = "";
+ }
+
+ @Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+
+ private HelloRequest(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new NullPointerException();
+ }
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ String s = input.readStringRequireUtf8();
+
+ name_ = s;
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.rpc.protocol.grpc.support.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor;
+ }
+
+ @Override
+ protected FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.rpc.protocol.grpc.support.HelloWorldProto.internal_static_helloworld_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ HelloRequest.class, Builder.class);
+ }
+
+ public static final int NAME_FIELD_NUMBER = 1;
+ private volatile Object name_;
+
+ /**
+ * <code>string name = 1;</code>
+ */
+ public String getName() {
+ Object ref = name_;
+ if (ref instanceof String) {
+ return (String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ }
+ }
+
+ /**
+ * <code>string name = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+
+ @Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) {
+ return true;
+ }
+ if (isInitialized == 0) {
+ return false;
+ }
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!getNameBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) {
+ return size;
+ }
+
+ size = 0;
+ if (!getNameBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof HelloRequest)) {
+ return super.equals(obj);
+ }
+ HelloRequest other = (HelloRequest) obj;
+
+ if (!getName()
+ .equals(other.getName())) {
+ return false;
+ }
+ if (!unknownFields.equals(other.unknownFields)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getName().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static HelloRequest parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static HelloRequest parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static HelloRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static HelloRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static HelloRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static HelloRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static HelloRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ public static HelloRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ public static HelloRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+
+ public static HelloRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ public static HelloRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ public static HelloRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @Override
+ public Builder newBuilderForType() {
+ return newBuilder();
+ }
+
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+
+ public static Builder newBuilder(HelloRequest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @Override
+ protected Builder newBuilderForType(
+ BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+
+ /**
+ * <pre>
+ * The request message containing the user's name.
+ * </pre>
+ * <p>
+ * Protobuf type {@code helloworld.HelloRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
+ // @@protoc_insertion_point(builder_implements:helloworld.HelloRequest)
+ HelloRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.rpc.protocol.grpc.support.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor;
+ }
+
+ @Override
+ protected FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.rpc.protocol.grpc.support.HelloWorldProto.internal_static_helloworld_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ HelloRequest.class, Builder.class);
+ }
+
+ // Construct using org.apache.dubbo.rpc.protocol.grpc.support.HelloRequest.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+
+ @Override
+ public Builder clear() {
+ super.clear();
+ name_ = "";
+
+ return this;
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.dubbo.rpc.protocol.grpc.support.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor;
+ }
+
+ @Override
+ public HelloRequest getDefaultInstanceForType() {
+ return HelloRequest.getDefaultInstance();
+ }
+
+ @Override
+ public HelloRequest build() {
+ HelloRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @Override
+ public HelloRequest buildPartial() {
+ HelloRequest result = new HelloRequest(this);
+ result.name_ = name_;
+ onBuilt();
+ return result;
+ }
+
+ @Override
+ public Builder clone() {
+ return super.clone();
+ }
+
+ @Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ Object value) {
+ return super.setField(field, value);
+ }
+
+ @Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+
+ @Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+
+ @Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+
+ @Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ Object value) {
+ return super.addRepeatedField(field, value);
+ }
+
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof HelloRequest) {
+ return mergeFrom((HelloRequest) other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(HelloRequest other) {
+ if (other == HelloRequest.getDefaultInstance()) {
+ return this;
+ }
+ if (!other.getName().isEmpty()) {
+ name_ = other.name_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ HelloRequest parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (HelloRequest) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private Object name_ = "";
+
+ /**
+ * <code>string name = 1;</code>
+ */
+ public String getName() {
+ Object ref = name_;
+ if (!(ref instanceof String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ } else {
+ return (String) ref;
+ }
+ }
+
+ /**
+ * <code>string name = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ /**
+ * <code>string name = 1;</code>
+ */
+ public Builder setName(
+ String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+
+ /**
+ * <code>string name = 1;</code>
+ */
+ public Builder clearName() {
+
+ name_ = getDefaultInstance().getName();
+ onChanged();
+ return this;
+ }
+
+ /**
+ * <code>string name = 1;</code>
+ */
+ public Builder setNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+
+ @Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:helloworld.HelloRequest)
+ }
+
+ // @@protoc_insertion_point(class_scope:helloworld.HelloRequest)
+ private static final HelloRequest DEFAULT_INSTANCE;
+
+ static {
+ DEFAULT_INSTANCE = new HelloRequest();
+ }
+
+ public static HelloRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser<HelloRequest>
+ PARSER = new com.google.protobuf.AbstractParser<HelloRequest>() {
+ @Override
+ public HelloRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new HelloRequest(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser<HelloRequest> parser() {
+ return PARSER;
+ }
+
+ @Override
+ public com.google.protobuf.Parser<HelloRequest> getParserForType() {
+ return PARSER;
+ }
+
+ @Override
+ public HelloRequest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+}
+
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloRequestOrBuilder.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloRequestOrBuilder.java
new file mode 100644
index 0000000..318e674
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloRequestOrBuilder.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: helloworld.proto
+
+package org.apache.dubbo.rpc.protocol.grpc.support;
+
+public interface HelloRequestOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:helloworld.HelloRequest)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ * <code>string name = 1;</code>
+ */
+ String getName();
+
+ /**
+ * <code>string name = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getNameBytes();
+}
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloWorldProto.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloWorldProto.java
new file mode 100644
index 0000000..6254ebb
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/support/HelloWorldProto.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: helloworld.proto
+
+package org.apache.dubbo.rpc.protocol.grpc.support;
+
+public final class HelloWorldProto {
+ private HelloWorldProto() {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistryLite registry) {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registerAllExtensions(
+ (com.google.protobuf.ExtensionRegistryLite) registry);
+ }
+
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_helloworld_HelloRequest_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_helloworld_HelloRequest_fieldAccessorTable;
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_helloworld_HelloReply_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_helloworld_HelloReply_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+
+ static {
+ String[] descriptorData = {
+ "\n\020helloworld.proto\022\nhelloworld\"\034\n\014HelloR" +
+ "equest\022\014\n\004name\030\001 \001(\t\"\035\n\nHelloReply\022\017\n\007me" +
+ "ssage\030\001 \001(\tB6\n\033org.apache.dubbo.demo.hel" +
+ "loB\017HelloWorldProtoP\001\242\002\003HLWb\006proto3"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ }, assigner);
+ internal_static_helloworld_HelloRequest_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_helloworld_HelloRequest_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_helloworld_HelloRequest_descriptor,
+ new String[] {"Name",});
+ internal_static_helloworld_HelloReply_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_helloworld_HelloReply_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_helloworld_HelloReply_descriptor,
+ new String[] {"Message",});
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}