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.
feat(grpc): added test profiles to grpc transcoding and fixed depende…
…ncies
- Loading branch information
1 parent
94c0bc3
commit 5c74729
Showing
6 changed files
with
61 additions
and
57 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
15 changes: 2 additions & 13 deletions
15
integration-tests/grpc-transcoding/src/main/resources/application.properties
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 |
---|---|---|
@@ -1,20 +1,9 @@ | ||
quarkus.grpc.server.port=9001 | ||
quarkus.grpc.server.instances=2 | ||
quarkus.grpc.server.use-separate-server=false | ||
quarkus.grpc.transcoding.enabled=true | ||
|
||
%vertx.quarkus.grpc.server.use-separate-server=false | ||
%n2o.quarkus.grpc.server.use-separate-server=true | ||
%o2n.quarkus.grpc.server.use-separate-server=false | ||
quarkus.grpc.server.port=9001 | ||
|
||
quarkus.grpc.clients.hello.host=localhost | ||
quarkus.grpc.clients.hello.port=9001 | ||
|
||
%vertx.quarkus.grpc.clients.hello.port=8081 | ||
%vertx.quarkus.grpc.clients.hello.use-quarkus-grpc-client=true | ||
|
||
%n2o.quarkus.grpc.clients.hello.port=9001 | ||
%n2o.quarkus.grpc.clients.hello.use-quarkus-grpc-client=true | ||
|
||
%o2n.quarkus.grpc.clients.hello.port=8081 | ||
%o2n.quarkus.grpc.clients.hello.use-quarkus-grpc-client=false | ||
%vertx.quarkus.grpc.server.use-separate-server=false |
42 changes: 1 addition & 41 deletions
42
...oding/src/test/java/io/quarkus/grpc/examples/hello/HelloWorldTranscodingEndpointTest.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 |
---|---|---|
@@ -1,47 +1,7 @@ | ||
package io.quarkus.grpc.examples.hello; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.google.protobuf.InvalidProtocolBufferException; | ||
import com.google.protobuf.util.JsonFormat; | ||
|
||
import examples.HelloRequest; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.restassured.http.ContentType; | ||
|
||
@QuarkusTest | ||
public class HelloWorldTranscodingEndpointTest { | ||
|
||
@Test | ||
public void testSimplePath() { | ||
given() | ||
.body(getJsonRequest("simple-test")) | ||
.contentType(ContentType.JSON) | ||
.when().post("/v2/simple") | ||
.then() | ||
.statusCode(200) | ||
.body("message", is("Hello from Simple Path, simple-test!")); | ||
} | ||
|
||
@Test | ||
public void testComplexPath() { | ||
given() | ||
.contentType(ContentType.JSON) | ||
.when().post("/v2/complex/complex-test/path") | ||
.then() | ||
.statusCode(200) | ||
.body("message", is("Hello from Complex Path, complex-test!")); | ||
} | ||
|
||
private String getJsonRequest(String name) { | ||
try { | ||
return JsonFormat.printer().omittingInsignificantWhitespace() | ||
.print(HelloRequest.newBuilder().setName(name).build()); | ||
} catch (InvalidProtocolBufferException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
public class HelloWorldTranscodingEndpointTest extends HelloWorldTranscodingEndpointTestBase { | ||
} |
45 changes: 45 additions & 0 deletions
45
...g/src/test/java/io/quarkus/grpc/examples/hello/HelloWorldTranscodingEndpointTestBase.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,45 @@ | ||
package io.quarkus.grpc.examples.hello; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.google.protobuf.InvalidProtocolBufferException; | ||
import com.google.protobuf.util.JsonFormat; | ||
|
||
import examples.HelloRequest; | ||
import io.restassured.http.ContentType; | ||
|
||
class HelloWorldTranscodingEndpointTestBase { | ||
|
||
@Test | ||
public void testSimplePath() { | ||
given() | ||
.body(getJsonRequest("simple-test")) | ||
.contentType(ContentType.JSON) | ||
.when().post("/v2/simple") | ||
.then() | ||
.statusCode(200) | ||
.body("message", is("Hello from Simple Path, simple-test!")); | ||
} | ||
|
||
@Test | ||
public void testComplexPath() { | ||
given() | ||
.contentType(ContentType.JSON) | ||
.when().post("/v2/complex/complex-test/path") | ||
.then() | ||
.statusCode(200) | ||
.body("message", is("Hello from Complex Path, complex-test!")); | ||
} | ||
|
||
private String getJsonRequest(String name) { | ||
try { | ||
return JsonFormat.printer().omittingInsignificantWhitespace() | ||
.print(HelloRequest.newBuilder().setName(name).build()); | ||
} catch (InvalidProtocolBufferException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
.../src/test/java/io/quarkus/grpc/examples/hello/VertxHelloWorldTranscodingEndpointTest.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,10 @@ | ||
package io.quarkus.grpc.examples.hello; | ||
|
||
import io.quarkus.grpc.test.utils.VertxGRPCTestProfile; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.TestProfile; | ||
|
||
@QuarkusTest | ||
@TestProfile(VertxGRPCTestProfile.class) | ||
public class VertxHelloWorldTranscodingEndpointTest extends HelloWorldTranscodingEndpointTestBase { | ||
} |