-
-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathPlotBuilderTest.java
More file actions
85 lines (79 loc) · 3.63 KB
/
PlotBuilderTest.java
File metadata and controls
85 lines (79 loc) · 3.63 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
79
80
81
82
83
84
85
package hudson.plugins.plot;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.junit.jupiter.api.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.junit.jupiter.WithJenkins;
@WithJenkins
class PlotBuilderTest {
@Test
void testWithMinimalPipelineArgs(JenkinsRule r) throws Exception {
WorkflowJob p = r.createProject(WorkflowJob.class, "projectUnderTest");
p.setDefinition(new CpsFlowDefinition("""
node { \s
plot csvFileName: 'plot-minimal.csv',
group: 'My Data',
style: 'line'
}""", true));
r.buildAndAssertSuccess(p);
}
@Test
void testWithXML(JenkinsRule r) throws Exception {
WorkflowJob p = r.createProject(WorkflowJob.class, "projectUnderTest");
p.setDefinition(new CpsFlowDefinition("""
node { \s
def content = '<my_data>'
content += '<test value1="123.456"/>'
content += '<test value2="321.654"/>'
content += '</my_data>'
writeFile file: 'data.xml', text: content
plot csvFileName: 'plot-xml.csv',
group: 'My Data',
title: 'Useful Title',
style: 'line',
yaxis: 'arbitrary',
xmlSeries: [
[file: 'data.xml',
nodeType: 'NODESET',
xpath: 'my_data/test/@*']
]
}""", true));
r.buildAndAssertSuccess(p);
}
@Test
void testWithCSV(JenkinsRule r) throws Exception {
WorkflowJob p = r.createProject(WorkflowJob.class, "projectUnderTest");
p.setDefinition(new CpsFlowDefinition("""
node { \s
def content = 'Avg,Median,90,min,max,samples,errors,error %'
content += '515.33,196,1117,2,16550,97560,360,0.37'
writeFile file: 'data.csv', text: content
plot csvFileName: 'plot-csv.csv',
group: 'My Data',
title: 'Useful Title',
style: 'line',
yaxis: 'arbitrary',
csvSeries: [[file: 'data.csv']]
}""", true));
r.buildAndAssertSuccess(p);
}
@Test
void testWithProperties(JenkinsRule r) throws Exception {
WorkflowJob p = r.createProject(WorkflowJob.class, "projectUnderTest");
p.setDefinition(new CpsFlowDefinition("""
node { \s
def content = 'YVALUE=1'
writeFile file: 'data.properties', text: content
plot csvFileName: 'plot-properties.csv',
group: 'My Data',
title: 'Useful Title',
style: 'line',
yaxis: 'arbitrary',
propertiesSeries: [
[file: 'data.properties',
label: 'My Label']
]
}""", true));
r.buildAndAssertSuccess(p);
}
}