Class LocalController
java.lang.Object
org.jenkinsci.test.acceptance.controller.JenkinsController
org.jenkinsci.test.acceptance.controller.LocalController
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IJenkinsController
,AutoCleaned
,LogListenable
- Direct Known Subclasses:
JBossController
,TomcatController
,WinstoneController
,WinstoneDockerController
Abstract base class for those JenkinsController that runs the JVM locally on
the same box as the test harness
- Author:
- Vivek Pandey
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Partial implementation ofJenkinsControllerFactory
for subtypes. -
Field Summary
Modifier and TypeFieldDescriptionprotected final File
JENKINS_HOME directory for jenkins.war to be launched.protected JenkinsLogWatcher
protected org.jenkinsci.utils.process.ProcessInputStream
protected ElasticTime
protected File
jenkins.war.Fields inherited from class org.jenkinsci.test.acceptance.controller.JenkinsController
isQuite, STARTUP_TIMEOUT, WORKSPACE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Common environment variables to put toCommandBuilder
when launching Jenkins.void
Perform controller specific diagnostics for test failure.protected String
Hostname to use when accessing Jenkins.boolean
protected void
onReady()
Called when the Jenkins instance is ready to be used.void
populateJenkinsHome
(byte[] _template, boolean clean) Populates the Jenkins Home with the specified ZIP template.void
postConstruct
(com.google.inject.Injector injector) Called whenJenkinsController
is pulled into a world prior toJenkinsController.start()
void
void
setRunInstallWizard
(boolean runInstallWizard) Set the flag to run the install wizard.void
startNow()
Synchronously start Jenkins instance until it starts responding to the specified URL.abstract org.jenkinsci.utils.process.ProcessInputStream
void
stopNow()
Synchronously shutdown Jenkins instance.void
tearDown()
Assuming the instance had already stopped, destroy JENKINS_HOME and release resources used by Jenkins.Methods inherited from class org.jenkinsci.test.acceptance.controller.JenkinsController
close, getInitialCredentials, getLogId, getLogPrinter, getUrl, isRunning, restart, start, stop
-
Field Details
-
war
jenkins.war. Subject under test. -
time
-
jenkinsHome
JENKINS_HOME directory for jenkins.war to be launched. -
process
protected org.jenkinsci.utils.process.ProcessInputStream process -
logWatcher
-
-
Constructor Details
-
LocalController
protected LocalController(com.google.inject.Injector i)
-
-
Method Details
-
postConstruct
public void postConstruct(com.google.inject.Injector injector) Description copied from class:JenkinsController
Called whenJenkinsController
is pulled into a world prior toJenkinsController.start()
- Overrides:
postConstruct
in classJenkinsController
-
addLogListener
- Specified by:
addLogListener
in interfaceLogListenable
-
removeLogListener
- Specified by:
removeLogListener
in interfaceLogListenable
-
getJenkinsHome
-
populateJenkinsHome
Description copied from interface:IJenkinsController
Populates the Jenkins Home with the specified ZIP template. Jenkins will not be restarted, so if the content would require a restart you have to do this yourself.- Specified by:
populateJenkinsHome
in interfaceIJenkinsController
- Parameters:
_template
- The template (ZIP format).clean
- iftrue
then the home will be wiped clean before the template is applied. If false then the template will simply overwrite the existing (if any) home.- Throws:
IOException
-
getJavaHome
-
startProcess
- Throws:
IOException
-
startNow
Description copied from class:JenkinsController
Synchronously start Jenkins instance until it starts responding to the specified URL.- Specified by:
startNow
in classJenkinsController
- Throws:
IOException
-
onReady
Called when the Jenkins instance is ready to be used.- Throws:
IOException
-
stopNow
Description copied from class:JenkinsController
Synchronously shutdown Jenkins instance.This method must leave JENKINS_HOME intact so that it can be started later. To really delete the data and clean up, see
JenkinsController.tearDown()
.- Specified by:
stopNow
in classJenkinsController
- Throws:
IOException
-
diagnose
Description copied from class:JenkinsController
Perform controller specific diagnostics for test failure. Defaults to no-op.- Overrides:
diagnose
in classJenkinsController
- Parameters:
cause
- Failure cause
-
tearDown
public void tearDown()Description copied from class:JenkinsController
Assuming the instance had already stopped, destroy JENKINS_HOME and release resources used by Jenkins.- Specified by:
tearDown
in classJenkinsController
-
commonLaunchEnv
Common environment variables to put toCommandBuilder
when launching Jenkins. -
getSutHostName
Hostname to use when accessing Jenkins.Useful to override with public hostname/IP when external clients needs to talk back to Jenkins.
- Returns:
- "127.0.0.1" unless overridden via JENKINS_LOCAL_HOSTNAME env var.
-
isRunInstallWizard
public boolean isRunInstallWizard()- Returns:
- true if the install wizard is going to be run
-
setRunInstallWizard
public void setRunInstallWizard(boolean runInstallWizard) Set the flag to run the install wizard.- Parameters:
runInstallWizard
- -true
to run the install wizard
-