com.liferay.jenkins.results.parser.FunctionalPortalTestBatch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.jenkins.results.parser
Show all versions of com.liferay.jenkins.results.parser
Liferay Jenkins Results Parser
The newest version!
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.jenkins.results.parser;
import java.io.File;
import java.io.IOException;
/**
* @author Michael Hashimoto
*/
public class FunctionalPortalTestBatch
extends BasePortalTestBatch {
@Override
public void run() {
try {
executeBatch();
}
catch (AntException antException) {
throw new RuntimeException(antException);
}
finally {
publishResults();
publishPoshiReport();
}
}
protected FunctionalPortalTestBatch(
PortalBatchBuildData portalBatchBuildData, Workspace workspace) {
super(portalBatchBuildData, workspace);
}
protected void publishPoshiReport() {
PortalBatchBuildData portalBatchBuildData = getBatchBuildData();
File portalWebTestResultsDir = new File(
getPrimaryPortalWorkspaceDirectory(), "portal-web/test-results");
File[] poshiResultsDirs = portalWebTestResultsDir.listFiles();
for (File poshiResultsDir : poshiResultsDirs) {
String poshiResultsDirName = poshiResultsDir.getName();
for (String test : portalBatchBuildData.getTestList()) {
if (!poshiResultsDirName.contains(test.replace('#', '_'))) {
continue;
}
try {
JenkinsResultsParserUtil.copy(
poshiResultsDir,
new File(
portalBatchBuildData.getArtifactDir(),
poshiResultsDirName));
}
catch (IOException ioException) {
throw new RuntimeException(ioException);
}
}
}
StringBuilder sb = new StringBuilder();
sb.append(portalBatchBuildData.getPortalBranchSHA());
sb.append(" - ");
sb.append(portalBatchBuildData.getBatchName());
sb.append(" - ");
sb.append("Jenkins Report");
sb.append("");
for (String test : portalBatchBuildData.getTestList()) {
String testName = test.replace('#', '_');
if (!testName.matches("[^\\.]+\\.[^_]+_.+")) {
testName = "LocalFile." + testName;
}
String poshiReportBaseURL = JenkinsResultsParserUtil.combine(
"https://", portalBatchBuildData.getTopLevelMasterHostname(),
".liferay.com/userContent/",
portalBatchBuildData.getUserContentRelativePath(),
portalBatchBuildData.getRunID(), "/", testName);
sb.append("- ");
sb.append(test);
sb.append(" - index.html");
sb.append(" - summary.html");
sb.append(" - console.txt");
}
sb.append("
");
portalBatchBuildData.setBuildDescription(sb.toString());
}
}