forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for duplicate services - mutiny and plain; from quarkusio#44326
- Loading branch information
Showing
9 changed files
with
136 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
extensions/grpc/deployment/src/test/java/io/quarkus/grpc/server/DuplicateServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.quarkus.grpc.server; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.grpc.examples.dups.Poke; | ||
import io.quarkus.grpc.server.dups.MutinyPokeService; | ||
import io.quarkus.grpc.server.dups.PokeService; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class DuplicateServiceTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest unitTest = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(MutinyPokeService.class, PokeService.class) | ||
.addPackage(Poke.class.getPackage())) | ||
.assertException(t -> { | ||
Assertions.assertTrue(t.getMessage().contains("Duplicated gRPC service")); | ||
}); | ||
|
||
@Test | ||
void testDuplicateService() { | ||
fail("Should not be called"); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...sions/grpc/deployment/src/test/java/io/quarkus/grpc/server/VertxDuplicateServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.quarkus.grpc.server; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.grpc.examples.dups.Poke; | ||
import io.quarkus.grpc.server.dups.MutinyPokeService; | ||
import io.quarkus.grpc.server.dups.PokeService; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class VertxDuplicateServiceTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest unitTest = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(MutinyPokeService.class, PokeService.class) | ||
.addPackage(Poke.class.getPackage())) | ||
.overrideConfigKey("quarkus.grpc.server.use-separate-server", "false") | ||
.assertException(t -> { | ||
Assertions.assertTrue(t.getMessage().contains("Duplicated gRPC service")); | ||
}); | ||
|
||
@Test | ||
void testDuplicateService() { | ||
fail("Should not be called"); | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
extensions/grpc/deployment/src/test/java/io/quarkus/grpc/server/dups/MutinyPokeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.quarkus.grpc.server.dups; | ||
|
||
import io.grpc.examples.dups.Poke; | ||
import io.grpc.examples.dups.PokeReply; | ||
import io.grpc.examples.dups.PokeRequest; | ||
import io.quarkus.grpc.GrpcService; | ||
import io.smallrye.mutiny.Uni; | ||
|
||
@GrpcService | ||
public class MutinyPokeService implements Poke { | ||
@Override | ||
public Uni<PokeReply> poke(PokeRequest request) { | ||
return null; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
extensions/grpc/deployment/src/test/java/io/quarkus/grpc/server/dups/PokeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.quarkus.grpc.server.dups; | ||
|
||
import io.grpc.examples.dups.PokeGrpc; | ||
import io.grpc.examples.dups.PokeReply; | ||
import io.grpc.examples.dups.PokeRequest; | ||
import io.grpc.stub.StreamObserver; | ||
import io.quarkus.grpc.GrpcService; | ||
|
||
@GrpcService | ||
public class PokeService extends PokeGrpc.PokeImplBase { | ||
@Override | ||
public void poke(PokeRequest request, StreamObserver<PokeReply> responseObserver) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
syntax = "proto3"; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "io.grpc.examples.dups"; | ||
option java_outer_classname = "DupsFooProto"; | ||
option objc_class_prefix = "DF"; | ||
|
||
package dups; | ||
|
||
service Poke { | ||
rpc poke (PokeRequest) returns (PokeReply) {} | ||
} | ||
|
||
message PokeRequest { | ||
string name = 1; | ||
} | ||
|
||
message PokeReply { | ||
string message = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters