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 slave job will be started. This slvae job must have a proper configured TptPluginSlave Build step. Master-slave execution was 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 static java.lang.String
RUN_BUILD
-
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
-
-
Constructor Summary
Constructors Constructor Description TptPlugin(java.lang.String exePaths, java.util.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 java.lang.String
getArguments()
Common command line opts.TptPlugin.DescriptorImpl
getDescriptor()
java.util.List<JenkinsConfiguration>
getExecutionConfiguration()
java.lang.String
getExePaths()
boolean
getIsTptMaster()
com.piketec.jenkins.plugins.tpt.TptLog.LogLevel
getJUnitLogLevel()
The severity level of TPT log messages that will be written to failed JUnit tests.java.lang.String
getJUnitreport()
Report dir (optional).java.lang.String
getSlaveJob()
java.lang.String
getSlaveJobCount()
java.lang.String
getSlaveJobTries()
java.lang.String
getTptBindingName()
java.lang.String
getTptPort()
java.lang.String
getTptStartUpWaitTime()
boolean
isEnableJunit()
boolean
isIsTptMaster()
void
perform(Run<?,?> run, FilePath workspace, EnvVars env, Launcher launcher, TaskListener listener)
boolean
performAsMaster(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars environment, java.util.ArrayList<JenkinsConfiguration> configs)
Get the required data to create a TptPluginMasterJobExecutor and excecutes it.boolean
performWithoutSlaves(Run<?,?> run, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars environment, java.util.ArrayList<JenkinsConfiguration> configs)
Get the required data to create a TptPluginSingleJobExecutor and excecutes it.protected java.lang.Object
readResolve()
This method is used to persist the data format when upgrading the plugin.void
setArguments(java.lang.String arguments)
void
setEnableJunit(boolean enableJunit)
void
setExe(java.lang.String exe)
Deprecated.void
setIsTptMaster(boolean isTptMaster)
Should testcase execution be delegated to a sub job or is this run as a single job.void
setjUnitLogLevel(com.piketec.jenkins.plugins.tpt.TptLog.LogLevel jUnitLogLevel)
void
setjUnitreport(java.lang.String jUnitreport)
void
setSlaveJob(java.lang.String slaveJob)
void
setSlaveJobCount(java.lang.String slaveJobCount)
void
setSlaveJobTries(java.lang.String slaveJobTries)
void
setTptBindingName(java.lang.String tptBindingName)
void
setTptPort(java.lang.String tptPort)
void
setTptStartUpWaitTime(java.lang.String tptStartUpWaitTime)
-
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 java.lang.String RUN_BUILD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TptPlugin
@DataBoundConstructor public TptPlugin(java.lang.String exePaths, java.util.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 java.lang.Object readResolve()
This method is used to persist the data format when upgrading the plugin.- Returns:
- this
-
getExePaths
public java.lang.String getExePaths()
- Returns:
- The list of paths to possible TPT-installations.
-
setExe
@Deprecated public void setExe(java.lang.String exe)
Deprecated.Deprecated, use exePaths instead- Parameters:
exe
- The path to the tpt.exe
-
getIsTptMaster
public boolean getIsTptMaster()
- Returns:
- Should testcase execution be delegated to a sub job
-
setIsTptMaster
@DataBoundSetter public void setIsTptMaster(boolean isTptMaster)
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
-
isIsTptMaster
public boolean isIsTptMaster()
- Returns:
- Should testcase execution be deligated to a slave job
-
getSlaveJob
public java.lang.String getSlaveJob()
- Returns:
- The name of slave job if the plugin runs in master mode
-
setSlaveJob
@DataBoundSetter public void setSlaveJob(java.lang.String slaveJob)
- Parameters:
slaveJob
- The name of slave job if the plugin runs in master mode
-
getSlaveJobCount
public java.lang.String getSlaveJobCount()
- Returns:
- The number of slave job the plugin will run in master mode. A value below 1 means every test case will be started in its own job.
-
setSlaveJobCount
@DataBoundSetter public void setSlaveJobCount(java.lang.String slaveJobCount)
- Parameters:
slaveJobCount
- The number of slave job the plugin will run in master mode. A value below 1 means every test case will be started in its own job.
-
getSlaveJobTries
public java.lang.String getSlaveJobTries()
- Returns:
- If the execution of a slave job fails it is possible to reschedule the job for another try. This is the maximal number of tries.
-
setSlaveJobTries
@DataBoundSetter public void setSlaveJobTries(java.lang.String slaveJobTries)
- Parameters:
slaveJobTries
- If the execution of a slave job fails it is possible to reschedule the job for another try. This is the maximal number of tries.
-
getTptBindingName
public java.lang.String getTptBindingName()
- Returns:
- the RMI binding name for TPT
-
setTptBindingName
@DataBoundSetter public void setTptBindingName(java.lang.String tptBindingName)
- Parameters:
tptBindingName
- The RMI binding name for TPT
-
getTptPort
public java.lang.String getTptPort()
- Returns:
- The port of the RMI registry
-
setTptPort
@DataBoundSetter public void setTptPort(java.lang.String tptPort)
- Parameters:
tptPort
- The port of the RMI registry
-
getArguments
public java.lang.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(java.lang.String arguments)
-
getTptStartUpWaitTime
public java.lang.String getTptStartUpWaitTime()
- Returns:
- The time waited before trying to get the API handle after starting TPT
-
setTptStartUpWaitTime
@DataBoundSetter public void setTptStartUpWaitTime(java.lang.String tptStartUpWaitTime)
- Parameters:
tptStartUpWaitTime
- the time waited before trying to get the API handle after starting TPT
-
getExecutionConfiguration
public java.util.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 java.lang.String getJUnitreport()
Report dir (optional).- Returns:
- The directory, where to store the results, can be
null
.
-
setjUnitreport
@DataBoundSetter public void setjUnitreport(java.lang.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 java.lang.InterruptedException, java.io.IOException
- Specified by:
perform
in interfaceSimpleBuildStep
- Throws:
java.lang.InterruptedException
java.io.IOException
-
performWithoutSlaves
public boolean performWithoutSlaves(Run<?,?> run, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars environment, java.util.ArrayList<JenkinsConfiguration> configs) throws java.lang.InterruptedException, java.io.IOException
Get the required data to create a TptPluginSingleJobExecutor 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:
java.lang.InterruptedException
- If thread was interruptedjava.io.IOException
-
performAsMaster
public boolean performAsMaster(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars environment, java.util.ArrayList<JenkinsConfiguration> configs) throws java.lang.InterruptedException
Get the required data to create a TptPluginMasterJobExecutor and excecutes it. It is called when there are distributed builds. @see the execute() method from TptPluginMasterJobExecutor. All the parameters are used to get the data for creating a new TptPluginMasterJobExecutor- 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 slaves and master were successful.
- Throws:
java.lang.InterruptedException
- If thread was interrupted
-
getDescriptor
public TptPlugin.DescriptorImpl getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<Builder>
- Overrides:
getDescriptor
in classBuilder
-
-