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

fix: Use UTF-8 as default charset for HttpJson requests #1477

Merged
merged 12 commits into from
Mar 20, 2023
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
23 changes: 20 additions & 3 deletions .github/workflows/ci-maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/...
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -149,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
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 2 additions & 2 deletions api-common-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
<packaging>jar</packaging>
<version>2.6.3</version><!-- {x-version-update:api-common:current} -->
<version>2.6.4-SNAPSHOT</version><!-- {x-version-update:api-common:current} -->
<name>API Common</name>
<description>Common utilities for Google APIs in Java</description>

<parent>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.15.3</version><!-- {x-version-update:gapic-generator-java:current} -->
<version>2.15.4-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<relativePath>../gapic-generator-java-pom-parent</relativePath>
</parent>

Expand Down
23 changes: 23 additions & 0 deletions coverage-report/README.md
Original file line number Diff line number Diff line change
@@ -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)
81 changes: 81 additions & 0 deletions coverage-report/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>coverage-report</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Jacoco Aggregrate Test Coverage Report</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<checkstyle.skip>true</checkstyle.skip>
<clirr.skip>true</clirr.skip>
<enforcer.skip>true</enforcer.skip>
<maven.compiler.release>8</maven.compiler.release>
<fmt.skip>true</fmt.skip>
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/coverage-report/target/site/
jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
</properties>

<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>gapic-showcase</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<version>2.23.3-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<version>2.23.3-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<version>0.108.3-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<id>unit-tests-report-aggregate</id>
<goals>
<goal>report-aggregate</goal>
</goals>
<phase>test</phase>
</execution>
<execution>
<id>integration-tests-report-aggregate</id>
<goals>
<goal>report-aggregate</goal>
</goals>
<phase>integration-test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.9</version>
</plugin>
</plugins>
</build>


</project>
24 changes: 12 additions & 12 deletions gapic-generator-java-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-bom</artifactId>
<packaging>pom</packaging>
<version>2.15.3</version><!-- {x-version-update:gapic-generator-java:current} -->
<version>2.15.4-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<name>GAPIC Generator Java BOM</name>
<description>
BOM for the libraries in gapic-generator-java repository. Users should not
Expand All @@ -15,7 +15,7 @@
<parent>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.15.3</version><!-- {x-version-update:gapic-generator-java:current} -->
<version>2.15.4-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<relativePath>../gapic-generator-java-pom-parent</relativePath>
</parent>

Expand Down Expand Up @@ -60,56 +60,56 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
<version>2.6.3</version><!-- {x-version-update:api-common:current} -->
<version>2.6.4-SNAPSHOT</version><!-- {x-version-update:api-common:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-bom</artifactId>
<version>2.23.3</version><!-- {x-version-update:gax:current} -->
<version>2.23.4-SNAPSHOT</version><!-- {x-version-update:gax:current} -->
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-common-protos</artifactId>
<version>2.14.3</version><!-- {x-version-update:proto-google-common-protos:current} -->
<version>2.14.4-SNAPSHOT</version><!-- {x-version-update:proto-google-common-protos:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
<version>2.14.3</version><!-- {x-version-update:proto-google-common-protos:current} -->
<version>2.14.4-SNAPSHOT</version><!-- {x-version-update:proto-google-common-protos:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-iam-v1</artifactId>
<version>1.9.3</version><!-- {x-version-update:proto-google-iam-v1:current} -->
<version>1.9.4-SNAPSHOT</version><!-- {x-version-update:proto-google-iam-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-iam-v2</artifactId>
<version>1.9.3</version><!-- {x-version-update:proto-google-iam-v2:current} -->
<version>1.9.4-SNAPSHOT</version><!-- {x-version-update:proto-google-iam-v2:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-iam-v2beta</artifactId>
<version>1.9.3</version><!-- {x-version-update:proto-google-iam-v2beta:current} -->
<version>1.9.4-SNAPSHOT</version><!-- {x-version-update:proto-google-iam-v2beta:current} -->
</dependency>

<!-- Following test deps are kept to keep them consistent with versions above -->
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-iam-v1</artifactId>
<version>1.9.3</version><!-- {x-version-update:grpc-google-iam-v1:current} -->
<version>1.9.4-SNAPSHOT</version><!-- {x-version-update:grpc-google-iam-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-iam-v2</artifactId>
<version>1.9.3</version><!-- {x-version-update:grpc-google-iam-v2:current} -->
<version>1.9.4-SNAPSHOT</version><!-- {x-version-update:grpc-google-iam-v2:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-iam-v2beta</artifactId>
<version>1.9.3</version><!-- {x-version-update:grpc-google-iam-v2beta:current} -->
<version>1.9.4-SNAPSHOT</version><!-- {x-version-update:grpc-google-iam-v2beta:current} -->
</dependency>
</dependencies>

Expand Down
85 changes: 83 additions & 2 deletions gapic-generator-java-pom-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.15.3</version><!-- {x-version-update:gapic-generator-java:current} -->
<version>2.15.4-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<packaging>pom</packaging>
<name>GAPIC Generator Java POM Parent</name>
<url>https://github.com/googleapis/gapic-generator-java</url>
Expand Down Expand Up @@ -95,8 +95,89 @@
</plugins>
</build>
</profile>
</profiles>

<profile>
<id>test-coverage</id>
<activation>
<property>
<name>enableTestCoverage</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M8</version>
<configuration>
<!-- Excludes integration tests and smoke tests when unit tests are run -->
<excludes>
<exclude>**/*SmokeTest.java</exclude>
<exclude>**/IT*.java</exclude>
</excludes>
<reportNameSuffix>sponge_log</reportNameSuffix>
<argLine>${surefire.jacoco.args}</argLine>
<skipTests>${skipUnitTests}</skipTests>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M8</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<forkedProcessTimeoutInSeconds>3600</forkedProcessTimeoutInSeconds>
<reportNameSuffix>sponge_log</reportNameSuffix>
<includes>
<include>**/IT*.java</include>
<include>**/*SmokeTest.java</include>
</includes>
<argLine>${failsafe.jacoco.args}</argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<id>unit-test-execution</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>surefire.jacoco.args</propertyName>
</configuration>
</execution>
<execution>
<id>integration-test-execution</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>failsafe.jacoco.args</propertyName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<repositories>
<repository>
<id>google-maven-central-copy</id>
Expand Down
6 changes: 3 additions & 3 deletions gapic-generator-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java</artifactId>
<version>2.15.3</version><!-- {x-version-update:gapic-generator-java:current} -->
<version>2.15.4-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<name>GAPIC Generator Java</name>
<description>GAPIC generator Java</description>

Expand All @@ -23,7 +23,7 @@
<parent>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.15.3</version><!-- {x-version-update:gapic-generator-java:current} -->
<version>2.15.4-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<relativePath>../gapic-generator-java-pom-parent</relativePath>
</parent>

Expand All @@ -32,7 +32,7 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-bom</artifactId>
<version>2.15.3</version><!-- {x-version-update:gapic-generator-java:current} -->
<version>2.15.4-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Loading