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

4.x: Enable microprofile/tests/tck/tck-config/src/test/tck-suite.xml tests #8173

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jbescos
Copy link
Member

@jbescos jbescos commented Dec 20, 2023

#6105

Description

We were waiting for microprofile-config 3.1 to enable one test. This version made other issues that are fixed in this PR too.

There were 2 types of issues:

  1. In one case we were returning an empty optional of the ConfigValue. It needs to have some properties, like ordinal and name.
  2. We were iterating the sources for profile and then for non-profile. It has to be iterated in the way that each source is iterated with and without profile because of the ordinal value.

Documentation

N/A

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 20, 2023
@jbescos jbescos force-pushed the issue6105 branch 2 times, most recently from 146f4fb to 82c58c7 Compare December 20, 2023 13:40
…tests helidon-io#8173

Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
} catch (NoSuchElementException e) {
// Property expression does not resolve
return Optional.empty();
return Optional.of(new ConfigValueImpl(propName, null, rawValue, name, ordinal));
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the point 1 I was referring before.

@@ -313,35 +334,47 @@ private <T> T convert(String propertyName, Class<T> type, String value) {
}
}

private Optional<ConfigValue> findConfigValue(String propertyName) {
private Optional<ConfigValue> findConfigValue(String propertyName, Optional<String> profiledPropertyName) {
Copy link
Member

Choose a reason for hiding this comment

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

we do not use optional parameters. Also it does not make sense in this case, as you wrap it just to unwrap it later. Please use null here, as it is a private method (null is not allowed in public API only).

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

String rawValue = value;
String name = source.getName();
int ordinal = source.getOrdinal();
final String propName = selectedProperty;
Copy link
Member

Choose a reason for hiding this comment

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

This name is not descriptive. Use selectedPropertyFinal or something similar, with a comment "required final variable, as it is used in lambdas"

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -126,70 +129,88 @@ public <T> T getValue(String propertyName, Class<T> propertyType) {
@SuppressWarnings("unchecked")
@Override
public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType) {
String profiledPropertyName = null;
Copy link
Member

Choose a reason for hiding this comment

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

This statement does not make sense here - the next if is checking for profile being null. So just move the content of the if statement after the if checking if profile is null and remove the check.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

+ " in source " + source.getName()
+ " and it is empty (removed)");
}
return Optional.empty();
return Optional.of(new ConfigValueImpl(propName, null, rawValue, name, ordinal));
Copy link
Member

Choose a reason for hiding this comment

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

Why is this not returning an empty optional? I am missing an explanation of this change (and once more further down).

Copy link
Member Author

@jbescos jbescos Jan 19, 2024

Choose a reason for hiding this comment

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

In this particular case you are right, it can return empty Optional, so I have reverted it.

For the other case:

[ERROR] Failures: 
[ERROR]   CDIPropertyExpressionsTest>Arquillian.run:138->badExpansion:84 expected [test] but found [null]
[ERROR]   PropertyExpressionsTest>Arquillian.run:138->noExpressionButConfigValue:145 expected [test] but found [null]
[ERROR]   PropertyExpressionsTest>Arquillian.run:138->noExpressionComposedButConfigValue:171 expected [test] but found [null]

I am guided by the test results and then stepping back from there to see what is causing the failure. The tests do not give any explication, so I am afraid I cannot tell you why it has to behave in this way.

@jbescos jbescos force-pushed the issue6105 branch 2 times, most recently from 0ebf6f6 to e84e8cd Compare January 19, 2024 05:37
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
@jbescos jbescos force-pushed the issue6105 branch 2 times, most recently from 7a17219 to 6dc63dd Compare January 22, 2024 09:51
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
@jbescos
Copy link
Member Author

jbescos commented Feb 21, 2024

@tomas-langer kindly reminder to review this.

@jbescos jbescos self-assigned this May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants