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 protected ServiceContextcontextstatic StringDELETE_FOLDER_ON_EXITstatic StringSERVICE_STARTUP_TIMEOUTstatic DurationSERVICE_STARTUP_TIMEOUT_DEFAULT
-
Constructor Summary
Constructors Constructor Description BaseService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Let JUnit close remaining resources.ConfigurationgetConfiguration()StringgetDisplayName()StringgetHost()Deprecated.StringgetHost(Protocol protocol)Deprecated.List<String>getLogs()StringgetName()IntegergetPort()Deprecated.IntegergetPort(Protocol protocol)Deprecated.Map<String,String>getProperties()StringgetProperty(String property, String defaultValue)<U> UgetPropertyFromContext(String key)StringgetScenarioId()PathgetServiceFolder()URILikegetURI()URILikegetURI(Protocol protocol)voidinit(ManagedResourceBuilder managedResourceBuilder)booleanisAutoStart()booleanisRunning()LogsVerifierlogs()TonPostStart(Action action)TonPreStart(Action action)ServiceContextregister(String serviceName, ScenarioContext context)voidrestart()voidrestartAndWaitUntilServiceIsStarted()TsetAutoStart(boolean autoStart)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
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
-
DELETE_FOLDER_ON_EXIT
public static final String DELETE_FOLDER_ON_EXIT
- See Also:
- Constant Field Values
-
context
protected ServiceContext context
-
-
Method Detail
-
getScenarioId
public String getScenarioId()
- Specified by:
getScenarioIdin interfaceService
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayNamein interfaceService
-
getConfiguration
public Configuration getConfiguration()
- Specified by:
getConfigurationin interfaceService
-
isAutoStart
public boolean isAutoStart()
- Specified by:
isAutoStartin interfaceService
-
setAutoStart
public T setAutoStart(boolean autoStart)
-
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.
-
getURI
public URILike getURI()
-
getHost
@Deprecated public String getHost()
Deprecated.
-
getHost
@Deprecated public String getHost(Protocol protocol)
Deprecated.
-
getPort
@Deprecated public Integer getPort()
Deprecated.
-
getPort
@Deprecated public Integer getPort(Protocol protocol)
Deprecated.
-
getProperties
public Map<String,String> getProperties()
- Specified by:
getPropertiesin interfaceService
-
getProperty
public String getProperty(String property, String defaultValue)
- Specified by:
getPropertyin 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.
-
close
public void close()
Let JUnit close remaining resources.
-
register
public ServiceContext register(String serviceName, ScenarioContext context)
-
init
public void init(ManagedResourceBuilder managedResourceBuilder)
-
restart
public void restart()
-
restartAndWaitUntilServiceIsStarted
public void restartAndWaitUntilServiceIsStarted()
-
logs
public LogsVerifier logs()
-
getServiceFolder
public Path getServiceFolder()
-
getPropertyFromContext
public <U> U getPropertyFromContext(String key)
-
-