@@ -35,12 +35,12 @@ public class RunMatlabTestsBuilder extends Builder implements SimpleBuildStep, M
3535
3636 private int buildResult ;
3737 private EnvVars env ;
38- private TapChkBx tapChkBx ;
39- private JunitChkBx junitChkBx ;
40- private CoberturaChkBx coberturaChkBx ;
41- private StmResultsChkBx stmResultsChkBx ;
42- private ModelCovChkBx modelCoverageChkBx ;
43- private PdfChkBx pdfReportChkBx ;
38+ private TapArtifact tapArtifact ;
39+ private JunitArtifact junitArtifact ;
40+ private CoberturaArtifact coberturaArtifact ;
41+ private StmResultsArtifact stmResultsArtifact ;
42+ private ModelCovArtifact modelCoverageArtifact ;
43+ private PdfArtifact pdfReportArtifact ;
4444 private String tapReportFilePath ;
4545 private String pdfReportFilePath ;
4646 private String junitReportFilePath ;
@@ -60,123 +60,83 @@ public RunMatlabTestsBuilder() {
6060
6161
6262 @ DataBoundSetter
63- public void setTapChkBx ( TapChkBx tapChkBx ) {
64- this .tapChkBx = tapChkBx ;
65- this .tapReportFilePath = this .tapChkBx .getTapReportFilePath ();
63+ public void setTapArtifact ( TapArtifact tapArtifact ) {
64+ this .tapArtifact = tapArtifact ;
65+ this .tapReportFilePath = this .tapArtifact .getTapReportFilePath ();
6666 }
6767
6868 @ DataBoundSetter
69- public void setJunitChkBx ( JunitChkBx junitChkBx ) {
70- this .junitChkBx = junitChkBx ;
71- this .junitReportFilePath = this .junitChkBx .getJunitReportFilePath ();
69+ public void setJunitArtifact ( JunitArtifact junitArtifact ) {
70+ this .junitArtifact = junitArtifact ;
71+ this .junitReportFilePath = this .junitArtifact .getJunitReportFilePath ();
7272 }
7373
7474 @ DataBoundSetter
75- public void setCoberturaChkBx ( CoberturaChkBx coberturaChkBx ) {
76- this .coberturaChkBx = coberturaChkBx ;
77- this .coberturaReportFilePath = this .coberturaChkBx .getCoberturaReportFilePath ();
75+ public void setCoberturaArtifact ( CoberturaArtifact coberturaArtifact ) {
76+ this .coberturaArtifact = coberturaArtifact ;
77+ this .coberturaReportFilePath = this .coberturaArtifact .getCoberturaReportFilePath ();
7878 }
7979
8080 @ DataBoundSetter
81- public void setStmResultsChkBx ( StmResultsChkBx stmResultsChkBx ) {
82- this .stmResultsChkBx = stmResultsChkBx ;
83- this .stmResultsFilePath = this .stmResultsChkBx .getStmResultsFilePath ();
81+ public void setStmResultsArtifact ( StmResultsArtifact stmResultsArtifact ) {
82+ this .stmResultsArtifact = stmResultsArtifact ;
83+ this .stmResultsFilePath = this .stmResultsArtifact .getStmResultsFilePath ();
8484 }
8585
8686 @ DataBoundSetter
87- public void setModelCoverageChkBx ( ModelCovChkBx modelCoverageChkBx ) {
88- this .modelCoverageChkBx = modelCoverageChkBx ;
89- this .modelCoverageFilePath = this .modelCoverageChkBx .getModelCoverageFilePath ();
87+ public void setModelCoverageArtifact ( ModelCovArtifact modelCoverageArtifact ) {
88+ this .modelCoverageArtifact = modelCoverageArtifact ;
89+ this .modelCoverageFilePath = this .modelCoverageArtifact .getModelCoverageFilePath ();
9090 }
9191
9292 @ DataBoundSetter
93- public void setPdfReportChkBx ( PdfChkBx pdfReportChkBx ) {
94- this .pdfReportChkBx = pdfReportChkBx ;
95- this .pdfReportFilePath = this .pdfReportChkBx .getPdfReportFilePath ();
93+ public void setPdfReportArtifact ( PdfArtifact pdfReportArtifact ) {
94+ this .pdfReportArtifact = pdfReportArtifact ;
95+ this .pdfReportFilePath = this .pdfReportArtifact .getPdfReportFilePath ();
9696 }
9797
9898 public String getTapReportFilePath () {
9999 return this .tapReportFilePath ;
100100 }
101- public boolean getIsPdfChecked () {
102- if (this .pdfReportChkBx != null ) {
103- return true ;
104- }
105- return false ;
106- }
107- public TapChkBx getTapChkBx () {
108- return this .tapChkBx ;
109- }
110101
111- public boolean getIsTapChecked () {
112- if (this .tapChkBx != null ) {
113- return true ;
114- }
115- return false ;
102+ public TapArtifact getTapArtifact () {
103+ return this .tapArtifact ;
116104 }
117-
118- public JunitChkBx getJunitChkBx () {
119- return this .junitChkBx ;
105+
106+ public JunitArtifact getJunitArtifact () {
107+ return this .junitArtifact ;
120108 }
121109
122110 public String getJunitReportFilePath () {
123111 return this .junitReportFilePath ;
124112 }
125-
126- public boolean getIsJunitChecked () {
127- if (this .junitChkBx != null ) {
128- return true ;
129- }
130- return false ;
131- }
132-
133- public CoberturaChkBx getCoberturaChkBx () {
134- return this .coberturaChkBx ;
113+
114+ public CoberturaArtifact getCoberturaArtifact () {
115+ return this .coberturaArtifact ;
135116 }
136117
137118 public String getCoberturaReportFilePath () {
138119 return this .coberturaReportFilePath ;
139120 }
140-
141- public boolean getIsCoberturaChecked () {
142- if (this .coberturaChkBx != null ) {
143- return true ;
144- }
145- return false ;
146- }
147-
148- public StmResultsChkBx getStmResultsChkBx () {
149- return this .stmResultsChkBx ;
121+
122+ public StmResultsArtifact getStmResultsArtifact () {
123+ return this .stmResultsArtifact ;
150124 }
151125
152126 public String getStmResultsFilePath () {
153127 return this .stmResultsFilePath ;
154128 }
155-
156- public boolean getIsStmChecked () {
157- if (this .stmResultsChkBx != null ) {
158- return true ;
159- }
160- return false ;
161- }
162-
163- public ModelCovChkBx getModelCoverageChkBx () {
164- return this .modelCoverageChkBx ;
129+
130+ public ModelCovArtifact getModelCoverageArtifact () {
131+ return this .modelCoverageArtifact ;
165132 }
166133
167134 public String getModelCoverageFilePath () {
168135 return modelCoverageFilePath ;
169136 }
170137
171- public boolean getIsModelCovChecked () {
172- if (this .modelCoverageChkBx != null ) {
173- return true ;
174- }
175- return false ;
176- }
177-
178- public PdfChkBx getPdfReportChkBx () {
179- return this .pdfReportChkBx ;
138+ public PdfArtifact getPdfReportArtifact () {
139+ return this .pdfReportArtifact ;
180140 }
181141
182142 public String getPdfReportFilePath () {
@@ -274,27 +234,38 @@ public String constructCommandForTest(String inputArguments) {
274234
275235 // Concatenate the input arguments
276236 private String getInputArguments () {
277- addInputArgs (MatlabBuilderConstants .PDF_REPORT_PATH , getPdfReportFilePath ());
278- addInputArgs (MatlabBuilderConstants .TAP_RESULTS_PATH , getTapReportFilePath ());
279- addInputArgs (MatlabBuilderConstants .JUNIT_RESULTS_PATH , getJunitReportFilePath ());
280- addInputArgs (MatlabBuilderConstants .STM_RESULTS_PATH , getStmResultsFilePath ());
281- addInputArgs (MatlabBuilderConstants .COBERTURA_CODE_COVERAGE_PATH ,
282- getCoberturaReportFilePath ());
283- addInputArgs (MatlabBuilderConstants .COBERTURA_MODEL_COVERAGE_PATH ,
284- getModelCoverageFilePath ());
237+
238+ if (getPdfReportArtifact () != null ) {
239+ getPdfReportArtifact ().addFilePathArgTo (inputArgs );
240+ }
241+
242+ if (getTapArtifact () != null ) {
243+ getTapArtifact ().addFilePathArgTo (inputArgs );
244+ }
245+
246+ if (getJunitArtifact () != null ) {
247+ getJunitArtifact ().addFilePathArgTo (inputArgs );
248+ }
249+
250+ if (getStmResultsArtifact () != null ) {
251+ getStmResultsArtifact ().addFilePathArgTo (inputArgs );
252+ }
253+
254+ if (getCoberturaArtifact () != null ) {
255+ getCoberturaArtifact ().addFilePathArgTo (inputArgs );
256+ }
257+
258+ if (getModelCoverageArtifact () != null ) {
259+ getModelCoverageArtifact ().addFilePathArgTo (inputArgs );
260+ }
285261
286262 if (inputArgs .isEmpty ()) {
287263 return "" ;
288264 }
289265
290266 return String .join ("," , inputArgs );
291267 }
292-
293- private void addInputArgs (String reportName , String reportPath ) {
294- if (reportPath != null ) {
295- inputArgs .add (reportName + "," + "'" + reportPath + "'" );
296- }
297- }
268+
298269
299270 /*
300271 * Classes for each optional block in jelly file.This is restriction from Stapler architecture
@@ -306,12 +277,12 @@ private void addInputArgs(String reportName, String reportPath) {
306277 * 7Csort:date/jenkinsci-dev/AFYHSG3NUEI/UsVJIKoE4B8J
307278 *
308279 */
309- public static class PdfChkBx {
280+ public static class PdfArtifact {
310281 private String pdfReportFilePath ;
311282
312283 @ DataBoundConstructor
313- public PdfChkBx () {
314-
284+ public PdfArtifact () {
285+
315286 }
316287
317288 @ DataBoundSetter
@@ -322,13 +293,18 @@ public void setPdfReportFilePath(String pdfReportFilePath) {
322293 public String getPdfReportFilePath () {
323294 return this .pdfReportFilePath ;
324295 }
296+
297+ public void addFilePathArgTo (List <String > inputArgs ) {
298+ inputArgs .add (MatlabBuilderConstants .PDF_REPORT_PATH + "," + "'"
299+ + getPdfReportFilePath () + "'" );
300+ }
325301 }
326302
327- public static class TapChkBx {
303+ public static class TapArtifact {
328304 private String tapReportFilePath ;
329305
330306 @ DataBoundConstructor
331- public TapChkBx () {
307+ public TapArtifact () {
332308
333309 }
334310
@@ -340,13 +316,18 @@ public void setTapReportFilePath(String tapReportFilePath) {
340316 public String getTapReportFilePath () {
341317 return tapReportFilePath ;
342318 }
319+
320+ public void addFilePathArgTo (List <String > inputArgs ) {
321+ inputArgs .add (MatlabBuilderConstants .TAP_RESULTS_PATH + "," + "'"
322+ + getTapReportFilePath () + "'" );
323+ }
343324 }
344325
345- public static class JunitChkBx {
326+ public static class JunitArtifact {
346327 private String junitReportFilePath ;
347328
348329 @ DataBoundConstructor
349- public JunitChkBx () {
330+ public JunitArtifact () {
350331
351332 }
352333
@@ -358,13 +339,18 @@ public void setJunitReportFilePath(String junitReportFilePath) {
358339 public String getJunitReportFilePath () {
359340 return this .junitReportFilePath ;
360341 }
342+
343+ public void addFilePathArgTo (List <String > inputArgs ) {
344+ inputArgs .add (MatlabBuilderConstants .JUNIT_RESULTS_PATH + "," + "'"
345+ + getJunitReportFilePath () + "'" );
346+ }
361347 }
362348
363- public static class CoberturaChkBx {
349+ public static class CoberturaArtifact {
364350 private String coberturaReportFilePath ;
365351
366352 @ DataBoundConstructor
367- public CoberturaChkBx () {
353+ public CoberturaArtifact () {
368354
369355 }
370356
@@ -376,13 +362,18 @@ public void setCoberturaReportFilePath(String coberturaReportFilePath) {
376362 public String getCoberturaReportFilePath () {
377363 return this .coberturaReportFilePath ;
378364 }
365+
366+ public void addFilePathArgTo (List <String > inputArgs ) {
367+ inputArgs .add (MatlabBuilderConstants .COBERTURA_CODE_COVERAGE_PATH + "," + "'"
368+ + getCoberturaReportFilePath () + "'" );
369+ }
379370 }
380371
381- public static class StmResultsChkBx {
372+ public static class StmResultsArtifact {
382373 private String stmResultsFilePath ;
383374
384375 @ DataBoundConstructor
385- public StmResultsChkBx () {
376+ public StmResultsArtifact () {
386377
387378 }
388379
@@ -394,13 +385,18 @@ public void setStmResultsFilePath(String stmResultsFilePath) {
394385 public String getStmResultsFilePath () {
395386 return stmResultsFilePath ;
396387 }
388+
389+ public void addFilePathArgTo (List <String > inputArgs ) {
390+ inputArgs .add (MatlabBuilderConstants .STM_RESULTS_PATH + "," + "'"
391+ + getStmResultsFilePath () + "'" );
392+ }
397393 }
398394
399- public static class ModelCovChkBx {
395+ public static class ModelCovArtifact {
400396 private String modelCoverageFilePath ;
401397
402398 @ DataBoundConstructor
403- public ModelCovChkBx () {
399+ public ModelCovArtifact () {
404400
405401 }
406402
@@ -412,6 +408,10 @@ public void setModelCoverageFilePath(String modelCoverageFilePath) {
412408 public String getModelCoverageFilePath () {
413409 return modelCoverageFilePath ;
414410 }
411+
412+ public void addFilePathArgTo (List <String > inputArgs ) {
413+ inputArgs .add (MatlabBuilderConstants .COBERTURA_MODEL_COVERAGE_PATH + "," + "'"
414+ + getModelCoverageFilePath () + "'" );
415+ }
415416 }
416-
417417}
0 commit comments