Class JenkinsController
java.lang.Object
org.jenkinsci.test.acceptance.controller.JenkinsController
- All Implemented Interfaces:
Closeable,AutoCloseable,IJenkinsController,AutoCleaned
- Direct Known Subclasses:
ExistingJenkinsController,LocalController,PooledJenkinsController
Starts/stops Jenkins and exposes where it is running.
This abstracts away how the test harness launches Jenkins-under-test and where, which is determined at runtime by the user who runs the tests, not by the author of tests.
- Author:
- Vivek Pandey
-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.google.inject.Injectorprotected booleanstatic final intprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()Alias fortearDown().voidPerform controller specific diagnostics for test failure.org.apache.http.auth.CredentialsgetLogId()Returns the short ID used to prefix log output from the process into the test.protected LogListenerabstract URLgetUrl()Gives URL where Jenkins is listening.booleanvoidpostConstruct(com.google.inject.Injector injector) Called whenJenkinsControlleris pulled into a world prior tostart()voidrestart()Stops and starts running Jenkins to perform a full JVM restart.voidstart()Starts Jenkins.abstract voidstartNow()Synchronously start Jenkins instance until it starts responding to the specified URL.voidstop()Stops Jenkinsabstract voidstopNow()Synchronously shutdown Jenkins instance.abstract voidtearDown()Assuming the instance had already stopped, destroy JENKINS_HOME and release resources used by Jenkins.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jenkinsci.test.acceptance.controller.IJenkinsController
populateJenkinsHome
-
Field Details
-
isQuite
@Inject @Named("quite") protected boolean isQuite -
WORKSPACE
-
STARTUP_TIMEOUT
public static final int STARTUP_TIMEOUT -
injector
public com.google.inject.Injector injector
-
-
Constructor Details
-
JenkinsController
protected JenkinsController(com.google.inject.Injector i)
-
-
Method Details
-
postConstruct
public void postConstruct(com.google.inject.Injector injector) Called whenJenkinsControlleris pulled into a world prior tostart() -
start
Starts Jenkins.- Specified by:
startin interfaceIJenkinsController- Throws:
IOException
-
startNow
Synchronously start Jenkins instance until it starts responding to the specified URL.- Throws:
IOException
-
stop
Stops Jenkins- Specified by:
stopin interfaceIJenkinsController- Throws:
IOException
-
getLogPrinter
-
stopNow
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
tearDown().- Throws:
IOException
-
close
Alias fortearDown().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
tearDown
Assuming the instance had already stopped, destroy JENKINS_HOME and release resources used by Jenkins.- Throws:
IOException
-
restart
Stops and starts running Jenkins to perform a full JVM restart.- Throws:
IOException
-
isRunning
public boolean isRunning() -
getUrl
Gives URL where Jenkins is listening. Must end with "/"- Specified by:
getUrlin interfaceIJenkinsController
-
getInitialCredentials
@CheckForNull public org.apache.http.auth.Credentials getInitialCredentials() -
getLogId
Returns the short ID used to prefix log output from the process into the test. -
diagnose
Perform controller specific diagnostics for test failure. Defaults to no-op.- Parameters:
cause- Failure cause- Throws:
IOException
-