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(java): add additional configurations to fix native image tests #1859

Merged
merged 2 commits into from
Feb 14, 2022

Conversation

mpeddada1
Copy link
Contributor

@mpeddada1 mpeddada1 commented Feb 14, 2022

This PR explicitly specifies the resource (in this case, QueryTestData.csv) that needs to be accessible at run-time through the use of the resource-config.json file. Using this json config file allows the resource to be accessible when methods such as Class.getResource() and Class.getResourceAsStream() are used. However, referencing a resource using the full path still results in the NoSuchFileException.

This PR also adds some additional reflection configuration to resolve the following issues:

 Caused by: java.lang.IllegalArgumentException: field private java.util.List com.google.api.client.googleapis.json.GoogleJsonError.details
       com.google.api.client.json.JsonParser.parseValue(JsonParser.java:900)
       com.google.api.client.json.JsonParser.parse(JsonParser.java:451)
       com.google.api.client.json.JsonParser.parseValue(JsonParser.java:787)
       [...]
Caused by: java.lang.IllegalArgumentException: field private java.util.List com.google.api.client.googleapis.json.GoogleJsonError.details
       com.google.api.client.json.JsonParser.parseValue(JsonParser.java:900)
       com.google.api.client.json.JsonParser.parseArray(JsonParser.java:641)
       com.google.api.client.json.JsonParser.parseValue(JsonParser.java:744)
       [...]
...
MethodSource [className = 'com.google.cloud.bigquery.it.ITBigQueryTest', methodName = 'testUpdateDataset', methodParameterTypes = '']
    => java.lang.IllegalArgumentException: unable to create new instance of class java.util.HashMap because it has no accessible default constructor
       com.google.api.client.util.Types.handleExceptionForNewInstance(Types.java:162)
       com.google.api.client.util.Types.newInstance(Types.java:117)
       com.google.api.client.util.Data.createNullInstance(Data.java:166)
       com.google.api.client.util.Data.nullOf(Data.java:134)
       com.google.cloud.bigquery.Labels.toPb(Labels.java:44)

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1848 ☕️

@mpeddada1 mpeddada1 requested a review from a team February 14, 2022 14:31
@mpeddada1 mpeddada1 requested a review from a team as a code owner February 14, 2022 14:31
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/java-bigquery API. label Feb 14, 2022
@stephaniewang526 stephaniewang526 merged commit 3e82960 into main Feb 14, 2022
@stephaniewang526 stephaniewang526 deleted the fix-native-tests branch February 14, 2022 16:00
gcf-merge-on-green bot pushed a commit that referenced this pull request Mar 3, 2022
🤖 I have created a release *beep* *boop*
---


### [2.9.1](v2.9.0...v2.9.1) (2022-03-03)


### Bug Fixes

* adjusting retry logic to avoid retrying successful job creation ([#1879](#1879)) ([fd07533](fd07533))
* **java:** add additional configurations to fix native image tests ([#1859](#1859)) ([3e82960](3e82960))


### Documentation

* **sample:** Table exists sample fix ([#1868](#1868)) ([698306e](698306e))


### Dependencies

* update dependency com.google.apis:google-api-services-bigquery to v2-rev20220220-1.32.1 ([#1872](#1872)) ([e67cf65](e67cf65))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.8.0 ([#1876](#1876)) ([a16985f](a16985f))
* update dependency com.google.cloud:google-cloud-storage to v2.4.2 ([#1853](#1853)) ([ef91109](ef91109))
* update dependency com.google.cloud:google-cloud-storage to v2.4.4 ([#1873](#1873)) ([a4deb16](a4deb16))
* update dependency com.google.cloud:native-image-support to v0.12.4 ([#1855](#1855)) ([376738d](376738d))
* update dependency com.google.cloud:native-image-support to v0.12.5 ([#1874](#1874)) ([c68c49a](c68c49a))
* update dependency com.google.cloud:native-image-support to v0.12.6 ([#1878](#1878)) ([3749921](3749921))
* update dependency com.google.code.gson:gson to v2.9.0 ([#1850](#1850)) ([627da62](627da62))
* update dependency org.graalvm.buildtools:junit-platform-native to v0.9.10 ([#1860](#1860)) ([b31b44c](b31b44c))
* update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.10 ([#1861](#1861)) ([ae05dfe](ae05dfe))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/java-bigquery API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GraalVM IT failure
2 participants