Package io.quarkus.test.bootstrap
Class BaseService<T extends Service>
- java.lang.Object
-
- io.quarkus.test.bootstrap.BaseService<T>
-
- All Implemented Interfaces:
Service,org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource
- Direct Known Subclasses:
DefaultService,RestService
public class BaseService<T extends Service> extends Object implements Service
-
-
Field Summary
Fields Modifier and Type Field Description static StringSERVICE_STARTUP_TIMEOUTstatic DurationSERVICE_STARTUP_TIMEOUT_DEFAULT
-
Constructor Summary
Constructors Constructor Description BaseService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationgetConfiguration()StringgetHost()StringgetHost(Protocol protocol)List<String>getLogs()StringgetName()IntegergetPort()IntegergetPort(Protocol protocol)Map<String,String>getProperties()protected <U> UgetPropertyFromContext(String key)protected PathgetServiceFolder()voidinit(ManagedResourceBuilder managedResourceBuilder)booleanisRunning()LogsVerifierlogs()TonPostStart(Action action)TonPreStart(Action action)ServiceContextregister(String serviceName, org.junit.jupiter.api.extension.ExtensionContext testContext)voidrestart()voidstart()Start the managed resource.voidstop()Stop the Quarkus application.TwithProperties(String... propertiesFiles)The runtime configuration property to be used if the built artifact is configured to be run.TwithProperty(String key, String value)The runtime configuration property to be used if the built artifact is configured to be run.TwithProperty(String key, Supplier<String> value)The runtime configuration property to be used if the built artifact is configured to be run.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.quarkus.test.bootstrap.Service
close, getProperty, validate
-
-
-
-
Field Detail
-
SERVICE_STARTUP_TIMEOUT
public static final String SERVICE_STARTUP_TIMEOUT
- See Also:
- Constant Field Values
-
SERVICE_STARTUP_TIMEOUT_DEFAULT
public static final Duration SERVICE_STARTUP_TIMEOUT_DEFAULT
-
-
Method Detail
-
getConfiguration
public Configuration getConfiguration()
- Specified by:
getConfigurationin interfaceService
-
withProperties
public T withProperties(String... propertiesFiles)
The runtime configuration property to be used if the built artifact is configured to be run.
-
withProperty
public T withProperty(String key, String value)
The runtime configuration property to be used if the built artifact is configured to be run.- Specified by:
withPropertyin interfaceService
-
withProperty
public T withProperty(String key, Supplier<String> value)
The runtime configuration property to be used if the built artifact is configured to be run.
-
getHost
public String getHost()
-
getPort
public Integer getPort()
-
getProperties
public Map<String,String> getProperties()
- Specified by:
getPropertiesin interfaceService
-
start
public void start()
Start the managed resource. If the managed resource is running, it does nothing.- Specified by:
startin interfaceService- Throws:
RuntimeException- when application errors at startup.
-
register
public ServiceContext register(String serviceName, org.junit.jupiter.api.extension.ExtensionContext testContext)
-
init
public void init(ManagedResourceBuilder managedResourceBuilder)
-
restart
public void restart()
-
logs
public LogsVerifier logs()
-
getServiceFolder
protected Path getServiceFolder()
-
getPropertyFromContext
protected <U> U getPropertyFromContext(String key)
-
-