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

deps: update dependency com.google.cloud:google-iam-policy to v1.11.0 #1505

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
15 changes: 15 additions & 0 deletions .github/workflows/ci-maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ jobs:
# Exclude the root project
run: mvn -B -ntp fmt:check

compatibility:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
cache: maven
- run: java -version
- name: Compatibility check
# package jar so that gapic-generator-java module can use
# testlib modules of gax
run: mvn package clirr:check -DskipTests

showcase:
runs-on: ubuntu-22.04
strategy:
Expand Down
22 changes: 11 additions & 11 deletions gax-java/dependencies.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ maven.io_opencensus_opencensus_api=io.opencensus:opencensus-api:0.31.1
maven.io_opencensus_opencensus_contrib_grpc_metrics=io.opencensus:opencensus-contrib-grpc-metrics:0.31.1
maven.io_opencensus_opencensus_contrib_http_util=io.opencensus:opencensus-contrib-http-util:0.31.1
maven.io_netty_netty_tcnative_boringssl_static=io.netty:netty-tcnative-boringssl-static:2.0.59.Final
maven.io_netty_netty_handler=io.netty:netty-handler:4.1.89.Final
maven.io_netty_netty_common=io.netty:netty-common:4.1.89.Final
maven.io_netty_netty_codec_socks=io.netty:netty-codec-socks:4.1.89.Final
maven.io_netty_netty_codec_http2=io.netty:netty-codec-http2:4.1.89.Final
maven.io_netty_netty_codec_http=io.netty:netty-codec-http:4.1.89.Final
maven.io_netty_netty_codec=io.netty:netty-codec:4.1.89.Final
maven.io_netty_netty_buffer=io.netty:netty-buffer:4.1.89.Final
maven.io_netty_netty_resolver=io.netty:netty-resolver:4.1.89.Final
maven.io_netty_netty_transport=io.netty:netty-transport:4.1.89.Final
maven.io_netty_netty_handler_proxy=io.netty:netty-handler-proxy:4.1.89.Final
maven.io_netty_netty_transport_native_unix_common=io.netty:netty-transport-native-unix-common:4.1.89.Final
maven.io_netty_netty_handler=io.netty:netty-handler:4.1.90.Final
maven.io_netty_netty_common=io.netty:netty-common:4.1.90.Final
maven.io_netty_netty_codec_socks=io.netty:netty-codec-socks:4.1.90.Final
maven.io_netty_netty_codec_http2=io.netty:netty-codec-http2:4.1.90.Final
maven.io_netty_netty_codec_http=io.netty:netty-codec-http:4.1.90.Final
maven.io_netty_netty_codec=io.netty:netty-codec:4.1.90.Final
maven.io_netty_netty_buffer=io.netty:netty-buffer:4.1.90.Final
maven.io_netty_netty_resolver=io.netty:netty-resolver:4.1.90.Final
maven.io_netty_netty_transport=io.netty:netty-transport:4.1.90.Final
maven.io_netty_netty_handler_proxy=io.netty:netty-handler-proxy:4.1.90.Final
maven.io_netty_netty_transport_native_unix_common=io.netty:netty-transport-native-unix-common:4.1.90.Final
maven.io_perfmark_perfmark_api=io.perfmark:perfmark-api:0.26.0
maven.org_apache_tomcat_annotations_api=org.apache.tomcat:annotations-api:6.0.53
maven.com_google_code_gson_gson=com.google.code.gson:gson:2.10.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ HttpRequest createHttpRequest() throws IOException {
jsonFactory.createJsonParser(requestBody).parse(tokenRequest);
jsonHttpContent =
new JsonHttpContent(jsonFactory, tokenRequest)
.setMediaType((new HttpMediaType("application/json")));
.setMediaType((new HttpMediaType("application/json; charset=utf-8")));
} else {
// Force underlying HTTP lib to set Content-Length header to avoid 411s.
// See EmptyContent.java.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import com.google.longrunning.ListOperationsRequest;
import com.google.protobuf.Empty;
import com.google.protobuf.Field;
import com.google.protobuf.util.JsonFormat;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -177,4 +179,67 @@ public void testRequestUrlUnnormalizedPatch() throws IOException {
Truth.assertThat(httpRequest.getRequestMethod()).isEqualTo("POST");
Truth.assertThat(httpRequest.getHeaders().get("X-HTTP-Method-Override")).isEqualTo("PATCH");
}

/*
We use a separate RequestFormatter because formatting the body requests is what sets the charset to be UTF-8.
The other tests above do not have a set a body request and instead send an EmptyContent (null Type/ CharSet)
*/
@Test
public void testUnicodeValuesInBody() throws IOException {
HttpRequestFormatter<Field> bodyRequestFormatter =
ProtoMessageRequestFormatter.<Field>newBuilder()
.setPath(
"/name/{name=*}",
request -> {
Map<String, String> fields = new HashMap<>();
ProtoRestSerializer<Field> serializer = ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(request -> new HashMap<>())
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create().toBody("*", request.toBuilder().build(), true))
.build();

Field bodyRequestMessage =
Field.newBuilder()
.setName("feline ☺ → ←")
.setNumber(2)
.setDefaultValue("bird ☺ → ←")
.setJsonName("mouse ☺ → ←")
.setTypeUrl("small ☺ → ←")
.build();

ApiMethodDescriptor<Field, Empty> methodDescriptor =
ApiMethodDescriptor.<Field, Empty>newBuilder()
.setFullMethodName("house.cat.get")
.setHttpMethod("PUT")
.setRequestFormatter(bodyRequestFormatter)
.setResponseParser(responseParser)
.build();

HttpRequestRunnable<Field, Empty> httpRequestRunnable =
new HttpRequestRunnable<>(
bodyRequestMessage,
methodDescriptor,
"www.googleapis.com/animals/v1/projects",
HttpJsonCallOptions.newBuilder().build(),
new MockHttpTransport(),
HttpJsonMetadata.newBuilder().build(),
(result) -> {});

HttpRequest httpRequest = httpRequestRunnable.createHttpRequest();
Truth.assertThat(httpRequest.getContent().getType())
.isEqualTo("application/json; charset=utf-8");
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
// writeTo() uses the Charset when writing to the stream
httpRequest.getContent().writeTo(byteArrayOutputStream);
String output = byteArrayOutputStream.toString();
Field.Builder expectedBuilder = Field.newBuilder();
JsonFormat.parser().merge(output, expectedBuilder);
Field result = expectedBuilder.build();
Truth.assertThat(result).isEqualTo(bodyRequestMessage);
}
}
}
2 changes: 1 addition & 1 deletion java-iam/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-iam-policy</artifactId>
<version>1.9.4-SNAPSHOT</version><!-- {x-version-update:google-iam-policy:current} -->
<version>1.11.0</version><!-- {x-version-update:google-iam-policy:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
Expand Down