Skip to content

Commit

Permalink
[JENKINS-31770] fixed ATX report links for multiple archived ATX files
Browse files Browse the repository at this point in the history
  • Loading branch information
cpoenisch committed Nov 27, 2015
1 parent 2ad60ed commit 80f2287
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -153,7 +153,8 @@ public boolean generate(final boolean allowMissing, final ATXInstallation instal
*/
private int traverseReports(final List<ATXZipReport> atxReports, final FilePath archiveTargetDir, int id)
throws IOException, InterruptedException {
final FilePath[] zipFiles = archiveTargetDir.list(ATX_TEMPLATE_NAME + "/*.zip");
final FilePath[] zipFiles = archiveTargetDir.list(String.format("%s/%s.zip", ATX_TEMPLATE_NAME,
archiveTargetDir.getName()));
if (zipFiles.length == 1) {
final FilePath zipFile = zipFiles[0];
final String relFilePath = archiveTargetDir.getParent().toURI().relativize(zipFile.toURI())
Expand Down Expand Up @@ -189,16 +190,18 @@ private int traverseReports(final List<ATXZipReport> atxReports, final FilePath
private int traverseSubReports(final ATXZipReport atxReport, final FilePath testReportDir,
final FilePath subTestReportDir, int id) throws IOException, InterruptedException {
for (final FilePath subDir : subTestReportDir.listDirectories()) {
final FilePath[] reportFiles = subDir.list(ATX_TEMPLATE_NAME + "/*.zip");
final FilePath[] reportFiles = subDir.list(String.format("%s/%s.zip", ATX_TEMPLATE_NAME,
subDir.getName()));
if (reportFiles.length == 1) {
// Prepare ATX report information for sub-report
final FilePath reportFile = reportFiles[0];
final String fileName = reportFile.getBaseName().replaceFirst("^Report\\s", "");
final String relFilePath = testReportDir.toURI().relativize(reportFile.toURI()).getPath();
final ATXZipReport subReport = new ATXZipReport(String.format("%d", ++id), fileName, relFilePath,
reportFile.length());

atxReport.addSubReport(subReport);

// Search for sub-reports
id = traverseSubReports(subReport, testReportDir, subDir, id);
}
}
Expand Down

0 comments on commit 80f2287

Please sign in to comment.