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

public abstract class LocalController extends JenkinsController implements LogListenable
Abstract base class for those JenkinsController that runs the JVM locally on the same box as the test harness
Author:
Vivek Pandey
  • Field Details

    • war

      @Inject @Named("jenkins.war") protected File war
      jenkins.war. Subject under test.
    • time

      @Inject protected ElasticTime time
    • jenkinsHome

      protected final File jenkinsHome
      JENKINS_HOME directory for jenkins.war to be launched.
    • process

      protected org.jenkinsci.utils.process.ProcessInputStream process
    • logWatcher

      protected JenkinsLogWatcher 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 when JenkinsController is pulled into a world prior to JenkinsController.start()
      Overrides:
      postConstruct in class JenkinsController
    • addLogListener

      public void addLogListener(LogListener l)
      Specified by:
      addLogListener in interface LogListenable
    • removeLogListener

      public void removeLogListener(LogListener l)
      Specified by:
      removeLogListener in interface LogListenable
    • getJenkinsHome

      public File getJenkinsHome()
    • populateJenkinsHome

      public void populateJenkinsHome(byte[] _template, boolean clean) throws IOException
      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 interface IJenkinsController
      Parameters:
      _template - The template (ZIP format).
      clean - if true 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

      public File getJavaHome()
    • startProcess

      public abstract org.jenkinsci.utils.process.ProcessInputStream startProcess() throws IOException
      Throws:
      IOException
    • startNow

      public void startNow() throws IOException
      Description copied from class: JenkinsController
      Synchronously start Jenkins instance until it starts responding to the specified URL.
      Specified by:
      startNow in class JenkinsController
      Throws:
      IOException
    • onReady

      protected void onReady() throws IOException
      Called when the Jenkins instance is ready to be used.
      Throws:
      IOException
    • stopNow

      public void stopNow() throws IOException
      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 class JenkinsController
      Throws:
      IOException
    • diagnose

      public void diagnose(Throwable cause)
      Description copied from class: JenkinsController
      Perform controller specific diagnostics for test failure. Defaults to no-op.
      Overrides:
      diagnose in class JenkinsController
      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 class JenkinsController
    • commonLaunchEnv

      @NonNull protected Map<String,String> commonLaunchEnv()
      Common environment variables to put to CommandBuilder when launching Jenkins.
    • getSutHostName

      protected String 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