Class 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
    • Field Detail

      • BUILD_CONTEXT_CUSTOM_SOURCES_PATH_KEY

        public static String BUILD_CONTEXT_CUSTOM_SOURCES_PATH_KEY
    • Constructor Detail

      • QuarkusProdModeTest

        public QuarkusProdModeTest()
    • Method Detail

      • getArchiveProducer

        public Supplier<org.jboss.shrinkwrap.api.spec.JavaArchive> 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

        public QuarkusProdModeTest withEmptyApplication()
        Use an empty application for the test
        Returns:
        self
      • setApplicationName

        public QuarkusProdModeTest setApplicationName​(String applicationName)
        Effectively sets the quarkus.application.name property. This value will override quarkus.application.name if that has been set in the configuration properties
      • setApplicationVersion

        public QuarkusProdModeTest setApplicationVersion​(String applicationVersion)
        Effectively sets the quarkus.application.version property. This value will override quarkus.application.version if that has been set in the configuration properties
      • setBuildNative

        public QuarkusProdModeTest setBuildNative​(boolean buildNative)
        Effectively sets the quarkus.packaging.type property. This value will override quarkus.packaging.type if that has been set in the configuration properties
      • setRun

        public QuarkusProdModeTest setRun​(boolean run)
        If set to true, the built artifact will be run before starting the tests
      • setLogFileName

        public QuarkusProdModeTest setLogFileName​(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 test
      • setJVMArgs

        public QuarkusProdModeTest setJVMArgs​(List<String> jvmArgs)
        The complete set of JVM args to be used if the built artifact is configured to be run
      • setRuntimeProperties

        public QuarkusProdModeTest setRuntimeProperties​(Map<String,​String> runtimeProperties)
        The runtime configuration properties to be used if the built artifact is configured to be run
      • 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

        public QuarkusProdModeTest setExpectExit​(boolean expectExit)
        If this is true then the Quarkus application is expected to exit immediately (i.e. is a command mode app)
      • getStartupConsoleOutput

        public String getStartupConsoleOutput()
        Returns the console output from startup. If expectExit is true then this will contain all the console output.
      • getExitCode

        public Integer getExitCode()
        Returns the process exit code, this can only be used if expectExit 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 interface org.junit.jupiter.api.extension.BeforeAllCallback
        Throws:
        Exception
      • 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 interface org.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 interface org.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 interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • testFailed

        public void testFailed​(org.junit.jupiter.api.extension.ExtensionContext context,
                               Throwable cause)
        Specified by:
        testFailed in interface org.junit.jupiter.api.extension.TestWatcher
      • afterAll

        public void afterAll​(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                      throws Exception
        Specified by:
        afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback
        Throws:
        Exception
      • beforeEach

        public void beforeEach​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback