-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 instance to bootstrap tests
- Loading branch information
Showing
9 changed files
with
57 additions
and
48 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
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
24 changes: 24 additions & 0 deletions
24
test-framework/junit5/src/main/java/io/quarkus/test/junit/ConfigExtension.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,24 @@ | ||
package io.quarkus.test.junit; | ||
|
||
import org.junit.jupiter.api.extension.BeforeAllCallback; | ||
import org.junit.jupiter.api.extension.Extension; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
|
||
import io.quarkus.runtime.configuration.ConfigUtils; | ||
import io.smallrye.config.SmallRyeConfig; | ||
import io.smallrye.config.SmallRyeConfigProviderResolver; | ||
|
||
public class ConfigExtension implements Extension, BeforeAllCallback { | ||
static { | ||
SmallRyeConfig config = ConfigUtils.emptyConfigBuilder() | ||
.addDiscoveredCustomizers() | ||
.addDiscoveredSources() | ||
.build(); | ||
SmallRyeConfigProviderResolver.instance().registerConfig(config, Thread.currentThread().getContextClassLoader()); | ||
} | ||
|
||
@Override | ||
public void beforeAll(final ExtensionContext context) throws Exception { | ||
IntegrationTestUtil.activateLogging(); | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
test-framework/junit5/src/main/java/io/quarkus/test/junit/TestConfigBuilderCustomizer.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,12 @@ | ||
package io.quarkus.test.junit; | ||
|
||
import io.quarkus.deployment.dev.testing.TestConfig; | ||
import io.smallrye.config.SmallRyeConfigBuilder; | ||
import io.smallrye.config.SmallRyeConfigBuilderCustomizer; | ||
|
||
public class TestConfigBuilderCustomizer implements SmallRyeConfigBuilderCustomizer { | ||
@Override | ||
public void configBuilder(final SmallRyeConfigBuilder builder) { | ||
builder.withMapping(TestConfig.class); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...5/src/main/resources/META-INF/services/io.smallrye.config.SmallRyeConfigBuilderCustomizer
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 @@ | ||
io.quarkus.test.junit.TestConfigBuilderCustomizer |
3 changes: 2 additions & 1 deletion
3
...ork/junit5/src/main/resources/META-INF/services/org.junit.jupiter.api.extension.Extension
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
io.quarkus.test.junit.BasicLoggingEnabler | ||
io.quarkus.test.junit.ConfigExtension | ||
#io.quarkus.test.junit.BasicLoggingEnabler |