Class WorkLoad


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

      • WorkLoad

        public WorkLoad​(JenkinsConfiguration unresolvedConfig,
                        java.util.List<java.lang.String> subTestSet,
                        FilePath masterWorkspace,
                        Run<?,​?> masterId,
                        FilePath masterDataDir,
                        FilePath masterReportDir)
        Parameters:
        unresolvedConfig - JenkinsConfiguration that contains paths and tpt file names with unresolved $-vars
        subTestSet - the test cases that should be executed by the slave
        masterWorkspace - the workspace from master, used for knowing where to copy the results
        masterId - the current build, used in order to get an unique id
        masterDataDir - The test data directory on the agent the master job is running on
        masterReportDir - The report directory on the agent the master job is running on
    • Method Detail

      • getJenkinsConfig

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

        public java.util.List<java.lang.String> getTestCases()
        Returns:
        the test cases that should be executed
      • getMasterWorkspace

        public FilePath getMasterWorkspace()
        Returns:
        the workspace from master
      • getMasterId

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

        public FilePath getMasterDataDir()
        Returns:
        the path to the data directory on the master
      • getMasterReportDir

        public FilePath getMasterReportDir()
        Returns:
        the path to the report directory on the master
      • putWorkLoad

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

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

        public static void clean​(java.lang.String jobName,
                                 Run<?,​?> masterBuild)
        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 slave.
        masterBuild - the build of the master job