From 72dfefc55a9cbcc37a19a71331eea81b001669dd Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Thu, 9 Mar 2023 14:22:30 -0500 Subject: [PATCH 1/9] chore: Use UTF-8 as default charset for HttpJson --- .../api/gax/httpjson/HttpRequestRunnable.java | 2 +- .../gax/httpjson/HttpRequestRunnableTest.java | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/HttpRequestRunnable.java b/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/HttpRequestRunnable.java index 2edb4ceb2e..cc0ca4c20d 100644 --- a/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/HttpRequestRunnable.java +++ b/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/HttpRequestRunnable.java @@ -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. diff --git a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java index f68b11feba..af4114d3ad 100644 --- a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java +++ b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java @@ -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; @@ -47,9 +49,13 @@ import org.mockito.Mockito; public class HttpRequestRunnableTest { + private static final String MEDIA_TYPE = "application/json; charset=utf-8"; + private static Field requestMessage; + private static Field bodyRequestMessage; private static final String ENDPOINT = "https://www.googleapis.com/animals/v1/projects"; private static HttpRequestFormatter requestFormatter; + private static HttpRequestFormatter bodyRequestFormatter; private static HttpResponseParser responseParser; @SuppressWarnings("unchecked") @@ -64,6 +70,15 @@ public static void setUp() { .setTypeUrl("small") .build(); + bodyRequestMessage = + Field.newBuilder() + .setName("feline ☺ → ←") + .setNumber(2) + .setDefaultValue("bird ☺ → ←") + .setJsonName("mouse ☺ → ←") + .setTypeUrl("small ☺ → ←") + .build(); + requestFormatter = ProtoMessageRequestFormatter.newBuilder() .setPath( @@ -91,6 +106,22 @@ public static void setUp() { .setRequestBodyExtractor(request -> null) .build(); + bodyRequestFormatter = + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/name/{name=*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer 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(); + responseParser = Mockito.mock(HttpResponseParser.class); } @@ -177,4 +208,40 @@ 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 as formatting the body requests sets the charset to be UTF-8. + The other tests above do not have a set a body request and sent as EmptyContent which has a null Type/ CharSet + */ + @Test + public void testUnicodeValuesInBody() throws IOException { + ApiMethodDescriptor methodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("house.cat.get") + .setHttpMethod("PUT") + .setRequestFormatter(bodyRequestFormatter) + .setResponseParser(responseParser) + .build(); + + HttpRequestRunnable 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(MEDIA_TYPE); + try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { + httpRequest.getContent().writeTo(byteArrayOutputStream); + String output = byteArrayOutputStream.toString(); + Field.Builder expectedBuilder = Field.newBuilder(); + JsonFormat.parser().merge(output, expectedBuilder); + Field expected = expectedBuilder.build(); + Truth.assertThat(expected).isEqualTo(bodyRequestMessage); + } + } } From 9ffaf3216d45c883a012a1270109a543adf6276c Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 13 Mar 2023 11:46:25 -0400 Subject: [PATCH 2/9] chore: Update comment documentation --- .../com/google/api/gax/httpjson/HttpRequestRunnableTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java index af4114d3ad..6618c73053 100644 --- a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java +++ b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java @@ -210,8 +210,8 @@ public void testRequestUrlUnnormalizedPatch() throws IOException { } /* - We use a separate RequestFormatter as formatting the body requests sets the charset to be UTF-8. - The other tests above do not have a set a body request and sent as EmptyContent which has a null Type/ CharSet + 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 { From 3eb90e7e5518efd90773fc43af6790cbc8d702a3 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 13 Mar 2023 13:00:09 -0400 Subject: [PATCH 3/9] chore: Add comments to test --- .../api/gax/httpjson/HttpRequestRunnableTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java index 6618c73053..b8259e221d 100644 --- a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java +++ b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java @@ -49,8 +49,6 @@ import org.mockito.Mockito; public class HttpRequestRunnableTest { - private static final String MEDIA_TYPE = "application/json; charset=utf-8"; - private static Field requestMessage; private static Field bodyRequestMessage; private static final String ENDPOINT = "https://www.googleapis.com/animals/v1/projects"; @@ -234,14 +232,16 @@ public void testUnicodeValuesInBody() throws IOException { (result) -> {}); HttpRequest httpRequest = httpRequestRunnable.createHttpRequest(); - Truth.assertThat(httpRequest.getContent().getType()).isEqualTo(MEDIA_TYPE); + 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 expected = expectedBuilder.build(); - Truth.assertThat(expected).isEqualTo(bodyRequestMessage); + Field result = expectedBuilder.build(); + Truth.assertThat(result).isEqualTo(bodyRequestMessage); } } } From 277424126c0ad1dcb8e727129fb9353f3c6c2c30 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Tue, 14 Mar 2023 11:19:44 -0400 Subject: [PATCH 4/9] chore: Move bodyrequestformatter to the specific test --- .../gax/httpjson/HttpRequestRunnableTest.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java index b8259e221d..6e7d172857 100644 --- a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java +++ b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java @@ -53,7 +53,6 @@ public class HttpRequestRunnableTest { private static Field bodyRequestMessage; private static final String ENDPOINT = "https://www.googleapis.com/animals/v1/projects"; private static HttpRequestFormatter requestFormatter; - private static HttpRequestFormatter bodyRequestFormatter; private static HttpResponseParser responseParser; @SuppressWarnings("unchecked") @@ -104,22 +103,6 @@ public static void setUp() { .setRequestBodyExtractor(request -> null) .build(); - bodyRequestFormatter = - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/name/{name=*}", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer 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(); - responseParser = Mockito.mock(HttpResponseParser.class); } @@ -213,6 +196,22 @@ The other tests above do not have a set a body request and instead send an Empty */ @Test public void testUnicodeValuesInBody() throws IOException { + HttpRequestFormatter bodyRequestFormatter = + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/name/{name=*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer 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(); + ApiMethodDescriptor methodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("house.cat.get") From 51d1eda8851715e599c75f9d8ab77739afbda495 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Thu, 16 Mar 2023 17:45:07 -0400 Subject: [PATCH 5/9] chore: Move bodyrequestmessage to unit test --- .../gax/httpjson/HttpRequestRunnableTest.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java index 6e7d172857..4e825d679d 100644 --- a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java +++ b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpRequestRunnableTest.java @@ -50,7 +50,6 @@ public class HttpRequestRunnableTest { private static Field requestMessage; - private static Field bodyRequestMessage; private static final String ENDPOINT = "https://www.googleapis.com/animals/v1/projects"; private static HttpRequestFormatter requestFormatter; private static HttpResponseParser responseParser; @@ -67,15 +66,6 @@ public static void setUp() { .setTypeUrl("small") .build(); - bodyRequestMessage = - Field.newBuilder() - .setName("feline ☺ → ←") - .setNumber(2) - .setDefaultValue("bird ☺ → ←") - .setJsonName("mouse ☺ → ←") - .setTypeUrl("small ☺ → ←") - .build(); - requestFormatter = ProtoMessageRequestFormatter.newBuilder() .setPath( @@ -212,6 +202,15 @@ public void testUnicodeValuesInBody() throws IOException { ProtoRestSerializer.create().toBody("*", request.toBuilder().build(), true)) .build(); + Field bodyRequestMessage = + Field.newBuilder() + .setName("feline ☺ → ←") + .setNumber(2) + .setDefaultValue("bird ☺ → ←") + .setJsonName("mouse ☺ → ←") + .setTypeUrl("small ☺ → ←") + .build(); + ApiMethodDescriptor methodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("house.cat.get") From d6d3e642f4e35694752ed9835d25a64ccefb03ea Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 13:02:46 -0400 Subject: [PATCH 6/9] chore(main): release 2.15.4-SNAPSHOT (#1489) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- WORKSPACE | 2 +- api-common-java/pom.xml | 4 +-- gapic-generator-java-bom/pom.xml | 24 ++++++++-------- gapic-generator-java-pom-parent/pom.xml | 2 +- gapic-generator-java/pom.xml | 6 ++-- gax-java/dependencies.properties | 8 +++--- gax-java/gax-bom/pom.xml | 20 ++++++------- gax-java/gax-grpc/pom.xml | 4 +-- gax-java/gax-httpjson/pom.xml | 4 +-- gax-java/gax/pom.xml | 4 +-- gax-java/pom.xml | 14 +++++----- .../grpc-google-common-protos/pom.xml | 4 +-- java-common-protos/pom.xml | 8 +++--- .../proto-google-common-protos/pom.xml | 4 +-- java-iam/grpc-google-iam-v1/pom.xml | 4 +-- java-iam/grpc-google-iam-v2/pom.xml | 4 +-- java-iam/grpc-google-iam-v2beta/pom.xml | 4 +-- java-iam/pom.xml | 22 +++++++-------- java-iam/proto-google-iam-v1/pom.xml | 4 +-- java-iam/proto-google-iam-v2/pom.xml | 4 +-- java-iam/proto-google-iam-v2beta/pom.xml | 4 +-- showcase/pom.xml | 2 +- versions.txt | 28 +++++++++---------- 23 files changed, 92 insertions(+), 92 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 38a762520f..faf2e7eac2 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -60,7 +60,7 @@ maven_install( repositories = ["https://repo.maven.apache.org/maven2/"], ) -_gapic_generator_java_version = "2.15.3" # {x-version-update:gapic-generator-java:current} +_gapic_generator_java_version = "2.15.4-SNAPSHOT" # {x-version-update:gapic-generator-java:current} maven_install( artifacts = [ diff --git a/api-common-java/pom.xml b/api-common-java/pom.xml index 11465d1b50..97be116b9b 100644 --- a/api-common-java/pom.xml +++ b/api-common-java/pom.xml @@ -5,14 +5,14 @@ com.google.api api-common jar - 2.6.3 + 2.6.4-SNAPSHOT API Common Common utilities for Google APIs in Java com.google.api gapic-generator-java-pom-parent - 2.15.3 + 2.15.4-SNAPSHOT ../gapic-generator-java-pom-parent diff --git a/gapic-generator-java-bom/pom.xml b/gapic-generator-java-bom/pom.xml index 92143fbac6..e4f00addf8 100644 --- a/gapic-generator-java-bom/pom.xml +++ b/gapic-generator-java-bom/pom.xml @@ -4,7 +4,7 @@ com.google.api gapic-generator-java-bom pom - 2.15.3 + 2.15.4-SNAPSHOT GAPIC Generator Java BOM BOM for the libraries in gapic-generator-java repository. Users should not @@ -15,7 +15,7 @@ com.google.api gapic-generator-java-pom-parent - 2.15.3 + 2.15.4-SNAPSHOT ../gapic-generator-java-pom-parent @@ -60,56 +60,56 @@ com.google.api api-common - 2.6.3 + 2.6.4-SNAPSHOT com.google.api gax-bom - 2.23.3 + 2.23.4-SNAPSHOT pom import com.google.api.grpc grpc-google-common-protos - 2.14.3 + 2.14.4-SNAPSHOT com.google.api.grpc proto-google-common-protos - 2.14.3 + 2.14.4-SNAPSHOT com.google.api.grpc proto-google-iam-v1 - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc proto-google-iam-v2 - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc proto-google-iam-v2beta - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc grpc-google-iam-v1 - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc grpc-google-iam-v2 - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc grpc-google-iam-v2beta - 1.9.3 + 1.9.4-SNAPSHOT diff --git a/gapic-generator-java-pom-parent/pom.xml b/gapic-generator-java-pom-parent/pom.xml index 6ca5cea869..91addcbc56 100644 --- a/gapic-generator-java-pom-parent/pom.xml +++ b/gapic-generator-java-pom-parent/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.google.api gapic-generator-java-pom-parent - 2.15.3 + 2.15.4-SNAPSHOT pom GAPIC Generator Java POM Parent https://github.com/googleapis/gapic-generator-java diff --git a/gapic-generator-java/pom.xml b/gapic-generator-java/pom.xml index ff3044fba9..1369a3a310 100644 --- a/gapic-generator-java/pom.xml +++ b/gapic-generator-java/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.google.api gapic-generator-java - 2.15.3 + 2.15.4-SNAPSHOT GAPIC Generator Java GAPIC generator Java @@ -23,7 +23,7 @@ com.google.api gapic-generator-java-pom-parent - 2.15.3 + 2.15.4-SNAPSHOT ../gapic-generator-java-pom-parent @@ -32,7 +32,7 @@ com.google.api gapic-generator-java-bom - 2.15.3 + 2.15.4-SNAPSHOT pom import diff --git a/gax-java/dependencies.properties b/gax-java/dependencies.properties index 4998f181c6..1b8608303a 100644 --- a/gax-java/dependencies.properties +++ b/gax-java/dependencies.properties @@ -8,16 +8,16 @@ # Versions of oneself # {x-version-update-start:gax:current} -version.gax=2.23.3 +version.gax=2.23.4-SNAPSHOT # {x-version-update-end} # {x-version-update-start:gax:current} -version.gax_grpc=2.23.3 +version.gax_grpc=2.23.4-SNAPSHOT # {x-version-update-end} # {x-version-update-start:gax:current} -version.gax_bom=2.23.3 +version.gax_bom=2.23.4-SNAPSHOT # {x-version-update-end} # {x-version-update-start:gax-httpjson:current} -version.gax_httpjson=0.108.3 +version.gax_httpjson=0.108.4-SNAPSHOT # {x-version-update-end} # Versions for dependencies which actual artifacts differ between Bazel and Gradle. diff --git a/gax-java/gax-bom/pom.xml b/gax-java/gax-bom/pom.xml index 9ec28467ac..4fcc11d662 100644 --- a/gax-java/gax-bom/pom.xml +++ b/gax-java/gax-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.api gax-bom - 2.23.3 + 2.23.4-SNAPSHOT pom GAX (Google Api eXtensions) for Java (BOM) Google Api eXtensions for Java (BOM) @@ -43,55 +43,55 @@ com.google.api gax - 2.23.3 + 2.23.4-SNAPSHOT com.google.api gax - 2.23.3 + 2.23.4-SNAPSHOT test-jar testlib com.google.api gax - 2.23.3 + 2.23.4-SNAPSHOT testlib com.google.api gax-grpc - 2.23.3 + 2.23.4-SNAPSHOT com.google.api gax-grpc - 2.23.3 + 2.23.4-SNAPSHOT test-jar testlib com.google.api gax-grpc - 2.23.3 + 2.23.4-SNAPSHOT testlib com.google.api gax-httpjson - 0.108.3 + 0.108.4-SNAPSHOT com.google.api gax-httpjson - 0.108.3 + 0.108.4-SNAPSHOT test-jar testlib com.google.api gax-httpjson - 0.108.3 + 0.108.4-SNAPSHOT testlib diff --git a/gax-java/gax-grpc/pom.xml b/gax-java/gax-grpc/pom.xml index 241b9e451d..5a53f9e810 100644 --- a/gax-java/gax-grpc/pom.xml +++ b/gax-java/gax-grpc/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gax-grpc - 2.23.3 + 2.23.4-SNAPSHOT jar GAX (Google Api eXtensions) for Java (gRPC) Google Api eXtensions for Java (gRPC) @@ -11,7 +11,7 @@ com.google.api gax-parent - 2.23.3 + 2.23.4-SNAPSHOT diff --git a/gax-java/gax-httpjson/pom.xml b/gax-java/gax-httpjson/pom.xml index 91523f6c95..32a9a56b83 100644 --- a/gax-java/gax-httpjson/pom.xml +++ b/gax-java/gax-httpjson/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gax-httpjson - 0.108.3 + 0.108.4-SNAPSHOT jar GAX (Google Api eXtensions) for Java (HTTP JSON) Google Api eXtensions for Java (HTTP JSON) @@ -11,7 +11,7 @@ com.google.api gax-parent - 2.23.3 + 2.23.4-SNAPSHOT diff --git a/gax-java/gax/pom.xml b/gax-java/gax/pom.xml index 9ba39f1576..d3d2056fc1 100644 --- a/gax-java/gax/pom.xml +++ b/gax-java/gax/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gax - 2.23.3 + 2.23.4-SNAPSHOT jar GAX (Google Api eXtensions) for Java (Core) Google Api eXtensions for Java (Core) @@ -11,7 +11,7 @@ com.google.api gax-parent - 2.23.3 + 2.23.4-SNAPSHOT diff --git a/gax-java/pom.xml b/gax-java/pom.xml index 47f9d13b50..627865fb4c 100644 --- a/gax-java/pom.xml +++ b/gax-java/pom.xml @@ -4,14 +4,14 @@ com.google.api gax-parent pom - 2.23.3 + 2.23.4-SNAPSHOT GAX (Google Api eXtensions) for Java (Parent) Google Api eXtensions for Java (Parent) com.google.api gapic-generator-java-pom-parent - 2.15.3 + 2.15.4-SNAPSHOT ../gapic-generator-java-pom-parent @@ -51,7 +51,7 @@ com.google.api api-common - 2.6.3 + 2.6.4-SNAPSHOT com.google.auth @@ -109,24 +109,24 @@ com.google.api gax - 2.23.3 + 2.23.4-SNAPSHOT com.google.api gax - 2.23.3 + 2.23.4-SNAPSHOT test-jar testlib com.google.api.grpc proto-google-common-protos - 2.14.3 + 2.14.4-SNAPSHOT com.google.api.grpc grpc-google-common-protos - 2.14.3 + 2.14.4-SNAPSHOT io.grpc diff --git a/java-common-protos/grpc-google-common-protos/pom.xml b/java-common-protos/grpc-google-common-protos/pom.xml index 743abe3a14..ae53930119 100644 --- a/java-common-protos/grpc-google-common-protos/pom.xml +++ b/java-common-protos/grpc-google-common-protos/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-common-protos - 2.14.3 + 2.14.4-SNAPSHOT grpc-google-common-protos GRPC library for grpc-google-common-protos com.google.api.grpc google-common-protos-parent - 2.14.3 + 2.14.4-SNAPSHOT diff --git a/java-common-protos/pom.xml b/java-common-protos/pom.xml index de35e68794..4b4a8661db 100644 --- a/java-common-protos/pom.xml +++ b/java-common-protos/pom.xml @@ -4,7 +4,7 @@ com.google.api.grpc google-common-protos-parent pom - 2.14.3 + 2.14.4-SNAPSHOT Google Common Protos Parent Java idiomatic client for Google Cloud Platform services. @@ -13,7 +13,7 @@ com.google.api gapic-generator-java-pom-parent - 2.15.3 + 2.15.4-SNAPSHOT ../gapic-generator-java-pom-parent @@ -69,7 +69,7 @@ com.google.api.grpc grpc-google-common-protos - 2.14.3 + 2.14.4-SNAPSHOT io.grpc @@ -81,7 +81,7 @@ com.google.api.grpc proto-google-common-protos - 2.14.3 + 2.14.4-SNAPSHOT com.google.guava diff --git a/java-common-protos/proto-google-common-protos/pom.xml b/java-common-protos/proto-google-common-protos/pom.xml index bf09b12d27..7c2fe4eaa4 100644 --- a/java-common-protos/proto-google-common-protos/pom.xml +++ b/java-common-protos/proto-google-common-protos/pom.xml @@ -3,13 +3,13 @@ 4.0.0 com.google.api.grpc proto-google-common-protos - 2.14.3 + 2.14.4-SNAPSHOT proto-google-common-protos PROTO library for proto-google-common-protos com.google.api.grpc google-common-protos-parent - 2.14.3 + 2.14.4-SNAPSHOT diff --git a/java-iam/grpc-google-iam-v1/pom.xml b/java-iam/grpc-google-iam-v1/pom.xml index 42b4c6d227..8bdc09ef1d 100644 --- a/java-iam/grpc-google-iam-v1/pom.xml +++ b/java-iam/grpc-google-iam-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-iam-v1 - 1.9.3 + 1.9.4-SNAPSHOT grpc-google-iam-v1 GRPC library for grpc-google-iam-v1 com.google.cloud google-iam-parent - 1.9.3 + 1.9.4-SNAPSHOT diff --git a/java-iam/grpc-google-iam-v2/pom.xml b/java-iam/grpc-google-iam-v2/pom.xml index 088b184aa4..84d292d9da 100644 --- a/java-iam/grpc-google-iam-v2/pom.xml +++ b/java-iam/grpc-google-iam-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-iam-v2 - 1.9.3 + 1.9.4-SNAPSHOT grpc-google-iam-v2 GRPC library for proto-google-iam-v2 com.google.cloud google-iam-parent - 1.9.3 + 1.9.4-SNAPSHOT diff --git a/java-iam/grpc-google-iam-v2beta/pom.xml b/java-iam/grpc-google-iam-v2beta/pom.xml index b0d9d8dec0..2792bf9c0e 100644 --- a/java-iam/grpc-google-iam-v2beta/pom.xml +++ b/java-iam/grpc-google-iam-v2beta/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-iam-v2beta - 1.9.3 + 1.9.4-SNAPSHOT grpc-google-iam-v2beta GRPC library for proto-google-iam-v1 com.google.cloud google-iam-parent - 1.9.3 + 1.9.4-SNAPSHOT diff --git a/java-iam/pom.xml b/java-iam/pom.xml index 57a147d7eb..4d43b05cb9 100644 --- a/java-iam/pom.xml +++ b/java-iam/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-iam-parent pom - 1.9.3 + 1.9.4-SNAPSHOT Google IAM Parent Java idiomatic client for Google Cloud Platform services. @@ -13,7 +13,7 @@ com.google.api gapic-generator-java-pom-parent - 2.15.3 + 2.15.4-SNAPSHOT ../gapic-generator-java-pom-parent @@ -81,49 +81,49 @@ com.google.api gax-bom - 2.23.3 + 2.23.4-SNAPSHOT pom import com.google.api.grpc proto-google-iam-v2 - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc grpc-google-iam-v2 - 1.9.3 + 1.9.4-SNAPSHOT com.google.cloud google-iam-policy - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc proto-google-common-protos - 2.14.3 + 2.14.4-SNAPSHOT com.google.api.grpc proto-google-iam-v2beta - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc grpc-google-iam-v1 - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc grpc-google-iam-v2beta - 1.9.3 + 1.9.4-SNAPSHOT com.google.api.grpc proto-google-iam-v1 - 1.9.3 + 1.9.4-SNAPSHOT javax.annotation diff --git a/java-iam/proto-google-iam-v1/pom.xml b/java-iam/proto-google-iam-v1/pom.xml index f6d3bcef5c..5c590c2388 100644 --- a/java-iam/proto-google-iam-v1/pom.xml +++ b/java-iam/proto-google-iam-v1/pom.xml @@ -3,13 +3,13 @@ 4.0.0 com.google.api.grpc proto-google-iam-v1 - 1.9.3 + 1.9.4-SNAPSHOT proto-google-iam-v1 PROTO library for proto-google-iam-v1 com.google.cloud google-iam-parent - 1.9.3 + 1.9.4-SNAPSHOT diff --git a/java-iam/proto-google-iam-v2/pom.xml b/java-iam/proto-google-iam-v2/pom.xml index 5641d2d917..c041c60829 100644 --- a/java-iam/proto-google-iam-v2/pom.xml +++ b/java-iam/proto-google-iam-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-iam-v2 - 1.9.3 + 1.9.4-SNAPSHOT proto-google-iam-v2 Proto library for proto-google-iam-v1 com.google.cloud google-iam-parent - 1.9.3 + 1.9.4-SNAPSHOT diff --git a/java-iam/proto-google-iam-v2beta/pom.xml b/java-iam/proto-google-iam-v2beta/pom.xml index 254143173c..a885c86e34 100644 --- a/java-iam/proto-google-iam-v2beta/pom.xml +++ b/java-iam/proto-google-iam-v2beta/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-iam-v2beta - 1.9.3 + 1.9.4-SNAPSHOT proto-google-iam-v2beta Proto library for proto-google-iam-v1 com.google.cloud google-iam-parent - 1.9.3 + 1.9.4-SNAPSHOT diff --git a/showcase/pom.xml b/showcase/pom.xml index 9a4c96de7e..d36599a873 100644 --- a/showcase/pom.xml +++ b/showcase/pom.xml @@ -15,7 +15,7 @@ com.google.api gapic-generator-java-bom - 2.15.3 + 2.15.4-SNAPSHOT ../gapic-generator-java-bom diff --git a/versions.txt b/versions.txt index 86d3f9455e..4e0bf307c2 100644 --- a/versions.txt +++ b/versions.txt @@ -1,17 +1,17 @@ # Format: # module:released-version:current-version -gapic-generator-java:2.15.3:2.15.3 -api-common:2.6.3:2.6.3 -gax:2.23.3:2.23.3 -gax-grpc:2.23.3:2.23.3 -gax-httpjson:0.108.3:0.108.3 -proto-google-common-protos:2.14.3:2.14.3 -grpc-google-common-protos:2.14.3:2.14.3 -proto-google-iam-v1:1.9.3:1.9.3 -grpc-google-iam-v1:1.9.3:1.9.3 -proto-google-iam-v2beta:1.9.3:1.9.3 -grpc-google-iam-v2beta:1.9.3:1.9.3 -google-iam-policy:1.9.3:1.9.3 -proto-google-iam-v2:1.9.3:1.9.3 -grpc-google-iam-v2:1.9.3:1.9.3 +gapic-generator-java:2.15.3:2.15.4-SNAPSHOT +api-common:2.6.3:2.6.4-SNAPSHOT +gax:2.23.3:2.23.4-SNAPSHOT +gax-grpc:2.23.3:2.23.4-SNAPSHOT +gax-httpjson:0.108.3:0.108.4-SNAPSHOT +proto-google-common-protos:2.14.3:2.14.4-SNAPSHOT +grpc-google-common-protos:2.14.3:2.14.4-SNAPSHOT +proto-google-iam-v1:1.9.3:1.9.4-SNAPSHOT +grpc-google-iam-v1:1.9.3:1.9.4-SNAPSHOT +proto-google-iam-v2beta:1.9.3:1.9.4-SNAPSHOT +grpc-google-iam-v2beta:1.9.3:1.9.4-SNAPSHOT +google-iam-policy:1.9.3:1.9.4-SNAPSHOT +proto-google-iam-v2:1.9.3:1.9.4-SNAPSHOT +grpc-google-iam-v2:1.9.3:1.9.4-SNAPSHOT From 4b54422ac2b2f7c0acae15476c6701755c66ba10 Mon Sep 17 00:00:00 2001 From: Mridula <66699525+mpeddada1@users.noreply.github.com> Date: Thu, 16 Mar 2023 11:23:53 -0400 Subject: [PATCH 7/9] chore: add aggregate test coverage collection of gax within the showcase and gax modules (#1430) * chore: add aggregate test coverage collection for showcase and gax --- .github/workflows/ci-maven.yaml | 8 ++- coverage-report/README.md | 23 +++++++ coverage-report/pom.xml | 81 ++++++++++++++++++++++++ gapic-generator-java-pom-parent/pom.xml | 83 ++++++++++++++++++++++++- pom.xml | 13 ++++ showcase/gapic-showcase/pom.xml | 5 +- 6 files changed, 208 insertions(+), 5 deletions(-) create mode 100644 coverage-report/README.md create mode 100644 coverage-report/pom.xml diff --git a/.github/workflows/ci-maven.yaml b/.github/workflows/ci-maven.yaml index e614dea160..2540ce063b 100644 --- a/.github/workflows/ci-maven.yaml +++ b/.github/workflows/ci-maven.yaml @@ -22,9 +22,12 @@ jobs: - run: java -version - name: Unit Tests run: | - mvn install --batch-mode --no-transfer-progress -Dcheckstyle.skip \ - -Dfmt.skip + mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ + -Dfmt.skip -DenableTestCoverage - run: bazelisk version + - name: Install maven modules + run: | + mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip - name: Integration Tests run: | bazelisk --batch test //test/integration/... @@ -71,7 +74,6 @@ jobs: set -x export JAVA_HOME=$JAVA11_HOME export PATH=${JAVA_HOME}/bin:$PATH - # Why not compile? It's because the process needs to package jar so # that gapic-generator-java module can use testlib modules of gax. mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \ diff --git a/coverage-report/README.md b/coverage-report/README.md new file mode 100644 index 0000000000..9326c426a2 --- /dev/null +++ b/coverage-report/README.md @@ -0,0 +1,23 @@ +## Coverage Report + +This module gathers aggregated jacoco test coverage metrics across the `gax-java` and `showcase` modules. The purpose of +the metrics is to provide insights into how much of GAX code is being exercised by showcase and GAX tests and where +(unit tests versus integration tests). They will also provide information on any change in coverage observed +as showcase tests continue to be added to the repository. + +### Unit Test Coverage +In order to view aggregate unit test coverage of GAX in both `gax-java` and `showcase`: + +1. At the root of the repository, run `mvn clean test -DenableTestCoverage`. +2. The metrics can be found at `gapic-generator-java/coverage-report/target/site/jacoco-aggregate/index.html` + +![Screenshot 2023-03-03 at 6 32 50 PM](https://user-images.githubusercontent.com/66699525/222854612-787b4dde-f9a3-469a-8227-8f46dc0a4a20.png) + +### Integration Test Coverage + +In order to view aggregate integration test coverage of GAX in both `gax-java` and `showcase`: + +1. At the root of the repository, run `mvn clean verify -DskipUnitTests -DenableTestCoverage -Penable-integration-tests`. +2. The metrics can be found at `gapic-generator-java/coverage-report/target/site/jacoco-aggregate/index.html` + +![Screenshot 2023-03-03 at 6 36 26 PM](https://user-images.githubusercontent.com/66699525/222854973-f8a96f01-abc1-4e6b-9ab8-99b5e50dec6a.png) \ No newline at end of file diff --git a/coverage-report/pom.xml b/coverage-report/pom.xml new file mode 100644 index 0000000000..7851a2aa7f --- /dev/null +++ b/coverage-report/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + com.google.cloud + coverage-report + pom + 0.0.1-SNAPSHOT + Jacoco Aggregrate Test Coverage Report + + + UTF-8 + true + true + true + 8 + true + + ${project.basedir}/coverage-report/target/site/ + jacoco-aggregate/jacoco.xml + + + + + + com.google.cloud + gapic-showcase + 0.0.1-SNAPSHOT + test + + + com.google.api + gax + 2.23.3-SNAPSHOT + + + com.google.api + gax-grpc + 2.23.3-SNAPSHOT + + + com.google.api + gax-httpjson + 0.108.3-SNAPSHOT + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.8 + + + unit-tests-report-aggregate + + report-aggregate + + test + + + integration-tests-report-aggregate + + report-aggregate + + integration-test + + + + + com.coveo + fmt-maven-plugin + 2.9 + + + + + + diff --git a/gapic-generator-java-pom-parent/pom.xml b/gapic-generator-java-pom-parent/pom.xml index 91addcbc56..1c7a9ce31d 100644 --- a/gapic-generator-java-pom-parent/pom.xml +++ b/gapic-generator-java-pom-parent/pom.xml @@ -95,8 +95,89 @@ - + + test-coverage + + + enableTestCoverage + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M8 + + + + **/*SmokeTest.java + **/IT*.java + + sponge_log + ${surefire.jacoco.args} + ${skipUnitTests} + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.0.0-M8 + + + + integration-test + verify + + + + + 3600 + sponge_log + + **/IT*.java + **/*SmokeTest.java + + ${failsafe.jacoco.args} + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.8 + + + unit-test-execution + + prepare-agent + + + surefire.jacoco.args + + + + integration-test-execution + pre-integration-test + + prepare-agent + + + failsafe.jacoco.args + + + + + + + + + google-maven-central-copy diff --git a/pom.xml b/pom.xml index 300f0d658b..8cf21209d2 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,19 @@ + + + activate-test-coverage + + + enableTestCoverage + + + + showcase + coverage-report + + diff --git a/showcase/gapic-showcase/pom.xml b/showcase/gapic-showcase/pom.xml index 8c3de921fd..c9ced7d6b5 100644 --- a/showcase/gapic-showcase/pom.xml +++ b/showcase/gapic-showcase/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.google.cloud gapic-showcase - 0.0.1-SHAPSHOT + 0.0.1-SNAPSHOT jar GAPIC Showcase Client @@ -171,18 +171,21 @@ com.google.api gax + test-jar testlib test com.google.api gax-grpc + test-jar testlib test com.google.api gax-httpjson + test-jar testlib test From 8c68d350b5be3de8e02b946c6b1b5ee42e74b3f7 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 20 Mar 2023 16:25:25 +0000 Subject: [PATCH 8/9] deps: update netty dependencies to v4.1.90.final (#1490) --- gax-java/dependencies.properties | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/gax-java/dependencies.properties b/gax-java/dependencies.properties index 1b8608303a..c69108447e 100644 --- a/gax-java/dependencies.properties +++ b/gax-java/dependencies.properties @@ -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 From 2f9ce66c65a9e81ea37fdbbc33041572c3bf03a5 Mon Sep 17 00:00:00 2001 From: Joe Wang <106995533+JoeWang1127@users.noreply.github.com> Date: Mon, 20 Mar 2023 16:29:42 +0000 Subject: [PATCH 9/9] feat: install compatibility check (#1508) * feat: install clirr check * install an independent action * format changes * change name * change action name --- .github/workflows/ci-maven.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci-maven.yaml b/.github/workflows/ci-maven.yaml index 2540ce063b..7c0ed6333d 100644 --- a/.github/workflows/ci-maven.yaml +++ b/.github/workflows/ci-maven.yaml @@ -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: