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

Fixed interfering tests in MP config. #2714

Merged
merged 2 commits into from
Feb 11, 2021

Conversation

tomas-langer
Copy link
Member

Resolves #2647

  • The method releaseConfig did not correctly take into account usage of ConfigDelegate.
  • reset the reuseForks back to default
  • META-INF/services for YAML config source is not needed, it is part of the library
  • The ObjectMappingTest did not correctly handle release of configuration.
  • Removed extensive final declarations in test

Signed-off-by: Tomas Langer tomas.langer@oracle.com

Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
@tomas-langer tomas-langer added MP config 2.x Issues for 2.x version branch labels Feb 1, 2021
@tomas-langer tomas-langer requested a review from ljnelson February 1, 2021 16:22
@tomas-langer tomas-langer self-assigned this Feb 1, 2021
ljnelson
ljnelson previously approved these changes Feb 1, 2021
Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
Comment on lines +179 to +192
if (config instanceof ConfigDelegate) {
for (Map.Entry<ClassLoader, ConfigDelegate> entry : CONFIGS.entrySet()) {
if (config == entry.getValue()) {
cl.set(entry.getKey());
break;
}
}
} else {
for (Map.Entry<ClassLoader, ConfigDelegate> entry : CONFIGS.entrySet()) {
Config configFromRef = entry.getValue().delegate();
if (config == configFromRef) {
cl.set(entry.getKey());
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe something like this could avoid code duplication

Predicate<Map.Entry<ClassLoader, ConfigDelegate>> entryPredicate;

if(config instanceof ConfigDelegate){
    entryPredicate = entry -> config == entry.getValue();
}else {
    entryPredicate = entry -> config == entry.getValue().delegate();
}

CONFIGS.entrySet()
        .stream()
        .filter(entryPredicate)
        .findFirst()
        .map(Map.Entry::getKey)
        .ifPresent(cl::set);

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand it's not shorter nor more readable and definitely not faster

@tomas-langer tomas-langer merged commit 88f9651 into helidon-io:master Feb 11, 2021
@tomas-langer tomas-langer deleted the 2647-config-fix-test branch February 11, 2021 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issues for 2.x version branch config MP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ObjectMappingTest in microprofile/config can affect other unit tests' data
3 participants