Package com.piketec.jenkins.plugins.tpt
Class TptPlugin
- java.lang.Object
-
- hudson.tasks.BuildStepCompatibilityLayer
-
- hudson.tasks.Builder
-
- com.piketec.jenkins.plugins.tpt.TptPlugin
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<Builder>
,BuildStep
,SimpleBuildStep
public class TptPlugin extends Builder implements SimpleBuildStep
This class is just a data container for the TPTPlugin configuration in Jenkins.
If you use this Jenkins plugin you have two Options to run TPT-Test. The first option is just to run TPT via command line and execute the tests. The second option is to execute the tests via API. In this case for every testcase a single worker job will be started. This worker job must have a proper configuredTptPluginSlave
Build step. distribution job to worker job execution was introduced in the year 2016.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TptPlugin.DescriptorImpl
The descriptor of TptPlugin-
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Nested classes/interfaces inherited from interface jenkins.tasks.SimpleBuildStep
SimpleBuildStep.LastBuildAction, SimpleBuildStep.LastBuildActionFactory
-
-
Field Summary
Fields Modifier and Type Field Description boolean
isTptMaster
Deprecated.static String
RUN_BUILD
String
slaveJob
Deprecated.String
slaveJobCount
Deprecated.String
slaveJobTries
Deprecated.-
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
-
-
Constructor Summary
Constructors Constructor Description TptPlugin(String exePaths, ArrayList<JenkinsConfiguration> executionConfiguration)
All the parameter are processed and then they are passed to TptPluginSingleJobExecutor or to TptPluginMasterJobExecutor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getArguments()
Common command line opts.TptPlugin.DescriptorImpl
getDescriptor()
List<JenkinsConfiguration>
getExecutionConfiguration()
String
getExePaths()
boolean
getIsDistributing()
com.piketec.jenkins.plugins.tpt.TptLog.LogLevel
getJUnitLogLevel()
The severity level of TPT log messages that will be written to failed JUnit tests.String
getJUnitreport()
Report dir (optional).String
getTptBindingName()
String
getTptPort()
String
getTptStartUpWaitTime()
String
getWorkerJob()
String
getWorkerJobCount()
String
getWorkerJobTries()
boolean
isEnableJunit()
void
perform(Run<?,?> run, FilePath workspace, EnvVars env, Launcher launcher, TaskListener listener)
boolean
performAsDistributingJob(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars environment, ArrayList<JenkinsConfiguration> configs)
Get the required data to create aTptPluginDistributingJobExecutor
and excecutes it.boolean
performWithoutWorkerJobs(Run<?,?> run, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars environment, ArrayList<JenkinsConfiguration> configs)
Get the required data to create aTptPluginSingleJobExecutor
and excecutes it.protected Object
readResolve()
This method is used to persist the data format when upgrading the plugin.void
setArguments(String arguments)
void
setEnableJunit(boolean enableJunit)
void
setExe(String exe)
Deprecated.void
setIsDistributing(boolean isDistributing)
Should testcase execution be delegated to a sub job or is this run as a single job.void
setIsTptMaster(boolean isTptMaster)
Deprecated.historic problematic name.void
setjUnitLogLevel(com.piketec.jenkins.plugins.tpt.TptLog.LogLevel jUnitLogLevel)
void
setjUnitreport(String jUnitreport)
void
setSlaveJob(String slaveJob)
Deprecated.historic problematic name.void
setSlaveJobCount(String slaveJobCount)
Deprecated.historic problematic name.void
setSlaveJobTries(String slaveJobTries)
Deprecated.historic problematic name.void
setTptBindingName(String tptBindingName)
void
setTptPort(String tptPort)
void
setTptStartUpWaitTime(String tptStartUpWaitTime)
void
setWorkerJob(String workerJob)
void
setWorkerJobCount(String workerJobCount)
void
setWorkerJobTries(String workerJobTries)
-
Methods inherited from class hudson.tasks.Builder
all, getRequiredMonitorService, prebuild
-
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, perform, perform, prebuild
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, getRequiredMonitorService, perform, prebuild
-
Methods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform, requiresWorkspace
-
-
-
-
Field Detail
-
RUN_BUILD
public static final String RUN_BUILD
- See Also:
- Constant Field Values
-
isTptMaster
@Deprecated public transient boolean isTptMaster
Deprecated.
-
slaveJobCount
@Deprecated public transient String slaveJobCount
Deprecated.
-
slaveJob
@Deprecated public transient String slaveJob
Deprecated.
-
slaveJobTries
@Deprecated public transient String slaveJobTries
Deprecated.
-
-
Constructor Detail
-
TptPlugin
@DataBoundConstructor public TptPlugin(String exePaths, ArrayList<JenkinsConfiguration> executionConfiguration)
All the parameter are processed and then they are passed to TptPluginSingleJobExecutor or to TptPluginMasterJobExecutor- Parameters:
exePaths
- paths to tpt executables separated by a comma or a semicolonexecutionConfiguration
- all the jenkins configurations given in the descriptor, used to get the Files,Execution Configuration, test Set, testDataDir, reportDir,etc
-
-
Method Detail
-
readResolve
protected Object readResolve()
This method is used to persist the data format when upgrading the plugin.- Returns:
- this
-
getExePaths
public String getExePaths()
- Returns:
- The list of paths to possible TPT-installations.
-
setExe
@Deprecated public void setExe(String exe)
Deprecated.Deprecated, use exePaths instead- Parameters:
exe
- The path to the tpt.exe
-
getIsDistributing
public boolean getIsDistributing()
- Returns:
- Should testcase execution be delegated to a sub job
-
setIsDistributing
@DataBoundSetter public void setIsDistributing(boolean isDistributing)
Should testcase execution be delegated to a sub job or is this run as a single job.- Parameters:
isDistributing
-true
if the execution should be
-
setIsTptMaster
@DataBoundSetter @Deprecated public void setIsTptMaster(boolean isTptMaster)
Deprecated.historic problematic name. UsesetIsDistributing(boolean)
Should testcase execution be delegated to a sub job or is this run as a single job.- Parameters:
isTptMaster
-true
if the execution should be
-
getWorkerJob
public String getWorkerJob()
- Returns:
- The name of worker job if the plugin runs in distributing mode
-
setWorkerJob
@DataBoundSetter public void setWorkerJob(String workerJob)
- Parameters:
workerJob
- The name of worker job if the plugin runs in distributing mode
-
setSlaveJob
@DataBoundSetter @Deprecated public void setSlaveJob(String slaveJob)
Deprecated.historic problematic name. UsesetWorkerJob(String)
- Parameters:
slaveJob
- The name of worker job if the plugin runs in distributing mode
-
getWorkerJobCount
public String getWorkerJobCount()
- Returns:
- The number of worker jobs the plugin will run in distributing mode. A value below 1 means every test case will be started in its own job.
-
setWorkerJobCount
@DataBoundSetter public void setWorkerJobCount(String workerJobCount)
- Parameters:
workerJobCount
- The number of worker jobs the plugin will run in distributing mode. A value below 1 means every test case will be started in its own job.
-
setSlaveJobCount
@DataBoundSetter @Deprecated public void setSlaveJobCount(String slaveJobCount)
Deprecated.historic problematic name. UsesetWorkerJobCount(String)
- Parameters:
slaveJobCount
- The number of worker jobs the plugin will run in distributing mode. A value below 1 means every test case will be started in its own job.
-
getWorkerJobTries
public String getWorkerJobTries()
- Returns:
- If the execution of a worker job fails it is possible to reschedule the job for another try. This is the maximal number of tries.
-
setWorkerJobTries
@DataBoundSetter public void setWorkerJobTries(String workerJobTries)
- Parameters:
workerJobTries
- If the execution of a worker job fails it is possible to reschedule the job for another try. This is the maximal number of tries.
-
setSlaveJobTries
@DataBoundSetter @Deprecated public void setSlaveJobTries(String slaveJobTries)
Deprecated.historic problematic name. UsesetWorkerJobTries(String)
.- Parameters:
slaveJobTries
- If the execution of a worker job fails it is possible to reschedule the job for another try. This is the maximal number of tries.
-
getTptBindingName
public String getTptBindingName()
- Returns:
- the RMI binding name for TPT
-
setTptBindingName
@DataBoundSetter public void setTptBindingName(String tptBindingName)
- Parameters:
tptBindingName
- The RMI binding name for TPT
-
getTptPort
public String getTptPort()
- Returns:
- The port of the RMI registry
-
setTptPort
@DataBoundSetter public void setTptPort(String tptPort)
- Parameters:
tptPort
- The port of the RMI registry
-
getArguments
public String getArguments()
Common command line opts. Delimiter between the options is one or more spaces. Inside doublequotes spaces have no special meaning.- Returns:
- 0 or more options for tpt.
-
setArguments
@DataBoundSetter public void setArguments(String arguments)
-
getTptStartUpWaitTime
public String getTptStartUpWaitTime()
- Returns:
- The time waited before trying to get the API handle after starting TPT
-
setTptStartUpWaitTime
@DataBoundSetter public void setTptStartUpWaitTime(String tptStartUpWaitTime)
- Parameters:
tptStartUpWaitTime
- the time waited before trying to get the API handle after starting TPT
-
getExecutionConfiguration
public List<JenkinsConfiguration> getExecutionConfiguration()
- Returns:
- List of all (repeatable) sub-configurations
-
isEnableJunit
public boolean isEnableJunit()
- Returns:
- if the TPT test result should be transformed into a JUnit XML (legacy behaviour)
-
setEnableJunit
@DataBoundSetter public void setEnableJunit(boolean enableJunit)
- Parameters:
enableJunit
- if the TPT test result should be transformed into a JUnit XML (legacy behaviour)
-
getJUnitreport
public String getJUnitreport()
Report dir (optional).- Returns:
- The directory, where to store the results, can be
null
.
-
setjUnitreport
@DataBoundSetter public void setjUnitreport(String jUnitreport)
- Parameters:
jUnitreport
- The directory, where to store the results, can benull
.
-
getJUnitLogLevel
public com.piketec.jenkins.plugins.tpt.TptLog.LogLevel getJUnitLogLevel()
The severity level of TPT log messages that will be written to failed JUnit tests.- Returns:
- The severity level of TPT log messages that will be written to failed JUnit tests.
-
setjUnitLogLevel
@DataBoundSetter public void setjUnitLogLevel(com.piketec.jenkins.plugins.tpt.TptLog.LogLevel jUnitLogLevel)
- Parameters:
jUnitLogLevel
- The severity level of TPT log messages that will be written to failed JUnit tests.
-
perform
public void perform(Run<?,?> run, FilePath workspace, EnvVars env, Launcher launcher, TaskListener listener) throws InterruptedException, IOException
- Specified by:
perform
in interfaceSimpleBuildStep
- Throws:
InterruptedException
IOException
-
performWithoutWorkerJobs
public boolean performWithoutWorkerJobs(Run<?,?> run, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars environment, ArrayList<JenkinsConfiguration> configs) throws InterruptedException, IOException
Get the required data to create aTptPluginSingleJobExecutor
and excecutes it. It is called when there are no distributed builds. All the parameters are used to get the data for creating a new TptPluginSingleJobExecutor- Parameters:
run
- The current Jenkins buildlauncher
- The launcherlistener
- The listenerenvironment
- The map of envrionment varibales and their valueconfigs
- The configs with unresolved $-variables- Returns:
- true if it was possible to execute the TptPluginSingleJobExecutor.
- Throws:
InterruptedException
- If thread was interruptedIOException
-
performAsDistributingJob
public boolean performAsDistributingJob(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars environment, ArrayList<JenkinsConfiguration> configs) throws InterruptedException
Get the required data to create aTptPluginDistributingJobExecutor
and excecutes it. It is called when there are distributed builds.- Parameters:
build
- The current Jenkins buildlauncher
- The launcherlistener
- The listenerenvironment
- The map of envrionment varibales and their valueconfigs
- The configs with unresolved $-variables- Returns:
- true if the execution from worker jobs and distributing job were successful.
- Throws:
InterruptedException
- If thread was interrupted- See Also:
All the parameters are used to get the data for creating a new
-
getDescriptor
public TptPlugin.DescriptorImpl getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<Builder>
- Overrides:
getDescriptor
in classBuilder
-
-