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

Commit 9c41c81

Browse files
committed
Updated as per review comments
1 parent 0de91c6 commit 9c41c81

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public BuildArtifactAction(Run<?, ?> build, String actionID) {
4545
public String getActionID(){
4646
return this.actionID;
4747
}
48+
4849
@CheckForNull
4950
@Override
5051
public String getIconFileName() {
@@ -66,7 +67,8 @@ public String getUrlName() {
6667
public List<BuildArtifactData> getBuildArtifact() throws ParseException, InterruptedException, IOException {
6768
List<BuildArtifactData> artifactData = new ArrayList<BuildArtifactData>();
6869

69-
FilePath fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" + BUILD_ARTIFACT_FILE + this.actionID +".json"));
70+
FilePath fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
71+
BUILD_ARTIFACT_FILE + this.actionID + ".json"));
7072
try (InputStreamReader reader = new InputStreamReader(new FileInputStream(new File(fl.toURI())), "UTF-8")) {
7173
Object obj = new JSONParser().parse(reader);
7274
JSONObject jo = (JSONObject) obj;

src/main/java/com/mathworks/ci/actions/RunMatlabBuildAction.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@ public String getActionID(){
3535
return this.actionID;
3636
}
3737

38-
private void setActionID(){
39-
this.actionID = RandomStringUtils.randomAlphanumeric(8);
40-
}
41-
4238
public RunMatlabBuildAction(MatlabCommandRunner runner, BuildConsoleAnnotator annotator, BuildActionParameters params) {
4339
this.runner = runner;
40+
this.actionID = RandomStringUtils.randomAlphanumeric(8);
4441
this.annotator = annotator;
4542
this.params = params;
4643
}
@@ -54,8 +51,6 @@ public RunMatlabBuildAction(BuildActionParameters params) throws IOException, In
5451
}
5552

5653
public void run() throws IOException, InterruptedException, MatlabExecutionException {
57-
// set unique action ID for each build task
58-
this.setActionID();
5954
// Copy plugins and override default plugins function
6055
runner.copyFileToTempFolder(DEFAULT_PLUGIN, DEFAULT_PLUGIN);
6156
runner.copyFileToTempFolder(BUILD_REPORT_PLUGIN, BUILD_REPORT_PLUGIN);
@@ -126,4 +121,4 @@ public void run() throws IOException, InterruptedException, MatlabExecutionExcep
126121
}
127122

128123
}
129-
}
124+
}

src/test/java/integ/com/mathworks/ci/BuildArtifactActionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void verifyBuildArtifactsReturned() throws ExecutionException, Interrupte
7878
copyFileInWorkspace("buildArtifacts/t1/buildArtifact.json",targetFile,artifactRoot);
7979
List<BuildArtifactData> ba = ac.getBuildArtifact();
8080
int expectedSize = ba.size();
81-
Assert.assertEquals("The build names are not matching",3,expectedSize);
81+
Assert.assertEquals("Incorrect build artifact",3,expectedSize);
8282
}
8383

8484
/**

0 commit comments

Comments
 (0)