com.liferay.jenkins.results.parser.test.clazz.group.CompileModulesBatchTestClassGroup 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.test.clazz.group;
import com.liferay.jenkins.results.parser.JenkinsResultsParserUtil;
import com.liferay.jenkins.results.parser.PortalGitWorkingDirectory;
import com.liferay.jenkins.results.parser.PortalTestClassJob;
import com.liferay.jenkins.results.parser.test.clazz.TestClass;
import com.liferay.jenkins.results.parser.test.clazz.TestClassFactory;
import java.io.File;
import java.io.IOException;
import java.nio.file.PathMatcher;
import java.util.Collections;
import java.util.List;
import org.json.JSONObject;
/**
* @author Leslie Wong
*/
public class CompileModulesBatchTestClassGroup
extends ModulesBatchTestClassGroup {
protected CompileModulesBatchTestClassGroup(
JSONObject jsonObject, PortalTestClassJob portalTestClassJob) {
super(jsonObject, portalTestClassJob);
}
protected CompileModulesBatchTestClassGroup(
String batchName, PortalTestClassJob portalTestClassJob) {
super(batchName, portalTestClassJob);
}
@Override
protected void setTestClasses() throws IOException {
PortalGitWorkingDirectory portalGitWorkingDirectory =
getPortalGitWorkingDirectory();
List excludesPathMatchers = getPathMatchers(
getExcludesJobProperties());
List includesPathMatchers = getIncludesPathMatchers();
if (testRelevantChanges &&
!(includeStableTestSuite && isStableTestSuiteBatch())) {
List modifiedModuleDirsList =
portalGitWorkingDirectory.getModifiedModuleDirsList(
excludesPathMatchers, includesPathMatchers);
for (File modifiedModuleDir : modifiedModuleDirsList) {
List lfrBuildPortalFiles =
JenkinsResultsParserUtil.findFiles(
modifiedModuleDir, "\\.lfrbuild-portal");
if (!lfrBuildPortalFiles.isEmpty()) {
moduleDirsList.add(modifiedModuleDir);
}
}
}
else {
moduleDirsList.addAll(
portalGitWorkingDirectory.getModuleDirsList(
excludesPathMatchers, includesPathMatchers));
}
for (File moduleDir : moduleDirsList) {
TestClass testClass = TestClassFactory.newTestClass(
this, moduleDir);
if (!testClass.hasTestClassMethods()) {
continue;
}
testClasses.add(testClass);
}
Collections.sort(testClasses);
}
}