Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Verify the generation when using odd gRPC method names #29339

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public class BlockingStubInjectionTest {
public void test() {
String neo = service.invoke("neo");
assertThat(neo).isEqualTo("Hello neo");

neo = service.invokeWeird("neo");
assertThat(neo).isEqualTo("Hello neo");
}

@ApplicationScoped
Expand All @@ -49,5 +52,10 @@ public String invoke(String s) {
.getMessage();
}

public String invokeWeird(String s) {
return service.wEIRD(HelloRequest.newBuilder().setName(s).build())
.getMessage();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public class ChannelInjectionTest {
public void test() {
String neo = service.invoke("neo-channel");
assertThat(neo).isEqualTo("Hello neo-channel");

neo = service.invokeWeird("neo-weird");
assertThat(neo).isEqualTo("Hello neo-weird");
}

@ApplicationScoped
Expand All @@ -51,5 +54,11 @@ public String invoke(String s) {
.getMessage();
}

public String invokeWeird(String s) {
return GreeterGrpc.newBlockingStub(channel)
.wEIRD(HelloRequest.newBuilder().setName(s).build())
.getMessage();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,19 @@ public class ClientWithoutConfigInjectionTest {
public void testHelloWithBlockingClient() {
HelloReply reply = client.sayHello(HelloRequest.newBuilder().setName("neo").build());
assertThat(reply.getMessage()).isEqualTo("Hello neo");

reply = client.wEIRD(HelloRequest.newBuilder().setName("neo").build());
assertThat(reply.getMessage()).isEqualTo("Hello neo");
}

@Test
public void testHelloWithMutinyClient() {
Uni<HelloReply> reply = mutinyClient
.sayHello(HelloRequest.newBuilder().setName("neo").build());
assertThat(reply.await().atMost(TIMEOUT).getMessage()).isEqualTo("Hello neo");

reply = mutinyClient
.wEIRD(HelloRequest.newBuilder().setName("neo").build());
assertThat(reply.await().atMost(TIMEOUT).getMessage()).isEqualTo("Hello neo");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ public Uni<HelloReply> sayHello(HelloRequest request) {
.by(Duration.ofMillis(400));
}

@Override
public Uni<HelloReply> wEIRD(HelloRequest request) {
return sayHello(request);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ public static class ServiceA implements Greeter {
public Uni<HelloReply> sayHello(HelloRequest request) {
return Uni.createFrom().item(HelloReply.newBuilder().setMessage("Hello, " + request.getName()).build());
}

@Override
public Uni<HelloReply> wEIRD(HelloRequest request) {
return sayHello(request);
}
}

@GrpcService
Expand All @@ -117,6 +122,11 @@ public static class ServiceB implements Greeter3 {
public Uni<HelloReply3> sayHello(HelloRequest3 request) {
return Uni.createFrom().item(HelloReply3.newBuilder().setMessage("Hello3, " + request.getName()).build());
}

@Override
public Uni<HelloReply3> wEIRD(HelloRequest3 request) {
return sayHello(request);
}
}

@io.quarkus.grpc.GlobalInterceptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ public Uni<HelloReply> sayHello(HelloRequest request) {
return Uni.createFrom().item(() -> HelloReply.newBuilder()
.setMessage("hello " + MyFirstInterceptor.KEY_1.get() + " - " + MyFirstInterceptor.KEY_2.get()).build());
}

@Override
@Blocking
public Uni<HelloReply> wEIRD(HelloRequest request) {
return sayHello(request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public static class MyService implements Greeter {
public Uni<HelloReply> sayHello(HelloRequest request) {
return Uni.createFrom().item(HelloReply.newBuilder().setMessage("Hello, " + request.getName()).build());
}

@Override
public Uni<HelloReply> wEIRD(HelloRequest request) {
return sayHello(request);
}
}

@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@ public Uni<HelloReply> sayHello(HelloRequest request) {
.map(s -> Thread.currentThread().getName() + " " + s)
.map(s -> HelloReply.newBuilder().setMessage(s).build());
}

@Override
@Blocking
public Uni<HelloReply> wEIRD(HelloRequest request) {
return sayHello(request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseOb
responseObserver.onNext(HelloReply.newBuilder().setMessage("Hello " + request.getName()).build());
responseObserver.onCompleted();
}

@Override
public void wEIRD(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
sayHello(request, responseObserver);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ public Uni<HelloReply> sayHello(HelloRequest request) {
.map(s -> "Hello " + s)
.map(s -> HelloReply.newBuilder().setMessage(s).build());
}

@Override
public Uni<HelloReply> wEIRD(HelloRequest request) {
return sayHello(request);
}
}
2 changes: 2 additions & 0 deletions extensions/grpc/deployment/src/test/proto/helloworld.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ package helloworld;
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
rpc WEI_RD (HelloRequest) returns (HelloReply) {}

}

// The request message containing the user's name.
Expand Down
3 changes: 3 additions & 0 deletions extensions/grpc/deployment/src/test/proto/helloworld3.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ package helloworld;
service Greeter3 {
// Sends a greeting
rpc SayHello (HelloRequest3) returns (HelloReply3) {}

rpc WEI_RD (HelloRequest3) returns (HelloReply3) {}

}

// The request message containing the user's name.
Expand Down