KEMBAR78
fix(java): add reflection configuration for native image tests by mpeddada1 · Pull Request #878 · googleapis/java-firestore · GitHub
Skip to content

Conversation

@mpeddada1
Copy link
Contributor

Currently running mvn test -Pnative is resulting in the following errors:

JUnit Vintage:ITSystemTest:setDocumentWithFloat
    MethodSource [className = 'com.google.cloud.firestore.it.ITSystemTest', methodName = 'setDocumentWithFloat', methodParameterTypes = '']
    => java.lang.RuntimeException: No properties to serialize found on class com.google.cloud.firestore.LocalFirestoreHelper$SingleField
       com.google.cloud.firestore.CustomClassMapper$BeanMapper.<init>(CustomClassMapper.java:765)
       com.google.cloud.firestore.CustomClassMapper.loadOrCreateBeanMapperForClass(CustomClassMapper.java:410)
       com.google.cloud.firestore.CustomClassMapper.convertBean(CustomClassMapper.java:591)
       com.google.cloud.firestore.CustomClassMapper.deserializeToClass(CustomClassMapper.java:256)
       com.google.cloud.firestore.CustomClassMapper.convertToCustomClass(CustomClassMapper.java:100)
       com.google.cloud.firestore.DocumentSnapshot.toObject(DocumentSnapshot.java:189)
       com.google.cloud.firestore.it.ITSystemTest.setDocumentWithFloat(ITSystemTest.java:258)
       java.lang.reflect.Method.invoke(Method.java:566)
       org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
       org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
       [...]
  JUnit Vintage:ITSystemTest:setDocumentWithValue
    MethodSource [className = 'com.google.cloud.firestore.it.ITSystemTest', methodName = 'setDocumentWithValue', methodParameterTypes = '']
    => java.lang.RuntimeException: No properties to serialize found on class com.google.cloud.firestore.LocalFirestoreHelper$SingleField
       com.google.cloud.firestore.CustomClassMapper$BeanMapper.<init>(CustomClassMapper.java:765)
       com.google.cloud.firestore.CustomClassMapper.loadOrCreateBeanMapperForClass(CustomClassMapper.java:410)
       com.google.cloud.firestore.CustomClassMapper.convertBean(CustomClassMapper.java:591)
       com.google.cloud.firestore.CustomClassMapper.deserializeToClass(CustomClassMapper.java:256)
       com.google.cloud.firestore.CustomClassMapper.convertToCustomClass(CustomClassMapper.java:100)
       com.google.cloud.firestore.DocumentSnapshot.toObject(DocumentSnapshot.java:189)
       com.google.cloud.firestore.it.ITSystemTest.setDocumentWithValue(ITSystemTest.java:250)
       java.lang.reflect.Method.invoke(Method.java:566)
       org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
       org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
       [...]
  JUnit Vintage:ITSystemTest:createDocument
    MethodSource [className = 'com.google.cloud.firestore.it.ITSystemTest', methodName = 'createDocument', methodParameterTypes = '']
    => java.lang.RuntimeException: No properties to serialize found on class com.google.cloud.firestore.LocalFirestoreHelper$SingleField
       com.google.cloud.firestore.CustomClassMapper$BeanMapper.<init>(CustomClassMapper.java:765)
       com.google.cloud.firestore.CustomClassMapper.loadOrCreateBeanMapperForClass(CustomClassMapper.java:410)
       com.google.cloud.firestore.CustomClassMapper.convertBean(CustomClassMapper.java:591)
       com.google.cloud.firestore.CustomClassMapper.deserializeToClass(CustomClassMapper.java:256)
       com.google.cloud.firestore.CustomClassMapper.convertToCustomClass(CustomClassMapper.java:100)
       com.google.cloud.firestore.DocumentSnapshot.toObject(DocumentSnapshot.java:189)
       com.google.cloud.firestore.it.ITSystemTest.createDocument(ITSystemTest.java:215)
       java.lang.reflect.Method.invoke(Method.java:566)
       org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
       org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
       [...]

This PR registers com.google.cloud.firestore.LocalFirestoreHelper and its inner classes for reflection through the use of a reflect-config.json file in order to address this issue.

@mpeddada1 mpeddada1 requested review from a team as code owners February 17, 2022 15:55
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/java-firestore API. label Feb 17, 2022
@mpeddada1
Copy link
Contributor Author

Thank you!

@mpeddada1 mpeddada1 merged commit 1938113 into main Feb 24, 2022
@mpeddada1 mpeddada1 deleted the fix-nativee-tests branch February 24, 2022 17:15
gcf-merge-on-green bot pushed a commit that referenced this pull request Mar 1, 2022
🤖 I have created a release *beep* *boop*
---


### [3.0.14](v3.0.13...v3.0.14) (2022-03-01)


### Bug Fixes

* fix groupID for artifacts ([#890](#890)) ([bb46bcb](bb46bcb))
* **java:** add reflection configuration for native image tests ([#878](#878)) ([1938113](1938113))


### Dependencies

* update actions/setup-java action to v3 ([#888](#888)) ([07130f9](07130f9))
* update dependency com.google.cloud:native-image-support to v0.12.5 ([#889](#889)) ([5f4ffcb](5f4ffcb))
* update dependency org.graalvm.buildtools:junit-platform-native to v0.9.10 ([#880](#880)) ([a3a9684](a3a9684))

---
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: firestore Issues related to the googleapis/java-firestore API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants