Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 34c1a5b

Browse files
committed
Update as per review comments
1 parent 3517803 commit 34c1a5b

File tree

12 files changed

+374
-306
lines changed

12 files changed

+374
-306
lines changed

src/main/java/com/mathworks/ci/MatlabBuilderConstants.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public class MatlabBuilderConstants {
4343

4444
public static final String TEST_RESULTS_VIEW_ARTIFACT = "matlabTestResults";
4545
public static final String BUILD_ARTIFACT = "buildArtifact";
46+
47+
// MATLAB Test Result Statuses
48+
public static final String PASSED = "Passed";
49+
public static final String FAILED = "Failed";
50+
public static final String INCOMPLETE = "Incomplete";
51+
public static final String NOT_RUN = "NotRun";
4652

4753
public static final String NEW_LINE = System.getProperty("line.separator");
4854

src/main/java/com/mathworks/ci/TestCase.java renamed to src/main/java/com/mathworks/ci/MatlabTestCase.java

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,45 @@
33
/**
44
* Copyright 2024, The MathWorks Inc.
55
*
6+
* Class to store MATLAB test case information
7+
*
68
*/
79

810
import java.util.List;
911
import java.util.ArrayList;
1012

1113
import org.apache.commons.lang.RandomStringUtils;
1214

13-
public class TestCase {
15+
public class MatlabTestCase {
1416
private String name;
15-
private List<TestDiagnostics> diagnostics;
17+
private List<MatlabTestDiagnostics> diagnostics;
1618
private boolean passed;
1719
private boolean failed;
1820
private boolean incomplete;
1921
private String status;
2022
private Double duration;
2123
private String id;
2224

23-
public TestCase() {
24-
name = "";
25-
diagnostics = new ArrayList<TestDiagnostics>();
26-
passed = false;
27-
failed = false;
28-
incomplete = false;
29-
status = "NotRun";
30-
duration = 0.0;
31-
id = RandomStringUtils.randomAlphanumeric(8);
25+
public MatlabTestCase() {
26+
this.name = "";
27+
this.diagnostics = new ArrayList<MatlabTestDiagnostics>();
28+
this.passed = false;
29+
this.failed = false;
30+
this.incomplete = false;
31+
this.status = MatlabBuilderConstants.NOT_RUN;
32+
this.duration = 0.0;
33+
this.id = RandomStringUtils.randomAlphanumeric(8);
3234
}
3335

3436
public void updateStatus() {
35-
if (failed){
36-
status = "Failed";
37+
if (this.failed){
38+
this.status = MatlabBuilderConstants.FAILED;
3739
}
38-
else if (incomplete) {
39-
status = "Incomplete";
40+
else if (this.incomplete) {
41+
this.status = MatlabBuilderConstants.INCOMPLETE;
4042
}
41-
else if(passed) {
42-
status = "Passed";
43+
else if(this.passed) {
44+
this.status = MatlabBuilderConstants.PASSED;
4345
}
4446
}
4547

@@ -51,11 +53,11 @@ public void setName(String name) {
5153
this.name = name;
5254
}
5355

54-
public List<TestDiagnostics> getDiagnostics() {
56+
public List<MatlabTestDiagnostics> getDiagnostics() {
5557
return this.diagnostics;
5658
}
5759

58-
public void setDiagnostics(List<TestDiagnostics> diagnostics) {
60+
public void setDiagnostics(List<MatlabTestDiagnostics> diagnostics) {
5961
this.diagnostics = diagnostics;
6062
}
6163

@@ -100,6 +102,6 @@ public void setDuration(Double duration) {
100102
}
101103

102104
public String getId() {
103-
return id;
105+
return this.id;
104106
}
105107
}

src/main/java/com/mathworks/ci/TestDiagnostics.java renamed to src/main/java/com/mathworks/ci/MatlabTestDiagnostics.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@
33
/**
44
* Copyright 2024, The MathWorks Inc.
55
*
6+
* Class to store MATLAB test diagnostics information
7+
*
68
*/
79

810
import org.apache.commons.lang.RandomStringUtils;
911

10-
public class TestDiagnostics {
12+
public class MatlabTestDiagnostics {
1113
private String event;
1214
private String report;
1315
private String id;
1416

15-
public TestDiagnostics() {
16-
event = "";
17-
report = "";
18-
id = RandomStringUtils.randomAlphanumeric(8);
17+
public MatlabTestDiagnostics() {
18+
this.event = "";
19+
this.report = "";
20+
this.id = RandomStringUtils.randomAlphanumeric(8);
1921
}
2022

2123
public String getEvent() {
@@ -35,6 +37,6 @@ public void setReport(String report) {
3537
}
3638

3739
public String getId() {
38-
return id;
40+
return this.id;
3941
}
4042
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
package com.mathworks.ci;
2+
3+
/**
4+
* Copyright 2024, The MathWorks Inc.
5+
*
6+
* Class to store MATLAB test file information
7+
*
8+
*/
9+
10+
import java.util.List;
11+
import java.util.ArrayList;
12+
13+
import org.apache.commons.lang.RandomStringUtils;
14+
15+
public class MatlabTestFile {
16+
private String path;
17+
private String name;
18+
private Double duration;
19+
private String status;
20+
private List<MatlabTestCase> matlabTestCases;
21+
private String id;
22+
23+
public MatlabTestFile() {
24+
this.path = "";
25+
this.name = "";
26+
this.duration = 0.0;
27+
this.status = MatlabBuilderConstants.NOT_RUN;
28+
this.matlabTestCases = new ArrayList<MatlabTestCase>();
29+
this.id = RandomStringUtils.randomAlphanumeric(8);
30+
}
31+
32+
public void incrementDuration(Double matlabTestCaseDuration) {
33+
this.duration += matlabTestCaseDuration;
34+
}
35+
36+
public void updateStatus(MatlabTestCase matlabTestCase) {
37+
if (!this.status.equals(MatlabBuilderConstants.FAILED)) {
38+
if (matlabTestCase.getFailed()){
39+
this.status = MatlabBuilderConstants.FAILED;
40+
}
41+
else if (!this.status.equals(MatlabBuilderConstants.INCOMPLETE)){
42+
if (matlabTestCase.getIncomplete()){
43+
this.status = MatlabBuilderConstants.INCOMPLETE;
44+
}
45+
else if (matlabTestCase.getPassed()){
46+
this.status = MatlabBuilderConstants.PASSED;
47+
}
48+
}
49+
}
50+
}
51+
52+
public String getPath() {
53+
return this.path;
54+
}
55+
56+
public void setPath(String path) {
57+
this.path = path;
58+
}
59+
60+
public String getName() {
61+
return this.name;
62+
}
63+
64+
public void setName(String name) {
65+
this.name = name;
66+
}
67+
68+
public Double getDuration() {
69+
return this.duration;
70+
}
71+
72+
public void setDuration(Double duration) {
73+
this.duration = duration;
74+
}
75+
76+
public String getStatus() {
77+
return this.status;
78+
}
79+
80+
public void setStatus(String status) {
81+
this.status = status;
82+
}
83+
84+
public List<MatlabTestCase> getMatlabTestCases() {
85+
return this.matlabTestCases;
86+
}
87+
88+
public void setMatlabTestCases(List<MatlabTestCase> matlabTestCases) {
89+
this.matlabTestCases = matlabTestCases;
90+
}
91+
92+
public String getId() {
93+
return this.id;
94+
}
95+
}

src/main/java/com/mathworks/ci/TestFile.java

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)