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
Modifier and TypeFieldDescriptioncom.google.inject.Injector
protected boolean
static final int
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
close()
Alias fortearDown()
.void
Perform controller specific diagnostics for test failure.org.apache.http.auth.Credentials
getLogId()
Returns the short ID used to prefix log output from the process into the test.protected LogListener
abstract URL
getUrl()
Gives URL where Jenkins is listening.boolean
void
postConstruct
(com.google.inject.Injector injector) Called whenJenkinsController
is pulled into a world prior tostart()
void
restart()
Stops and starts running Jenkins to perform a full JVM restart.void
start()
Starts Jenkins.abstract void
startNow()
Synchronously start Jenkins instance until it starts responding to the specified URL.void
stop()
Stops Jenkinsabstract void
stopNow()
Synchronously shutdown Jenkins instance.abstract void
tearDown()
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, wait
Methods 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 whenJenkinsController
is pulled into a world prior tostart()
-
start
Starts Jenkins.- Specified by:
start
in interfaceIJenkinsController
- Throws:
IOException
-
startNow
Synchronously start Jenkins instance until it starts responding to the specified URL.- Throws:
IOException
-
stop
Stops Jenkins- Specified by:
stop
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in 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:
getUrl
in 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
-