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

FISH-1014 Variables (ENV=...) in @DatasourceDefinition not applied to 'className' #5095 #5142

Merged
merged 3 commits into from
Mar 11, 2021

Conversation

thehpi
Copy link

@thehpi thehpi commented Feb 26, 2021

Description

This is a simple fix in DataSourceDefinitionHandler where all String base properties from the DataSourceDefinition are expanded using the TranslatedConfigView.expandValue(value)

Testing

New tests

TranslatedConfigView.expandValue() is a static method so cannot be easily mocked.
So I created EnvironmentUtil which can set the current environment (not sure if this will cause problems)

I created DataSourceDefinitionExpansionTest.java which only tests expansion of environment variables.
This proves that TranslatedConfigView is called.

Testing Performed

I built payara and tested using payara-micro. My test project (see ticket) works fine now.

Testing Environment

I tested on Mac

java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: /usr/local/Cellar/maven/3.6.2/libexec
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre
Default locale: nl_NL, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"

Documentation

n/a

Notes for Reviewers

This is the first time I created a pull-request so I'd like to hear how to proceed.
Can I run tests locally (they currently fail in the master branch).
Or is there a way I can run the jenkins tests locally?

Copy link
Contributor

@lprimak lprimak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, just few minor changes

…est. Integrated into one test. Removed unnecessary files.
@@ -48,6 +48,7 @@
import org.glassfish.apf.AnnotationInfo;
import org.glassfish.apf.AnnotationProcessorException;
import org.glassfish.apf.HandlerProcessingResult;
import org.glassfish.config.support.TranslatedConfigView;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could import static TranslatedConfigView.expandValue so you only use expandValue() so it could be more concise :)

@lprimak lprimak requested review from Cousjava and AlanRoth March 8, 2021 21:33
@AlanRoth AlanRoth added PR: CLA CLA submitted on PR by the contributor Type: Community Contribution labels Mar 9, 2021
@AlanRoth AlanRoth self-assigned this Mar 9, 2021
@AlanRoth AlanRoth changed the title Issue 5095 FISH-1014 Variables (ENV=...) in @DatasourceDefinition not applied to 'className' #5095 Mar 9, 2021
@AlanRoth
Copy link

AlanRoth commented Mar 9, 2021

jenkins test please

@AlanRoth AlanRoth merged commit f294b61 into payara:master Mar 11, 2021
Pandrex247 pushed a commit to Pandrex247/Payara that referenced this pull request May 4, 2021
FISH-1014 Variables (ENV=...) in @DatasourceDefinition not applied to 'className' payara#5095
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: CLA CLA submitted on PR by the contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants