Skip to content

Commit

Permalink
chore: Add Showcase Callables IT (#1483)
Browse files Browse the repository at this point in the history
* chore: Add Showcase Callables IT

* chore: Add test scope

* deps: update google http client dependencies to v1.43.1 (#1487)

* build(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.0.0 (#1488)

Co-authored-by: Lawrence Qiu <lawrenceqiu@google.com>

* chore(main): release 2.15.3 (#1445)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Lawrence Qiu <lawrenceqiu@google.com>

* chore(main): release 2.15.4-SNAPSHOT (#1489)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* chore: Refactor paged logic

* chore: Format ITCallables

* chore: Format ITCallables

* chore: Fix to not found status code

* chore: Add HttpJson Unary Callable Showcase Test

* chore: Fix truth dependency

* chore: Update test name

* chore: Address code smell

* chore: Remove incorrect comment

* chore: Update test to CANCELLED

* chore: Clean up PR

---------

Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 23, 2023
1 parent 750d4f5 commit ff19831
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 0 additions & 1 deletion showcase/gapic-showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,29 @@ public void testGrpc_shutdown() {
}

@Test
public void testHttpJson() {
public void testHttpJson_receiveContent() {
assertThat(echoHttpJson("http-echo?")).isEqualTo("http-echo?");
assertThat(echoHttpJson("http-echo!")).isEqualTo("http-echo!");
}

@Test
public void testHttpJson_serverResponseError_throwsException() {
EchoRequest requestWithServerError =
EchoRequest.newBuilder()
.setError(Status.newBuilder().setCode(StatusCode.Code.CANCELLED.ordinal()).build())
.build();
CancelledException exception =
assertThrows(CancelledException.class, () -> httpJsonClient.echo(requestWithServerError));
assertThat(exception.getStatusCode().getCode()).isEqualTo(StatusCode.Code.CANCELLED);
}

@Test
public void testHttpJson_shutdown() {
assertThat(httpJsonClient.isShutdown()).isFalse();
httpJsonClient.shutdown();
assertThat(httpJsonClient.isShutdown()).isTrue();
}

private String echoGrpc(String value) {
EchoResponse response = grpcClient.echo(EchoRequest.newBuilder().setContent(value).build());
return response.getContent();
Expand Down

0 comments on commit ff19831

Please sign in to comment.