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
Nested ClassesModifier and TypeClassDescriptionstatic classPartial implementation ofJenkinsControllerFactoryfor subtypes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FileJENKINS_HOME directory for jenkins.war to be launched.protected JenkinsLogWatcherprotected org.jenkinsci.utils.process.ProcessInputStreamprotected ElasticTimeprotected Filejenkins.war.Fields inherited from class org.jenkinsci.test.acceptance.controller.JenkinsController
isQuite, STARTUP_TIMEOUT, WORKSPACE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCommon environment variables to put toCommandBuilderwhen launching Jenkins.voidPerform controller specific diagnostics for test failure.protected StringHostname to use when accessing Jenkins.booleanprotected voidonReady()Called when the Jenkins instance is ready to be used.voidpopulateJenkinsHome(byte[] _template, boolean clean) Populates the Jenkins Home with the specified ZIP template.voidpostConstruct(com.google.inject.Injector injector) Called whenJenkinsControlleris pulled into a world prior toJenkinsController.start()voidvoidsetRunInstallWizard(boolean runInstallWizard) Set the flag to run the install wizard.voidstartNow()Synchronously start Jenkins instance until it starts responding to the specified URL.abstract org.jenkinsci.utils.process.ProcessInputStreamvoidstopNow()Synchronously shutdown Jenkins instance.voidtearDown()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:JenkinsControllerCalled whenJenkinsControlleris pulled into a world prior toJenkinsController.start()- Overrides:
postConstructin classJenkinsController
-
addLogListener
- Specified by:
addLogListenerin interfaceLogListenable
-
removeLogListener
- Specified by:
removeLogListenerin interfaceLogListenable
-
getJenkinsHome
-
populateJenkinsHome
Description copied from interface:IJenkinsControllerPopulates 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:
populateJenkinsHomein interfaceIJenkinsController- Parameters:
_template- The template (ZIP format).clean- iftruethen 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:JenkinsControllerSynchronously start Jenkins instance until it starts responding to the specified URL.- Specified by:
startNowin classJenkinsController- Throws:
IOException
-
onReady
Called when the Jenkins instance is ready to be used.- Throws:
IOException
-
stopNow
Description copied from class:JenkinsControllerSynchronously 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:
stopNowin classJenkinsController- Throws:
IOException
-
diagnose
Description copied from class:JenkinsControllerPerform controller specific diagnostics for test failure. Defaults to no-op.- Overrides:
diagnosein classJenkinsController- Parameters:
cause- Failure cause
-
tearDown
public void tearDown()Description copied from class:JenkinsControllerAssuming the instance had already stopped, destroy JENKINS_HOME and release resources used by Jenkins.- Specified by:
tearDownin classJenkinsController
-
commonLaunchEnv
Common environment variables to put toCommandBuilderwhen 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- -trueto run the install wizard
-