Class Job

    • Constructor Detail

      • Job

        public Job​(com.google.inject.Injector injector,
                   URL url,
                   String name)
    • Method Detail

      • useScm

        public <T extends Scm> T useScm​(Class<T> type)
      • addPreBuildStep

        public <T extends BuildStep> T addPreBuildStep​(Class<T> type)
      • addBuildStep

        public <T extends BuildStep> T addBuildStep​(Class<T> type)
      • removeFirstBuildStep

        public void removeFirstBuildStep()
      • addPublisher

        public <T extends PostBuildStep> T addPublisher​(Class<T> publisherClass)
        Adds the specified publisher to this job. Publishers are stored in a list member to provide later access for modification.
        Type Parameters:
        T - the type of the publisher
        Parameters:
        publisherClass - the publisher to configure
        See Also:
        getPublisher(Class), editPublisher(Class, Consumer)
      • addPublisher

        public <T extends PostBuildStep> T addPublisher​(Class<T> type,
                                                        Consumer<T> configuration)
        Adds the specified publisher to this job. Publishers are stored in a list member to provide later access for modification. After the publisher has been added the publisher is configured with the specified configuration lambda. Afterwards, the job configuration page still is visible and not saved.
        Type Parameters:
        T - the type of the publisher
        Parameters:
        type - the publisher to configure
        configuration - the additional configuration options for this job
        See Also:
        getPublisher(Class), editPublisher(Class, Consumer)
      • editPublisher

        public <T extends PostBuildStep> void editPublisher​(Class<T> type,
                                                            Consumer<T> configuration)
        Edits this job using the specified configuration lambda. Opens the job configuration view, selects the specified publisher page object, runs the specified configuration lambda, and saves the changes. Afterwards, the job configuration page still is visible and not saved.
        Type Parameters:
        T - the type of the publisher
        Parameters:
        type - the publisher to configure
        configuration - the additional configuration options for this job
      • getPublisher

        public <T extends PostBuildStep> T getPublisher​(Class<T> type)
        Getter for a specific publisher previously added to the job. If a publisher of a class is requested which has not been added previously this will result in a NoSuchElementException.
      • addBuildWrapper

        public <T extends BuildWrapper> T addBuildWrapper​(Class<T> type)
      • addTrigger

        public <T extends Trigger> T addTrigger​(Class<T> type)
      • copyResource

        public void copyResource​(Resource resource,
                                 String fileName)
        Adds a shell step that copies a resource inside the test project into a file on the build machine.

        Because there's no direct file system access to Jenkins master, we do this by packing file content in base64 and put it as a heredoc in the shell script.

      • copyResourceBatch

        protected String copyResourceBatch​(Resource resource)
      • copyResource

        public void copyResource​(Resource resource)
      • copyFile

        public void copyFile​(File file)
        "Copy" any file from the System into the Workspace using a zipFIle.

        Differentiates when the file is being run on Windows or Unix based machines.

      • copyDir

        public void copyDir​(Resource dir)
      • copyResource

        public void copyResource​(String resourcePath)
        "Copies" a resource (can be a single file or a directory) to the jobs workspace by utilizing a shell step.
        Parameters:
        resourcePath - the resource to copy
      • getBuildUrl

        public URL getBuildUrl()
      • startBuild

        public Build startBuild()
      • scheduleBuild

        public Build scheduleBuild()
      • scheduleBuild

        public Build scheduleBuild​(Map<String,​?> params)
      • build

        public Build build​(int buildNumber)
      • getLastBuild

        public Build getLastBuild()
      • addParameter

        public <T extends Parameter> T addParameter​(Class<T> type)
      • disable

        public void disable()
      • getNextBuildNumber

        public int getNextBuildNumber()
      • getWorkspace

        public Workspace getWorkspace()
      • useCustomWorkspace

        public void useCustomWorkspace​(String ws)
      • setLabelExpression

        public void setLabelExpression​(String label)
      • shouldBeTiedToLabel

        public Job shouldBeTiedToLabel​(String label)
      • shouldHaveBuiltOnOneOfNNodes

        public void shouldHaveBuiltOnOneOfNNodes​(List<Node> nodes)
        Verify that the job contains some builds on exact one of the given list of nodes. To test whether the the job has built on the master, the jenkins instance has to be passed in the parameter.
      • delete

        public void delete()
        Deletes the current job.
        Specified by:
        delete in class TopLevelItem
      • disabled

        public static org.hamcrest.Matcher<org.openqa.selenium.WebDriver> disabled()