From 2a95fc3400a30af061c73a1cf43b870232afdb4e Mon Sep 17 00:00:00 2001 From: Roberto Cortez Date: Mon, 4 May 2020 17:00:47 +0100 Subject: [PATCH] Replaced Quarkus Config Profiles and Expansion with SmallRye Config interceptors. --- bom/runtime/pom.xml | 2 +- .../BuildTimeConfigurationReader.java | 30 ++--- .../runtime/configuration/ConfigExpander.java | 61 --------- .../runtime/configuration/ConfigUtils.java | 6 +- .../DeploymentProfileConfigSource.java | 92 -------------- .../configuration/ExpandingConfigSource.java | 120 ------------------ .../runtime/configuration/Substitutions.java | 53 +++----- .../configuration/ConfigExpanderTestCase.java | 3 +- .../configuration/ConfigProfileTestCase.java | 3 +- pom.xml | 2 +- tcks/microprofile-config/pom.xml | 10 +- .../tck/config/CustomConfigProviderTest.java | 67 ---------- .../tck/config/CustomObjectInputStream.java | 25 ---- .../src/test/resources/tck-suite.xml | 28 ++++ 14 files changed, 66 insertions(+), 436 deletions(-) delete mode 100644 core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigExpander.java delete mode 100644 core/runtime/src/main/java/io/quarkus/runtime/configuration/DeploymentProfileConfigSource.java delete mode 100644 core/runtime/src/main/java/io/quarkus/runtime/configuration/ExpandingConfigSource.java delete mode 100644 tcks/microprofile-config/src/test/java/io/quarkus/tck/config/CustomConfigProviderTest.java delete mode 100644 tcks/microprofile-config/src/test/java/io/quarkus/tck/config/CustomObjectInputStream.java create mode 100644 tcks/microprofile-config/src/test/resources/tck-suite.xml diff --git a/bom/runtime/pom.xml b/bom/runtime/pom.xml index df41d6eb5fd87..cc6bb049f4c35 100644 --- a/bom/runtime/pom.xml +++ b/bom/runtime/pom.xml @@ -32,7 +32,7 @@ 1.3.3 1.0.1 1.4.1 - 1.7.0 + 1.8.1 2.2.1 2.4.2 1.2.4 diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/BuildTimeConfigurationReader.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/BuildTimeConfigurationReader.java index f920ea63f3382..6f86ea9b02e55 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/BuildTimeConfigurationReader.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/BuildTimeConfigurationReader.java @@ -50,10 +50,10 @@ import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; import io.quarkus.runtime.configuration.ConfigUtils; -import io.quarkus.runtime.configuration.ExpandingConfigSource; import io.quarkus.runtime.configuration.HyphenateEnumConverter; import io.quarkus.runtime.configuration.NameIterator; import io.smallrye.config.Converters; +import io.smallrye.config.Expressions; import io.smallrye.config.SmallRyeConfig; /** @@ -354,13 +354,9 @@ ReadResult run() { matched = runTimePatternMap.match(ni); if (matched != null) { // it's a specified run-time default (record for later) - boolean old = ExpandingConfigSource.setExpanding(false); - try { - specifiedRunTimeDefaultValues.put(propertyName, - config.getOptionalValue(propertyName, String.class).orElse("")); - } finally { - ExpandingConfigSource.setExpanding(old); - } + specifiedRunTimeDefaultValues.put(propertyName, Expressions.withoutExpansion( + () -> config.getOptionalValue(propertyName, String.class).orElse(""))); + continue; } // also check for the bootstrap properties since those need to be added to specifiedRunTimeDefaultValues as well @@ -369,23 +365,13 @@ ReadResult run() { matched = bootstrapPatternMap.match(ni); if (matched != null) { // it's a specified run-time default (record for later) - boolean old = ExpandingConfigSource.setExpanding(false); - try { - specifiedRunTimeDefaultValues.put(propertyName, - config.getOptionalValue(propertyName, String.class).orElse("")); - } finally { - ExpandingConfigSource.setExpanding(old); - } + specifiedRunTimeDefaultValues.put(propertyName, Expressions.withoutExpansion( + () -> config.getOptionalValue(propertyName, String.class).orElse(""))); } } else { // it's not managed by us; record it - boolean old = ExpandingConfigSource.setExpanding(false); - try { - specifiedRunTimeDefaultValues.put(propertyName, - config.getOptionalValue(propertyName, String.class).orElse("")); - } finally { - ExpandingConfigSource.setExpanding(old); - } + specifiedRunTimeDefaultValues.put(propertyName, Expressions.withoutExpansion( + () -> config.getOptionalValue(propertyName, String.class).orElse(""))); } } return new ReadResult(objectsByRootClass, specifiedRunTimeDefaultValues, buildTimeRunTimeVisibleValues, diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigExpander.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigExpander.java deleted file mode 100644 index 0fda379900e02..0000000000000 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigExpander.java +++ /dev/null @@ -1,61 +0,0 @@ -package io.quarkus.runtime.configuration; - -import java.util.Optional; -import java.util.function.BiConsumer; - -import org.eclipse.microprofile.config.Config; -import org.eclipse.microprofile.config.ConfigProvider; -import org.wildfly.common.expression.Expression; -import org.wildfly.common.expression.ResolveContext; - -/** - * A property value expander that works with {@link Config}. This can be passed in as an expander - * to {@link Expression#evaluate(BiConsumer)}. - */ -public final class ConfigExpander implements BiConsumer, StringBuilder> { - - public static final ConfigExpander INSTANCE = new ConfigExpander(); - - static final int MAX_DEPTH = 32; - // substitute - private static final ThreadLocal depth = ThreadLocal.withInitial(() -> new int[1]); - - private ConfigExpander() { - } - - // substitute - private static boolean enter() { - final int[] depthArray = depth.get(); - if (depthArray[0] == MAX_DEPTH) { - return false; - } - depthArray[0]++; - return true; - } - - // substitute - private static void exit() { - depth.get()[0]--; - } - - public void accept(final ResolveContext context, final StringBuilder stringBuilder) { - if (!enter()) { - throw new IllegalArgumentException("Nested recursive expansion is too deep"); - } - try { - final String key = context.getKey(); - if (context.hasDefault()) { - final Optional expanded = ConfigProvider.getConfig().getOptionalValue(key, String.class); - if (expanded.isPresent()) { - stringBuilder.append(expanded.get()); - } else { - context.expandDefault(); - } - } else { - stringBuilder.append(ConfigProvider.getConfig().getValue(key, String.class)); - } - } finally { - exit(); - } - } -} diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java index b3f1808855473..273525ababad2 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java @@ -71,9 +71,8 @@ public static SmallRyeConfigBuilder configBuilder(final boolean runTime, final b final ApplicationPropertiesConfigSource.InJar inJar = new ApplicationPropertiesConfigSource.InJar(); final ApplicationPropertiesConfigSource.MpConfigInJar mpConfig = new ApplicationPropertiesConfigSource.MpConfigInJar(); builder.withSources(inFileSystem, inJar, mpConfig, new DotEnvConfigSource()); - final ExpandingConfigSource.Cache cache = new ExpandingConfigSource.Cache(); - builder.withWrapper(ExpandingConfigSource.wrapper(cache)); - builder.withWrapper(DeploymentProfileConfigSource.wrapper()); + builder.withProfile(ProfileManager.getActiveProfile()); + builder.addDefaultInterceptors(); final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (runTime) { builder.addDefaultSources(); @@ -92,6 +91,7 @@ public static SmallRyeConfigBuilder configBuilder(final boolean runTime, final b } if (addDiscovered) { builder.addDiscoveredSources(); + builder.addDiscoveredInterceptors(); builder.addDiscoveredConverters(); } return builder; diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/DeploymentProfileConfigSource.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/DeploymentProfileConfigSource.java deleted file mode 100644 index c7da037b9d170..0000000000000 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/DeploymentProfileConfigSource.java +++ /dev/null @@ -1,92 +0,0 @@ -package io.quarkus.runtime.configuration; - -import java.io.ObjectStreamException; -import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; -import java.util.function.UnaryOperator; - -import org.eclipse.microprofile.config.spi.ConfigSource; -import org.wildfly.common.Assert; - -/** - * A configuration source which supports deployment profiles. - */ -public class DeploymentProfileConfigSource extends AbstractDelegatingConfigSource { - private static final long serialVersionUID = -8001338475089294128L; - - private final String profilePrefix; - - public static UnaryOperator wrapper() { - return new UnaryOperator() { - @Override - public ConfigSource apply(ConfigSource configSource) { - return new DeploymentProfileConfigSource(configSource, ProfileManager.getActiveProfile()); - } - }; - } - - /** - * Construct a new instance. - * - * @param delegate the delegate configuration source (must not be {@code null}) - * @param profileName the profile name (must not be {@code null}) - */ - public DeploymentProfileConfigSource(final ConfigSource delegate, final String profileName) { - super(delegate); - Assert.checkNotNullParam("profileName", profileName); - profilePrefix = "%" + profileName + "."; - } - - Object writeReplace() throws ObjectStreamException { - return new Ser(delegate, profilePrefix); - } - - static final class Ser implements Serializable { - private static final long serialVersionUID = -4618790131794331510L; - - final ConfigSource d; - final String p; - - Ser(final ConfigSource d, String p) { - this.d = d; - this.p = p; - } - - Object readResolve() { - return new DeploymentProfileConfigSource(d, p); - } - } - - public Set getPropertyNames() { - Set propertyNames = delegate.getPropertyNames(); - //if a key is only present in a profile we still want the unprofiled key name to show up - Set ret = new HashSet<>(propertyNames); - for (String i : propertyNames) { - if (i.startsWith(profilePrefix)) { - ret.add(i.substring(profilePrefix.length())); - } - } - return ret; - } - - public String getValue(final String name) { - final ConfigSource delegate = getDelegate(); - final String nameWithProfile = profilePrefix + name; - String result = delegate.getValue(nameWithProfile); - if (result != null) { - return result; - } else { - return delegate.getValue(name); - } - } - - public String getName() { - return delegate.getName(); - } - - public String toString() { - return "DeploymentProfileConfigSource[profile=" + profilePrefix + ",delegate=" + getDelegate() + ",ord=" + getOrdinal() - + "]"; - } -} diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ExpandingConfigSource.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ExpandingConfigSource.java deleted file mode 100644 index b5aeb7e9c8460..0000000000000 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ExpandingConfigSource.java +++ /dev/null @@ -1,120 +0,0 @@ -package io.quarkus.runtime.configuration; - -import java.io.ObjectStreamException; -import java.io.Serializable; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.UnaryOperator; - -import org.eclipse.microprofile.config.spi.ConfigSource; -import org.wildfly.common.Assert; -import org.wildfly.common.expression.Expression; - -/** - * A value-expanding configuration source, which allows (limited) recursive expansion. - */ -public class ExpandingConfigSource extends AbstractDelegatingConfigSource { - - private static final long serialVersionUID = 1075000015425893741L; - private static final ThreadLocal NO_EXPAND = new ThreadLocal<>(); - - public static UnaryOperator wrapper(Cache cache) { - return configSource -> new ExpandingConfigSource(configSource, cache); - } - - private final Cache cache; - - /** - * Construct a new instance. - * - * @param delegate the delegate config source (must not be {@code null}) - * @param cache the cache instance to use (must not be {@code null}) - */ - public ExpandingConfigSource(final ConfigSource delegate, final Cache cache) { - super(delegate); - Assert.checkNotNullParam("cache", cache); - this.cache = cache; - } - - @Override - public Set getPropertyNames() { - return delegate.getPropertyNames(); - } - - @Override - public String getValue(final String propertyName) { - final String delegateValue = delegate.getValue(propertyName); - return isExpanding() ? expand(delegateValue) : delegateValue; - } - - Object writeReplace() throws ObjectStreamException { - return new Ser(delegate); - } - - static final class Ser implements Serializable { - private static final long serialVersionUID = 3633535720479375279L; - - final ConfigSource d; - - Ser(final ConfigSource d) { - this.d = d; - } - - Object readResolve() { - return new ExpandingConfigSource(d, new Cache()); - } - } - - String expand(final String value) { - return expandValue(value, cache); - } - - public void flush() { - cache.flush(); - } - - public String toString() { - return "ExpandingConfigSource[delegate=" + getDelegate() + ",ord=" + getOrdinal() + "]"; - } - - private static boolean isExpanding() { - return NO_EXPAND.get() != Boolean.TRUE; - } - - public static boolean setExpanding(boolean newValue) { - try { - return NO_EXPAND.get() != Boolean.TRUE; - } finally { - if (newValue) { - NO_EXPAND.remove(); - } else { - NO_EXPAND.set(Boolean.TRUE); - } - } - } - - public static String expandValue(String value, Cache cache) { - if (value == null) - return null; - final Expression compiled = cache.exprCache.computeIfAbsent(value, - str -> Expression.compile(str, Expression.Flag.LENIENT_SYNTAX, Expression.Flag.NO_TRIM)); - return compiled.evaluate(ConfigExpander.INSTANCE); - } - - /** - * An expression cache to use with {@link ExpandingConfigSource}. - */ - public static final class Cache implements Serializable { - private static final long serialVersionUID = 6111143168103886992L; - - // this is a cache of compiled expressions, NOT a cache of expanded values - final ConcurrentHashMap exprCache = new ConcurrentHashMap<>(); - - public Cache() { - } - - public void flush() { - exprCache.clear(); - } - } -} diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/Substitutions.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/Substitutions.java index 297734c44f2a8..8754453787476 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/Substitutions.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/Substitutions.java @@ -1,5 +1,7 @@ package io.quarkus.runtime.configuration; +import java.util.function.Supplier; + import org.eclipse.microprofile.config.spi.ConfigProviderResolver; import com.oracle.svm.core.annotate.Alias; @@ -7,41 +9,17 @@ import com.oracle.svm.core.annotate.RecomputeFieldValue; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; -import com.oracle.svm.core.annotate.TargetElement; import com.oracle.svm.core.threadlocal.FastThreadLocalFactory; import com.oracle.svm.core.threadlocal.FastThreadLocalInt; +import io.smallrye.config.Expressions; + /** */ final class Substitutions { - - static final FastThreadLocalInt depth = FastThreadLocalFactory.createInt(); // 0 = expand so that the default value is to expand static final FastThreadLocalInt notExpanding = FastThreadLocalFactory.createInt(); - @TargetClass(ConfigExpander.class) - static final class Target_ConfigExpander { - @Delete - @TargetElement(name = "depth") - static ThreadLocal origDepth = null; - - @Substitute - private static boolean enter() { - final int val = depth.get(); - if (val == ConfigExpander.MAX_DEPTH) { - return false; - } else { - depth.set(val + 1); - return true; - } - } - - @Substitute - private static void exit() { - depth.set(depth.get() - 1); - } - } - @TargetClass(ConfigProviderResolver.class) static final class Target_ConfigurationProviderResolver { @@ -50,22 +28,27 @@ static final class Target_ConfigurationProviderResolver { private static volatile ConfigProviderResolver instance; } - @TargetClass(ExpandingConfigSource.class) - static final class Target_ExpandingConfigSource { + @TargetClass(Expressions.class) + static final class Target_Expressions { @Delete - private static ThreadLocal NO_EXPAND; + private static ThreadLocal ENABLE; @Substitute - private static boolean isExpanding() { + private static boolean isEnabled() { return notExpanding.get() == 0; } @Substitute - public static boolean setExpanding(boolean newValue) { - try { - return notExpanding.get() == 0; - } finally { - notExpanding.set(newValue ? 0 : 1); + public static T withoutExpansion(Supplier supplier) { + if (isEnabled()) { + notExpanding.set(1); + try { + return supplier.get(); + } finally { + notExpanding.set(0); + } + } else { + return supplier.get(); } } } diff --git a/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigExpanderTestCase.java b/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigExpanderTestCase.java index 4c404b30c50f6..464c1a05cc1e7 100644 --- a/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigExpanderTestCase.java +++ b/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigExpanderTestCase.java @@ -14,6 +14,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import io.smallrye.config.ExpressionConfigSourceInterceptor; import io.smallrye.config.PropertiesConfigSource; import io.smallrye.config.SmallRyeConfig; import io.smallrye.config.SmallRyeConfigBuilder; @@ -43,7 +44,7 @@ public void doAfter() { private SmallRyeConfig buildConfig(Map configMap) { final SmallRyeConfigBuilder builder = new SmallRyeConfigBuilder(); - builder.withWrapper(ExpandingConfigSource.wrapper(new ExpandingConfigSource.Cache())); + builder.withInterceptors(new ExpressionConfigSourceInterceptor()); builder.withSources(new PropertiesConfigSource(configMap, "test input", 500)); final SmallRyeConfig config = (SmallRyeConfig) builder.build(); cpr.registerConfig(config, classLoader); diff --git a/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigProfileTestCase.java b/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigProfileTestCase.java index 48b668ef8c06a..e55ceda19414d 100644 --- a/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigProfileTestCase.java +++ b/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigProfileTestCase.java @@ -13,6 +13,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import io.smallrye.config.ProfileConfigSourceInterceptor; import io.smallrye.config.PropertiesConfigSource; import io.smallrye.config.SmallRyeConfig; import io.smallrye.config.SmallRyeConfigBuilder; @@ -40,7 +41,7 @@ public void doAfter() { private SmallRyeConfig buildConfig(Map configMap) { final SmallRyeConfigBuilder builder = new SmallRyeConfigBuilder(); - builder.withWrapper(DeploymentProfileConfigSource.wrapper()); + builder.withInterceptors(new ProfileConfigSourceInterceptor(ProfileManager.getActiveProfile())); builder.withSources(new PropertiesConfigSource(configMap, "test input", 500)); final SmallRyeConfig config = (SmallRyeConfig) builder.build(); cpr.registerConfig(config, classLoader); diff --git a/pom.xml b/pom.xml index 004690b00cdc4..8b03ce1d40036 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ Maven Repository Switchboard https://repo.maven.apache.org/maven2 - + diff --git a/tcks/microprofile-config/pom.xml b/tcks/microprofile-config/pom.xml index d29fc32cbb44a..e976efccff1a6 100644 --- a/tcks/microprofile-config/pom.xml +++ b/tcks/microprofile-config/pom.xml @@ -18,6 +18,9 @@ org.apache.maven.plugins maven-surefire-plugin + + src/test/resources/tck-suite.xml + 45 @@ -40,13 +43,6 @@ org.eclipse.microprofile.config:microprofile-config-tck false - - - org.eclipse.microprofile.config.tck.EmptyValuesTest - - - org.eclipse.microprofile.config.tck.ConfigProviderTest - diff --git a/tcks/microprofile-config/src/test/java/io/quarkus/tck/config/CustomConfigProviderTest.java b/tcks/microprofile-config/src/test/java/io/quarkus/tck/config/CustomConfigProviderTest.java deleted file mode 100644 index d5f07b821e05d..0000000000000 --- a/tcks/microprofile-config/src/test/java/io/quarkus/tck/config/CustomConfigProviderTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package io.quarkus.tck.config; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import javax.inject.Inject; - -import org.eclipse.microprofile.config.Config; -import org.eclipse.microprofile.config.tck.ConfigProviderTest; -import org.hamcrest.CoreMatchers; -import org.hamcrest.MatcherAssert; -import org.testng.Assert; -import org.testng.annotations.Test; - -import io.quarkus.runtime.configuration.ExpandingConfigSource; - -public class CustomConfigProviderTest extends ConfigProviderTest { - - @Inject - private Config config; - - @Test - public void testEnvironmentConfigSource() { - // this test fails when there is a expression-like thing in an env prop - boolean old = ExpandingConfigSource.setExpanding(false); - try { - super.testPropertyConfigSource(); - } finally { - ExpandingConfigSource.setExpanding(old); - } - } - - @Test - public void testInjectedConfigSerializable() { - // Needed a custom ObjectInputStream.resolveClass() to use a ClassLoader with Quarkus generated classes in it - // Everything else is identical to the test class it overwrites - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - try (ObjectOutputStream out = new ObjectOutputStream(byteArrayOutputStream)) { - out.writeObject(config); - } catch (IOException ex) { - Assert.fail("Injected config should be serializable, but could not serialize it", ex); - } - Object readObject = null; - try (ObjectInputStream in = new CustomObjectInputStream( - new ByteArrayInputStream(byteArrayOutputStream.toByteArray()))) { - readObject = in.readObject(); - } catch (IOException | ClassNotFoundException ex) { - Assert.fail("Injected config should be serializable, but could not deserialize a previously serialized instance", - ex); - } - MatcherAssert.assertThat("Deserialized object", readObject, CoreMatchers.instanceOf(Config.class)); - } - - @Test - public void testPropertyConfigSource() { - // this test fails when there is a expression-like thing in a sys prop - boolean old = ExpandingConfigSource.setExpanding(false); - try { - super.testPropertyConfigSource(); - } finally { - ExpandingConfigSource.setExpanding(old); - } - } -} diff --git a/tcks/microprofile-config/src/test/java/io/quarkus/tck/config/CustomObjectInputStream.java b/tcks/microprofile-config/src/test/java/io/quarkus/tck/config/CustomObjectInputStream.java deleted file mode 100644 index 090dc586661af..0000000000000 --- a/tcks/microprofile-config/src/test/java/io/quarkus/tck/config/CustomObjectInputStream.java +++ /dev/null @@ -1,25 +0,0 @@ -package io.quarkus.tck.config; - -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectStreamClass; - -public class CustomObjectInputStream extends ObjectInputStream { - - public CustomObjectInputStream(InputStream in) throws IOException { - super(in); - } - - @Override - protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { - String name = desc.getName(); - try { - return Class.forName(name, false, Thread.currentThread().getContextClassLoader()); - } catch (ClassNotFoundException ex) { - // Do nothing - } - // Fallback to parent implementation if we can't find the class - return super.resolveClass(desc); - } -} diff --git a/tcks/microprofile-config/src/test/resources/tck-suite.xml b/tcks/microprofile-config/src/test/resources/tck-suite.xml new file mode 100644 index 0000000000000..72577f8b91eda --- /dev/null +++ b/tcks/microprofile-config/src/test/resources/tck-suite.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +