Class WorkLoad


  • public class WorkLoad
    extends Object
    Through this class is how the data from a distributing job to a worker job is passed. A way to tell the worker job what testcases should be executed.
    Author:
    FInfantino, PikeTec GmbH
    • Constructor Detail

      • WorkLoad

        public WorkLoad​(JenkinsConfiguration unresolvedConfig,
                        List<String> subTestSet,
                        FilePath distributingJobWorkspace,
                        Run<?,​?> distributingJobRun,
                        FilePath distributingJobDataDir,
                        FilePath distributingJobReportDir)
        Parameters:
        unresolvedConfig - JenkinsConfiguration that contains paths and tpt file names with unresolved $-vars
        subTestSet - the test cases that should be executed by the worker
        distributingJobWorkspace - the workspace from the distributing job, used for knowing where to copy the results
        distributingJobRun - the current build, used in order to get an unique id
        distributingJobDataDir - The test data directory of the distributing job
        distributingJobReportDir - The report directory the distributing job
    • Method Detail

      • getJenkinsConfig

        public JenkinsConfiguration getJenkinsConfig()
        Returns:
        the jenkins configuration that contains paths and tpt file names with unresolved $-vars
      • getTestCases

        public List<String> getTestCases()
        Returns:
        the test cases that should be executed
      • getDistributingJobWorkspace

        public FilePath getDistributingJobWorkspace()
        Returns:
        the workspace from the distributing job
      • getDistributingJobRun

        public Run<?,​?> getDistributingJobRun()
        Returns:
        the current build, used to get an unique Id
      • getDistributingJobDataDir

        public FilePath getDistributingJobDataDir()
        Returns:
        the path to the data directory of the distributing job
      • getDistributingJobReportDir

        public FilePath getDistributingJobReportDir()
        Returns:
        the path to the report directory of the distributing job
      • putWorkLoad

        public static void putWorkLoad​(String jobName,
                                       WorkLoad workloadToAdd)
        Adds a workload to the static HashMap. This method is used when the distributing job put the workload here and then triggers the worker job.
        Parameters:
        jobName - The name of the jenkins job serving as a worker.
        workloadToAdd - The work package to be executed by the worker job
      • pollWorkload

        public static WorkLoad pollWorkload​(String jobName)
        Pops the workload from the static HashMap. This method is used from the worker when a build has been triggered and it needs to do some workload.
        Parameters:
        jobName - The name of the jenkins job serving as a worker job.
        Returns:
        the workload that has been removed, null if there is nothing to remove.
      • clean

        public static void clean​(String jobName,
                                 Run<?,​?> distributingJobRun)
        Cleans the workload if there is an Interrupted Exeption. We dont want to store the workload if something goes wrong.
        Parameters:
        jobName - The name of the jenkins job serving as a worker.
        distributingJobRun - the build of the distributing job