-
Notifications
You must be signed in to change notification settings - Fork 576
4.x: JPA testing-related improvements #9131
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
Conversation
… locate persistence.xml resources Signed-off-by: Laird Nelson <[email protected]>
Signed-off-by: Laird Nelson <[email protected]>
…ig properties into the persistence unit properties Signed-off-by: Laird Nelson <[email protected]>
9bc2cab
to
4d28f7f
Compare
…location works Signed-off-by: Laird Nelson <[email protected]>
Still needs documentation updates but before I document it I'll see what people have to say. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small changes (no functional difference) and a question about Config#getPropertyNames
.
this.enabled = | ||
Boolean.parseBoolean(ConfigProvider.getConfig() | ||
.getOptionalValue(this.getClass().getName() + ".enabled", String.class) | ||
.orElse("false")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.enabled = | |
Boolean.parseBoolean(ConfigProvider.getConfig() | |
.getOptionalValue(this.getClass().getName() + ".enabled", String.class) | |
.orElse("false")); | |
this.enabled = | |
ConfigProvider.getConfig() | |
.getOptionalValue(this.getClass().getName() + ".enabled", Boolean.class) | |
.orElse("false"); |
Perhaps slightly clearer/less wordy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly the contract of a MicroProfile Converter
is all but undefined, so it's not guaranteed what will happen in the presence of null
or empty String
values. The contract of Boolean#parseBoolean(boolean)
, on the other hand, is rigorous.
this.enabled = | ||
Boolean.parseBoolean(getConfig() | ||
.getOptionalValue(this.getClass().getName() + ".enabled", String.class) | ||
.orElse("true")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.enabled = | |
Boolean.parseBoolean(getConfig() | |
.getOptionalValue(this.getClass().getName() + ".enabled", String.class) | |
.orElse("true")); | |
this.enabled = | |
getConfig().getOptionalValue(this.getClass().getName() + ".enabled", Boolean.class) | |
.orElse("true"); |
Similar comment as earlier.
...grations/cdi/jpa-cdi/src/main/java/io/helidon/integrations/cdi/jpa/PersistenceExtension.java
Show resolved
Hide resolved
Config config = getOrDefault(instance.select(Config.class), namedSelectionQualifiers); | ||
properties = | ||
new StackedMap<>(List.of(properties.keySet()::stream, | ||
() -> stream(config.getPropertyNames()::spliterator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar thoughts about getPropertyNames
as above.
...grations/cdi/jpa-cdi/src/main/java/io/helidon/integrations/cdi/jpa/PersistenceExtension.java
Show resolved
Hide resolved
I'll follow this up with additional PRs around documentation and testing; thanks for the approval. |
This PR introduces MicroProfile Config as a dependency of the JPA CDI integration and uses it to blend MicroProfile Config properties with persistence unit properties. It also allows a user to specify an alternate location for a JPA descriptor, which can be useful in unit testing scenarios.
May close and/or address #7552.