Skip to content

Commit 146f4fb

Browse files
committed
Enable microprofile/tests/tck/tck-config/src/test/tck-suite.xml tests #6105
Signed-off-by: Jorge Bescos Gascon <[email protected]>
1 parent 99ab65c commit 146f4fb

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

config/config-mp/src/main/java/io/helidon/config/mp/MpConfigImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,14 @@ private Optional<ConfigValue> findConfigValue(String propertyName) {
335335
LOGGER.log(Level.TRACE, "Found property " + propertyName + " in source " + source.getName());
336336
}
337337
String rawValue = value;
338+
String name = source.getName();
339+
int ordinal = source.getOrdinal();
338340
try {
339341
return applyFilters(propertyName, value)
340342
.map(it -> resolveReferences(propertyName, it))
341-
.map(it -> new ConfigValueImpl(propertyName, it, rawValue, source.getName(), source.getOrdinal()));
343+
.map(it -> new ConfigValueImpl(propertyName, it, rawValue, name, ordinal));
342344
} catch (NoSuchElementException e) {
343-
// Property expression does not resolve
344-
return Optional.empty();
345+
return Optional.of(new ConfigValueImpl(propertyName, null, rawValue, name, ordinal));
345346
}
346347
}
347348

config/config-mp/src/main/java/io/helidon/config/mp/MpSystemPropertiesSource.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
2+
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,7 +49,13 @@ public Map<String, String> getProperties() {
4949

5050
@Override
5151
public String getValue(String propertyName) {
52-
return props.getProperty(propertyName);
52+
String key = propertyName;
53+
if (propertyName.startsWith("%")) {
54+
// System properties do not have profiles
55+
int idx = propertyName.indexOf('.');
56+
key = key.substring(idx + 1);
57+
}
58+
return props.getProperty(key);
5359
}
5460

5561
@Override

dependencies/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@
103103
<version.lib.micronaut>3.8.7</version.lib.micronaut>
104104
<version.lib.micronaut.data>3.4.3</version.lib.micronaut.data>
105105
<version.lib.micronaut.sql>4.8.0</version.lib.micronaut.sql>
106-
<!-- FIXME upgrade to 3.1 when it is released in Maven -->
107-
<version.lib.microprofile-config>3.0.3</version.lib.microprofile-config>
106+
<version.lib.microprofile-config>3.1</version.lib.microprofile-config>
108107
<!-- FIXME upgrade to 4.1 when it is released in Maven -->
109108
<version.lib.microprofile-fault-tolerance-api>4.0.2</version.lib.microprofile-fault-tolerance-api>
110109
<version.lib.microprofile-graphql>2.0</version.lib.microprofile-graphql>

microprofile/tests/tck/tck-config/src/test/tck-suite.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@
2222
<test name="microprofile-config TCK">
2323
<packages>
2424
<package name="org.eclipse.microprofile.config.tck.*">
25-
<!--
26-
Currently failing because requires this PR:
27-
https://github.com/eclipse/microprofile-config/pull/743
28-
Ignoring meanwhile microprofile-config 3.1 is not released
29-
-->
30-
<exclude name="org.eclipse.microprofile.config.tck.broken"></exclude>
3125
</package>
3226
</packages>
3327
</test>

0 commit comments

Comments
 (0)