-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathAbstractThreshold.java
More file actions
78 lines (69 loc) · 2.08 KB
/
AbstractThreshold.java
File metadata and controls
78 lines (69 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package io.jenkins.plugins.coverage;
import org.jenkinsci.test.acceptance.po.Control;
import org.jenkinsci.test.acceptance.po.PageArea;
import org.jenkinsci.test.acceptance.po.PageAreaImpl;
/**
* Used for thresholds and global thresholds.
*/
abstract class AbstractThreshold extends PageAreaImpl {
private final Control thresholdTarget = control("thresholdTarget");
private final Control unhealthyThreshold = control("unhealthyThreshold");
private final Control unstableThreshold = control("unstableThreshold");
private final Control failUnhealthy = control("failUnhealthy");
private final Control delete = control("repeatable-delete");
/**
* Constructor of an AbstractThreshold.
*
* @param parent
* of threshold
* @param path
* to threshold
*/
protected AbstractThreshold(PageArea parent, String path) {
super(parent, path);
}
/**
* Setter for unhealthy-threshold.
*
* @param threshold
* for unhealthy
*/
public void setUnhealthyThreshold(double threshold) {
ensureAdvancedOptionsIsActivated();
unhealthyThreshold.set(threshold);
}
/**
* Setter for unstable-threshold.
*
* @param threshold
* for unstable
*/
public void setUnstableThreshold(double threshold) {
ensureAdvancedOptionsIsActivated();
unstableThreshold.set(threshold);
}
/**
* Setter for fail on unhealthy.
*
* @param failOnUnhealthy
* boolean for failing on unhealthy
*/
public void setFailUnhealthy(boolean failOnUnhealthy) {
ensureAdvancedOptionsIsActivated();
failUnhealthy.check(failOnUnhealthy);
}
/**
* Deletes a threshold.
*/
public void delete() {
ensureAdvancedOptionsIsActivated();
delete.click();
}
/**
* Ensures advanced options are activated so that Thresholds can be set.
*/
public abstract void ensureAdvancedOptionsIsActivated();
Control getThresholdTarget() {
return thresholdTarget;
}
}