Package io.quarkus.test
Class QuarkusProdModeTest
java.lang.Object
io.quarkus.test.QuarkusProdModeTest
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback
,org.junit.jupiter.api.extension.BeforeAllCallback
,org.junit.jupiter.api.extension.BeforeEachCallback
,org.junit.jupiter.api.extension.Extension
,org.junit.jupiter.api.extension.InvocationInterceptor
,org.junit.jupiter.api.extension.TestWatcher
public class QuarkusProdModeTest
extends Object
implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.TestWatcher, org.junit.jupiter.api.extension.InvocationInterceptor
A test extension for producing a prod-mode jar. This is meant to be used by extension authors, it's not intended for end user
consumption
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T extends Object>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCustomResourceEntry
(Path outputPath, String classPathLocation) void
afterAll
(org.junit.jupiter.api.extension.ExtensionContext extensionContext) assertBuildException
(Consumer<Throwable> assertException) void
beforeAll
(org.junit.jupiter.api.extension.ExtensionContext extensionContext) void
beforeEach
(org.junit.jupiter.api.extension.ExtensionContext context) Supplier<org.jboss.shrinkwrap.api.spec.JavaArchive>
Returns the process exit code, this can only be used ifexpectExit
is true.Returns the console output from startup.void
interceptBeforeAllMethod
(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) void
interceptBeforeEachMethod
(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) void
interceptTestMethod
(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) overrideConfigKey
(String propertyKey, String propertyValue) setApplicationName
(String applicationName) Effectively sets the quarkus.application.name property.setApplicationVersion
(String applicationVersion) Effectively sets the quarkus.application.version property.setArchiveProducer
(Supplier<org.jboss.shrinkwrap.api.spec.JavaArchive> archiveProducer) setBuildNative
(boolean buildNative) Effectively sets the quarkus.packaging.type property.setCommandLineParameters
(String... commandLineParameters) setExpectedException
(Class<? extends Throwable> expectedException) setExpectExit
(boolean expectExit) If this is true then the Quarkus application is expected to exit immediately (i.e.setForcedDependencies
(List<io.quarkus.maven.dependency.Dependency> forcedDependencies) Provides a convenient way to either add additional dependencies to the application (if it doesn't already contain a dependency), or override a version (if the dependency already exists)setJVMArgs
(List<String> jvmArgs) The complete set of JVM args to be used if the built artifact is configured to be runsetLogFileName
(String logFileName) File where the running application logs its output This property effectively sets the quarkus.log.file.path runtime configuration property and will override that value if it has been set in the configuration properties of the testsetLogRecordPredicate
(Predicate<LogRecord> predicate) setRun
(boolean run) If set to true, the built artifact will be run before starting the testssetRuntimeProperties
(Map<String, String> runtimeProperties) The runtime configuration properties to be used if the built artifact is configured to be runvoid
start()
Start the Quarkus application.void
stop()
Stop the Quarkus application.void
testFailed
(org.junit.jupiter.api.extension.ExtensionContext context, Throwable cause) withApplicationRoot
(Consumer<org.jboss.shrinkwrap.api.spec.JavaArchive> applicationRootConsumer) Customize the application root.withConfigurationResource
(String resourceName) Use an empty application for the testMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
interceptAfterAllMethod, interceptAfterEachMethod, interceptDynamicTest, interceptDynamicTest, interceptTestClassConstructor, interceptTestFactoryMethod, interceptTestTemplateMethod
Methods inherited from interface org.junit.jupiter.api.extension.TestWatcher
testAborted, testDisabled, testSuccessful
-
Field Details
-
BUILD_CONTEXT_BUILD_STEP_ENTRIES
- See Also:
-
BUILD_CONTEXT_BUILD_STEP_ENTRY_CONSUMES
- See Also:
-
BUILD_CONTEXT_BUILD_STEP_ENTRY_PRODUCES
- See Also:
-
BUILD_CONTEXT_CUSTOM_SOURCES_PATH_KEY
-
-
Constructor Details
-
QuarkusProdModeTest
public QuarkusProdModeTest()
-
-
Method Details
-
getArchiveProducer
-
setArchiveProducer
public QuarkusProdModeTest setArchiveProducer(Supplier<org.jboss.shrinkwrap.api.spec.JavaArchive> archiveProducer) -
withApplicationRoot
public QuarkusProdModeTest withApplicationRoot(Consumer<org.jboss.shrinkwrap.api.spec.JavaArchive> applicationRootConsumer) Customize the application root.- Parameters:
applicationRootConsumer
-- Returns:
- self
-
withEmptyApplication
Use an empty application for the test- Returns:
- self
-
addBuildChainCustomizerEntries
public QuarkusProdModeTest addBuildChainCustomizerEntries(QuarkusProdModeTest.BuildChainCustomizerEntry entry) -
addCustomResourceEntry
-
setApplicationName
Effectively sets the quarkus.application.name property. This value will override quarkus.application.name if that has been set in the configuration properties -
setApplicationVersion
Effectively sets the quarkus.application.version property. This value will override quarkus.application.version if that has been set in the configuration properties -
setBuildNative
Effectively sets the quarkus.packaging.type property. This value will override quarkus.packaging.type if that has been set in the configuration properties -
setRun
If set to true, the built artifact will be run before starting the tests -
setLogFileName
File where the running application logs its output This property effectively sets the quarkus.log.file.path runtime configuration property and will override that value if it has been set in the configuration properties of the test -
setJVMArgs
The complete set of JVM args to be used if the built artifact is configured to be run -
setRuntimeProperties
The runtime configuration properties to be used if the built artifact is configured to be run -
setLogRecordPredicate
-
setForcedDependencies
public QuarkusProdModeTest setForcedDependencies(List<io.quarkus.maven.dependency.Dependency> forcedDependencies) Provides a convenient way to either add additional dependencies to the application (if it doesn't already contain a dependency), or override a version (if the dependency already exists) -
setExpectExit
If this is true then the Quarkus application is expected to exit immediately (i.e. is a command mode app) -
assertBuildException
-
setExpectedException
-
getStartupConsoleOutput
Returns the console output from startup. IfexpectExit
is true then this will contain all the console output. -
getExitCode
Returns the process exit code, this can only be used ifexpectExit
is true. Null if the app is running. -
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception - Specified by:
beforeAll
in interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
- Throws:
Exception
-
start
public void start()Start the Quarkus application. If the application is already started, it raises anIllegalStateException
exception.- Throws:
RuntimeException
- when application errors at startup.IllegalStateException
- if the application is already started.
-
stop
public void stop()Stop the Quarkus application. -
interceptBeforeAllMethod
public void interceptBeforeAllMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Throwable - Specified by:
interceptBeforeAllMethod
in interfaceorg.junit.jupiter.api.extension.InvocationInterceptor
- Throws:
Throwable
-
interceptBeforeEachMethod
public void interceptBeforeEachMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Throwable - Specified by:
interceptBeforeEachMethod
in interfaceorg.junit.jupiter.api.extension.InvocationInterceptor
- Throws:
Throwable
-
interceptTestMethod
public void interceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Throwable - Specified by:
interceptTestMethod
in interfaceorg.junit.jupiter.api.extension.InvocationInterceptor
- Throws:
Throwable
-
testFailed
- Specified by:
testFailed
in interfaceorg.junit.jupiter.api.extension.TestWatcher
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception - Specified by:
afterAll
in interfaceorg.junit.jupiter.api.extension.AfterAllCallback
- Throws:
Exception
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
beforeEach
in interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
withConfigurationResource
-
overrideConfigKey
-
setCommandLineParameters
-