Enum CounterKey
- All Implemented Interfaces:
Serializable
,Comparable<CounterKey>
These are the keys of the counters that we will manage to report at phase level and multijob project level.
Every time a phase ends:
- We inject phase variables with the count of the jobs, one for every key.
- We update multijob variables with the number (counter) of the jobs, one for every key.
We can use these new variables at job condition, so we can write now conditions as follows (of course, these new variables are available in the next phase):
- ${PHASE_SUCCESSFUL} > 1: The number of SUCCESSFUL jobs are greater than 1.
- ${PHASE_ABORTED} == 0 || ${PHASE_UNSTABLE} == 2: The number of ABORTED jobs are equals to 0, or the number of UNSTABLE jobs are equals to 2.
-
Enum Constant Summary
Enum ConstantDescriptionThe name of the new build variable which stores the number of aborted jobs.The name of the new build variable which stores the number of failed jobs.The name of the new build variable which stores the number of skipped jobs.The name of the new build variable which stores the number of successful jobs.The name of the new build variable which stores the number of successful jobs.The name of the new build variable which stores the number of unstable jobs. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Checks if a result applies to the CounterKey.Returns the name of the key associated with the multijob project and the counterKey.Returns the name of the key associated with the phase and the counterKey.static CounterKey
safetyValueOf
(String key) A convenient way to encapsulate logic to avoid an IllegalArgumentException when we need to find a CounterKey value and the key doesn't exists.static CounterKey
Returns the enum constant of this type with the specified name.static CounterKey[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
SUCCESSFUL
The name of the new build variable which stores the number of successful jobs. In this context, the SUCCESSFUL state means SUCCESS OR UNSTABLE results. -
STABLE
The name of the new build variable which stores the number of successful jobs. In this context, the STABLE state means SUCESS results. -
UNSTABLE
The name of the new build variable which stores the number of unstable jobs. In this context, the UNSTABLE state means the UNSTABLE result. -
FAILED
The name of the new build variable which stores the number of failed jobs. In this context, the FAILED state means FAILED results. -
ABORTED
The name of the new build variable which stores the number of aborted jobs. In this context, the ABORTED state means the ABORTED result. -
SKIPPED
The name of the new build variable which stores the number of skipped jobs. In this context, the SKIPPED state means the SKIPPED jobs.
-
-
Field Details
-
KEYS
A convenient static array of all multijob and phase keys.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
appliesTo
Checks if a result applies to the CounterKey. Every time a job has finished we must update the counter or counters this result applies to. This methods reports if the result applies to the CounterKey. -
getMultiJobKey
Returns the name of the key associated with the multijob project and the counterKey.- Returns:
- a String with the name of key that will be used to store the counter.
-
getPhaseKey
Returns the name of the key associated with the phase and the counterKey.- Returns:
- a String with the name of key that will be used to store the counter.
-
safetyValueOf
A convenient way to encapsulate logic to avoid an IllegalArgumentException when we need to find a CounterKey value and the key doesn't exists.- Parameters:
key
- the name of the CounterKey that we want to search.- Returns:
- the
CounterKey
ornull
if it doesn't exists.
-