-
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.
Add validation for runtime within deployment modules
- Loading branch information
Showing
4 changed files
with
91 additions
and
0 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
74 changes: 74 additions & 0 deletions
74
...arkus/annotation/processor/documentation/config/scanner/LegacyConfigRootListenerTest.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,74 @@ | ||
package io.quarkus.annotation.processor.documentation.config.scanner; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.EnumSource; | ||
|
||
import io.quarkus.annotation.processor.documentation.config.model.ConfigPhase; | ||
import io.quarkus.annotation.processor.documentation.config.model.Extension; | ||
import io.quarkus.annotation.processor.documentation.config.model.ExtensionModule; | ||
import io.quarkus.annotation.processor.util.Config; | ||
import io.quarkus.annotation.processor.util.Utils; | ||
|
||
class AbstractConfigListenerTest { | ||
|
||
@ParameterizedTest | ||
@EnumSource(value = ConfigPhase.class, names = { "RUN_TIME", "BUILD_AND_RUN_TIME_FIXED" }) | ||
void shouldThrowExceptionWhenConfigIsRuntimeAndModuleTypeIsDeployment(ConfigPhase phase) { | ||
Config config = new Config( | ||
new ExtensionModule( | ||
"io.quarkus", | ||
"quarkus-extension-deployment", | ||
ExtensionModule.ExtensionModuleType.DEPLOYMENT, | ||
new Extension( | ||
"io.quarkus", | ||
"quarkus-extension-deployment", | ||
"extension", | ||
null, | ||
false, | ||
null, | ||
true), | ||
true), | ||
false, | ||
false); | ||
|
||
AbstractConfigListener listener = new LegacyConfigRootListener( | ||
config, new Utils( | ||
null), | ||
new ConfigCollector()); | ||
|
||
Assertions.assertThrows(IllegalStateException.class, () -> { | ||
listener.validateRuntimeConfigOnDeploymentModules(phase); | ||
}); | ||
} | ||
|
||
@ParameterizedTest | ||
@EnumSource(value = ConfigPhase.class, names = { "RUN_TIME", "BUILD_AND_RUN_TIME_FIXED" }) | ||
void shouldNotThrowExceptionWhenConfigIsRuntimeAndModuleTypeIsRunTime(ConfigPhase phase) { | ||
Config config = new Config( | ||
new ExtensionModule( | ||
"io.quarkus", | ||
"quarkus-extension", | ||
ExtensionModule.ExtensionModuleType.RUNTIME, | ||
new Extension( | ||
"io.quarkus", | ||
"quarkus-extension", | ||
"extension", | ||
Extension.NameSource.EXTENSION_METADATA, | ||
false, | ||
"https://quarkus.io/guide/quarkus-extension", | ||
true), | ||
true), | ||
false, | ||
false); | ||
|
||
AbstractConfigListener listener = new LegacyConfigRootListener( | ||
config, new Utils( | ||
null), | ||
new ConfigCollector()); | ||
|
||
Assertions.assertDoesNotThrow(() -> { | ||
listener.validateRuntimeConfigOnDeploymentModules(phase); | ||
}); | ||
} | ||
} |