forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register a config for tests in the Quarkus Classloader
- Loading branch information
Showing
4 changed files
with
35 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...t/src/main/java/io/quarkus/test/junit/classloading/QuarkusTestConfigProviderResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.quarkus.test.junit.classloading; | ||
|
||
import io.quarkus.deployment.dev.testing.TestConfig; | ||
import io.quarkus.runtime.LaunchMode; | ||
import io.quarkus.runtime.configuration.ConfigUtils; | ||
import io.smallrye.config.SmallRyeConfig; | ||
import io.smallrye.config.SmallRyeConfigProviderResolver; | ||
|
||
public class QuarkusTestConfigProviderResolver extends SmallRyeConfigProviderResolver { | ||
private final SmallRyeConfigProviderResolver resolver; | ||
|
||
public QuarkusTestConfigProviderResolver(final ClassLoader classLoader) { | ||
this.resolver = (SmallRyeConfigProviderResolver) SmallRyeConfigProviderResolver.instance(); | ||
|
||
SmallRyeConfig config = ConfigUtils.configBuilder(false, true, LaunchMode.TEST) | ||
.withProfile(LaunchMode.TEST.getDefaultProfile()) | ||
.withMapping(TestConfig.class, "quarkus.test") | ||
.forClassLoader(classLoader) | ||
.build(); | ||
|
||
this.registerConfig(config, Thread.currentThread().getContextClassLoader()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters