From 1e831fc7893ae8137725d188b755921d759cdfa2 Mon Sep 17 00:00:00 2001 From: Erik Rehm Date: Fri, 1 Sep 2023 11:04:43 +0200 Subject: [PATCH 1/7] Resolve SE_NO_SERIALVERSIONID issues (#64) --- config/spotbugs/spotbugs-exclude.xml | 4 ++++ .../jenkins/plugins/ecutestexecution/ETInstallation.groovy | 2 +- .../ecutestexecution/builder/AbstractTestBuilder.groovy | 3 +++ .../ecutestexecution/builder/ExecutionOrderBuilder.groovy | 2 ++ .../ecutestexecution/builder/TestPackageBuilder.groovy | 2 ++ .../ecutestexecution/builder/TestProjectBuilder.groovy | 3 +++ .../plugins/ecutestexecution/scan/AbstractTestScanner.groovy | 3 +++ .../plugins/ecutestexecution/steps/GenerateReportsStep.groovy | 4 ++++ .../plugins/ecutestexecution/steps/RunPackageStep.groovy | 2 ++ .../plugins/ecutestexecution/steps/RunProjectStep.groovy | 2 ++ .../plugins/ecutestexecution/steps/RunTestFolderStep.groovy | 2 ++ .../plugins/ecutestexecution/steps/StartToolStep.groovy | 2 ++ .../plugins/ecutestexecution/steps/StopToolStep.groovy | 4 ++++ .../plugins/ecutestexecution/steps/UploadReportsStep.groovy | 4 ++++ 14 files changed, 38 insertions(+), 1 deletion(-) diff --git a/config/spotbugs/spotbugs-exclude.xml b/config/spotbugs/spotbugs-exclude.xml index 418d779d..ca23aad8 100644 --- a/config/spotbugs/spotbugs-exclude.xml +++ b/config/spotbugs/spotbugs-exclude.xml @@ -6,4 +6,8 @@ + + + + diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/ETInstallation.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/ETInstallation.groovy index 383a6142..63ff27b9 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/ETInstallation.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/ETInstallation.groovy @@ -47,7 +47,7 @@ class ETInstallation extends ToolInstallation implements * @param home path to the tool executable * @param properties properties of the tool installation */ - ETInstallation(String name, String home, List> properties) { + ETInstallation(String name, String home, List> properties) { super(Util.fixEmptyAndTrim(name), Util.fixEmptyAndTrim(home), properties) } diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy index 165b2d6b..851eac73 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy @@ -73,6 +73,9 @@ abstract class AbstractTestBuilder implements Serializable { } private static final class RunTestCallable extends MasterToSlaveCallable { + + private static final long serialVersionUID = 1L + private final String testCasePath private final EnvVars envVars private final TaskListener listener diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/ExecutionOrderBuilder.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/ExecutionOrderBuilder.groovy index b1e4b05d..911449eb 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/ExecutionOrderBuilder.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/ExecutionOrderBuilder.groovy @@ -14,6 +14,8 @@ import de.tracetronic.jenkins.plugins.ecutestexecution.util.ConverterUtil * thus avoid serialization errors. */ class ExecutionOrderBuilder implements Serializable { + + private static final long serialVersionUID = 1L private final String testCasePath private final TestConfig testConfig diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilder.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilder.groovy index 13642aaf..d69ddf3e 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilder.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilder.groovy @@ -12,6 +12,8 @@ import org.jenkinsci.plugins.workflow.steps.StepContext * builder providing test package configuration. */ class TestPackageBuilder extends AbstractTestBuilder { + private static final long serialVersionUID = 1L + /** * Defines the test artifact name. */ diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestProjectBuilder.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestProjectBuilder.groovy index d701ee6d..2e985ffc 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestProjectBuilder.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestProjectBuilder.groovy @@ -10,6 +10,9 @@ import org.jenkinsci.plugins.workflow.steps.StepContext * builder providing test project configuration. */ class TestProjectBuilder extends AbstractTestBuilder { + + private static final long serialVersionUID = 1L + /** * Defines the test artifact name. */ diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/scan/AbstractTestScanner.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/scan/AbstractTestScanner.groovy index 2cc3dacb..c84627be 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/scan/AbstractTestScanner.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/scan/AbstractTestScanner.groovy @@ -56,6 +56,9 @@ abstract class AbstractTestScanner { * {@link hudson.remoting.Callable} providing remote access to scan a directory with a include file pattern. */ private static final class ScanTestCallable extends MasterToSlaveCallable, IOException> { + + private static final long serialVersionUID = 1L + private final String inputDir private final filePattern diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/GenerateReportsStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/GenerateReportsStep.groovy index b5504231..7d6b8a5a 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/GenerateReportsStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/GenerateReportsStep.groovy @@ -85,6 +85,8 @@ class GenerateReportsStep extends Step { static class Execution extends SynchronousNonBlockingStepExecution { + private static final long serialVersionUID = 1L + private final transient GenerateReportsStep step Execution(GenerateReportsStep step, StepContext context) { @@ -104,6 +106,8 @@ class GenerateReportsStep extends Step { } private static final class ExecutionCallable extends MasterToSlaveCallable { + + private static final long serialVersionUID = 1L private final String generatorName private final Map additionalSettings diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStep.groovy index 1f27bb45..83b68b2d 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStep.groovy @@ -75,6 +75,8 @@ class RunPackageStep extends RunTestStep { } static class Execution extends SynchronousNonBlockingStepExecution { + + private static final long serialVersionUID = 1L private final transient RunPackageStep step diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunProjectStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunProjectStep.groovy index b8516c74..b235774b 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunProjectStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunProjectStep.groovy @@ -43,6 +43,8 @@ class RunProjectStep extends RunTestStep { static class Execution extends SynchronousNonBlockingStepExecution { + private static final long serialVersionUID = 1L + private final transient RunProjectStep step Execution(RunProjectStep step, StepContext context) { diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestFolderStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestFolderStep.groovy index 4bcf1758..439da558 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestFolderStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestFolderStep.groovy @@ -113,6 +113,8 @@ class RunTestFolderStep extends RunTestStep { static class Execution extends SynchronousNonBlockingStepExecution> { + private static final long serialVersionUID = 1L + private final transient RunTestFolderStep step Execution(RunTestFolderStep step, StepContext context) { diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/StartToolStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/StartToolStep.groovy index 7081ecda..4c6830b1 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/StartToolStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/StartToolStep.groovy @@ -187,6 +187,8 @@ class StartToolStep extends Step { private static final class ExecutionCallable extends MasterToSlaveCallable { + private static final long serialVersionUID = 1L + private final ETInstallation installation private final String workspaceDir private final String settingsDir diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/StopToolStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/StopToolStep.groovy index 97519719..bf96beb4 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/StopToolStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/StopToolStep.groovy @@ -77,6 +77,8 @@ class StopToolStep extends Step { static class Execution extends SynchronousNonBlockingStepExecution { + private static final long serialVersionUID = 1L + private final transient StopToolStep step Execution(StopToolStep step, StepContext context) { @@ -117,6 +119,8 @@ class StopToolStep extends Step { private static final class ExecutionCallable extends MasterToSlaveCallable { + private static final long serialVersionUID = 1L + private final ETInstallation installation private final int timeout private final boolean stopUndefinedTools diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/UploadReportsStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/UploadReportsStep.groovy index b3b9e0d9..b93dbe10 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/UploadReportsStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/UploadReportsStep.groovy @@ -134,6 +134,8 @@ class UploadReportsStep extends Step { static class Execution extends SynchronousNonBlockingStepExecution { + private static final long serialVersionUID = 1L + private final transient UploadReportsStep step Execution(UploadReportsStep step, StepContext context) { @@ -167,6 +169,8 @@ class UploadReportsStep extends Step { private static final class ExecutionCallable extends MasterToSlaveCallable { + private static final long serialVersionUID = 1L + private final String testGuideUrl private final String authKey private final int projectId From 479b6b23a6f4b901ede6ba3e9f173a7f507f4995 Mon Sep 17 00:00:00 2001 From: Erik Rehm Date: Fri, 1 Sep 2023 16:27:48 +0200 Subject: [PATCH 2/7] Fix all EI_EXPOSE_REP findings (#64) --- config/spotbugs/spotbugs-exclude.xml | 4 ++++ .../ecutestexecution/actions/RunPackageAction.groovy | 4 ++-- .../ecutestexecution/actions/RunTestAction.groovy | 4 ++-- .../ecutestexecution/configs/AnalysisConfig.groovy | 8 +++++++- .../ecutestexecution/configs/ExecutionConfig.groovy | 7 +++++++ .../ecutestexecution/configs/PackageConfig.groovy | 8 ++++++-- .../plugins/ecutestexecution/configs/TestConfig.groovy | 9 ++++++++- .../ecutestexecution/model/AdditionalSetting.groovy | 5 +++++ .../plugins/ecutestexecution/model/Constant.groovy | 5 +++++ .../ecutestexecution/model/PackageParameter.groovy | 5 +++++ .../ecutestexecution/model/RecordingAsSetting.groovy | 10 +++++++++- .../plugins/ecutestexecution/model/TestResult.groovy | 6 ++++++ .../ecutestexecution/steps/GenerateReportsStep.groovy | 4 ++-- .../ecutestexecution/steps/RunPackageStep.groovy | 4 ++-- .../ecutestexecution/steps/RunTestFolderStep.groovy | 6 +++--- .../plugins/ecutestexecution/steps/RunTestStep.groovy | 4 ++-- .../ecutestexecution/steps/UploadReportsStep.groovy | 4 ++-- 17 files changed, 77 insertions(+), 20 deletions(-) diff --git a/config/spotbugs/spotbugs-exclude.xml b/config/spotbugs/spotbugs-exclude.xml index ca23aad8..6ea818d8 100644 --- a/config/spotbugs/spotbugs-exclude.xml +++ b/config/spotbugs/spotbugs-exclude.xml @@ -10,4 +10,8 @@ + + + + diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/actions/RunPackageAction.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/actions/RunPackageAction.groovy index bc777315..3a0031ae 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/actions/RunPackageAction.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/actions/RunPackageAction.groovy @@ -23,10 +23,10 @@ class RunPackageAction extends RunTestAction { } PackageConfig getPackageConfig() { - return packageConfig + return new PackageConfig(packageConfig) } AnalysisConfig getAnalysisConfig() { - return analysisConfig + return new AnalysisConfig(analysisConfig) } } diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/actions/RunTestAction.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/actions/RunTestAction.groovy index d59703fe..e32805c5 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/actions/RunTestAction.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/actions/RunTestAction.groovy @@ -26,10 +26,10 @@ abstract class RunTestAction extends InvisibleAction { } TestConfig getTestConfig() { - return testConfig + return new TestConfig(testConfig) } TestResult getTestResult() { - return testResult + return new TestResult(testResult) } } diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/AnalysisConfig.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/AnalysisConfig.groovy index 40ce0f64..82b5869a 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/AnalysisConfig.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/AnalysisConfig.groovy @@ -33,6 +33,12 @@ class AnalysisConfig extends AbstractDescribableImpl implements this.recordings = [] } + AnalysisConfig(AnalysisConfig config) { + this.analysisName = config.getAnalysisName() + this.mapping = config.getMapping() + this.recordings = config.getRecordings() + } + String getAnalysisName() { return analysisName } @@ -52,7 +58,7 @@ class AnalysisConfig extends AbstractDescribableImpl implements } List getRecordings() { - return recordings + return recordings.collect({new RecordingAsSetting(it)}) } @DataBoundSetter diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/ExecutionConfig.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/ExecutionConfig.groovy index 310b1db7..f5b05a5e 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/ExecutionConfig.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/ExecutionConfig.groovy @@ -10,6 +10,7 @@ import hudson.Extension import hudson.model.AbstractDescribableImpl import hudson.model.Descriptor import hudson.util.FormValidation +import org.apache.tools.ant.taskdefs.Exec import org.kohsuke.stapler.DataBoundConstructor import org.kohsuke.stapler.DataBoundSetter import org.kohsuke.stapler.QueryParameter @@ -32,6 +33,12 @@ class ExecutionConfig extends AbstractDescribableImpl implement this.stopUndefinedTools = true } + ExecutionConfig(ExecutionConfig config) { + this.timeout = config.getTimeout() + this.stopOnError = config.isStopOnError() + this.stopUndefinedTools = config.getStopUndefinedTools() + } + int getTimeout() { return timeout } diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/PackageConfig.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/PackageConfig.groovy index b85d36ce..9231767c 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/PackageConfig.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/PackageConfig.groovy @@ -13,7 +13,7 @@ import hudson.model.Descriptor import org.apache.commons.lang.StringUtils import org.kohsuke.stapler.DataBoundConstructor -class PackageConfig extends AbstractDescribableImpl implements ExpandableConfig, Serializable { +class PackageConfig extends AbstractDescribableImpl implements ExpandableConfig, Serializable{ private static final long serialVersionUID = 1L @@ -24,8 +24,12 @@ class PackageConfig extends AbstractDescribableImpl implements Ex this.packageParameters = packageParameters ? removeEmptyParameters(packageParameters) : [] } + PackageConfig(PackageConfig config) { + this.packageParameters = config.getPackageParameters() + } + List getPackageParameters() { - return packageParameters + return packageParameters.collect({new PackageParameter(it)}) } @Override diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/TestConfig.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/TestConfig.groovy index 5b2e508e..f0155ce7 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/TestConfig.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/TestConfig.groovy @@ -34,6 +34,13 @@ class TestConfig extends AbstractDescribableImpl implements Expandab this.constants = [] } + TestConfig(TestConfig config) { + this.tbcPath = config.getTbcPath() + this.tcfPath = config.getTcfPath() + this.constants = config.getConstants() + this.forceConfigurationReload = config.forceConfigurationReload + } + String getTbcPath() { return tbcPath } @@ -62,7 +69,7 @@ class TestConfig extends AbstractDescribableImpl implements Expandab } List getConstants() { - return constants + return constants.collect({new Constant(it)}) } @DataBoundSetter diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/AdditionalSetting.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/AdditionalSetting.groovy index 8491f5e1..071eb011 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/AdditionalSetting.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/AdditionalSetting.groovy @@ -29,6 +29,11 @@ class AdditionalSetting extends AbstractDescribableImpl imple this.value = StringUtils.trimToEmpty(value) } + AdditionalSetting(AdditionalSetting setting) { + this.name = setting.getName() + this.value = setting.getValue() + } + String getName() { return name } diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/Constant.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/Constant.groovy index 7361c32e..df015046 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/Constant.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/Constant.groovy @@ -29,6 +29,11 @@ class Constant extends AbstractDescribableImpl implements ExpandableCo this.value = StringUtils.trimToEmpty(value) } + Constant(Constant constant) { + this.label = constant.getLabel() + this.value = constant.getValue() + } + String getLabel() { return label } diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/PackageParameter.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/PackageParameter.groovy index 5f3ef53e..dd5b1c04 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/PackageParameter.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/PackageParameter.groovy @@ -29,6 +29,11 @@ class PackageParameter extends AbstractDescribableImpl impleme this.value = StringUtils.trimToEmpty(value) } + PackageParameter(PackageParameter param) { + this.label = param.getLabel() + this.value = param.getValue() + } + String getLabel() { return label } diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/RecordingAsSetting.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/RecordingAsSetting.groovy index dc0669d5..d0387fa6 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/RecordingAsSetting.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/RecordingAsSetting.groovy @@ -37,6 +37,14 @@ class RecordingAsSetting extends AbstractDescribableImpl imp this.formatDetails = '' } + RecordingAsSetting(RecordingAsSetting setting) { + this.path = setting.getPath() + this.recordingGroup = setting.getRecordingGroup() + this.mappingNames = setting.getMappingNames() + this.deviceName = setting.getDeviceName() + this.formatDetails = setting.getFormatDetails() + } + String getPath() { return path } @@ -51,7 +59,7 @@ class RecordingAsSetting extends AbstractDescribableImpl imp } List getMappingNames() { - return mappingNames + return mappingNames.collect() } @DataBoundSetter diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/TestResult.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/TestResult.groovy index 63a2119b..2129de9f 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/TestResult.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/model/TestResult.groovy @@ -21,6 +21,12 @@ class TestResult implements Serializable { this.reportDir = reportDir } + TestResult(TestResult result) { + this.reportId = result.getReportId() + this.reportDir = result.getReportDir() + this.testResult = result.getTestResult() + } + @Whitelisted String getReportId() { return reportId diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/GenerateReportsStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/GenerateReportsStep.groovy index 7d6b8a5a..0f0a09e4 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/GenerateReportsStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/GenerateReportsStep.groovy @@ -45,7 +45,7 @@ class GenerateReportsStep extends Step { } List getAdditionalSettings() { - return additionalSettings + return additionalSettings.collect({new AdditionalSetting(it)}) } @DataBoundSetter @@ -54,7 +54,7 @@ class GenerateReportsStep extends Step { } List getReportIds() { - return reportIds + return reportIds.collect() } @DataBoundSetter diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStep.groovy index 83b68b2d..fd3e98c1 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStep.groovy @@ -51,7 +51,7 @@ class RunPackageStep extends RunTestStep { @Nonnull PackageConfig getPackageConfig() { - return packageConfig + return new PackageConfig(packageConfig) } @DataBoundSetter @@ -61,7 +61,7 @@ class RunPackageStep extends RunTestStep { @Nonnull AnalysisConfig getAnalysisConfig() { - return analysisConfig + return new AnalysisConfig(analysisConfig) } @DataBoundSetter diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestFolderStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestFolderStep.groovy index 439da558..b589284c 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestFolderStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestFolderStep.groovy @@ -60,7 +60,7 @@ class RunTestFolderStep extends RunTestStep { @Nonnull ScanMode getScanMode() { - return scanMode; + return scanMode.toString() as ScanMode } @DataBoundSetter @@ -88,7 +88,7 @@ class RunTestFolderStep extends RunTestStep { @Nonnull PackageConfig getPackageConfig() { - return packageConfig + return new PackageConfig(packageConfig) } @DataBoundSetter @@ -98,7 +98,7 @@ class RunTestFolderStep extends RunTestStep { @Nonnull AnalysisConfig getAnalysisConfig() { - return analysisConfig + return new AnalysisConfig(analysisConfig) } @DataBoundSetter diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestStep.groovy index 497709fb..566034e6 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunTestStep.groovy @@ -36,7 +36,7 @@ abstract class RunTestStep extends Step { @Nonnull TestConfig getTestConfig() { - return testConfig + return new TestConfig(testConfig) } @DataBoundSetter @@ -46,7 +46,7 @@ abstract class RunTestStep extends Step { @Nonnull ExecutionConfig getExecutionConfig() { - return executionConfig + return new ExecutionConfig(executionConfig) } @DataBoundSetter diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/UploadReportsStep.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/UploadReportsStep.groovy index b93dbe10..0c499d59 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/UploadReportsStep.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/UploadReportsStep.groovy @@ -94,7 +94,7 @@ class UploadReportsStep extends Step { } List getAdditionalSettings() { - return additionalSettings + return additionalSettings.collect({new AdditionalSetting(it)}) } @DataBoundSetter @@ -103,7 +103,7 @@ class UploadReportsStep extends Step { } List getReportIds() { - return reportIds + return reportIds.collect() } @DataBoundSetter From 04756e6eec327d9aeac791d52ed3b75f7a0f00ed Mon Sep 17 00:00:00 2001 From: Erik Rehm Date: Mon, 4 Sep 2023 15:10:22 +0200 Subject: [PATCH 3/7] Ignore EI2 for closures (#64) --- config/spotbugs/spotbugs-exclude.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/spotbugs/spotbugs-exclude.xml b/config/spotbugs/spotbugs-exclude.xml index 6ea818d8..43b0f379 100644 --- a/config/spotbugs/spotbugs-exclude.xml +++ b/config/spotbugs/spotbugs-exclude.xml @@ -14,4 +14,8 @@ + + + + From dd80a40a90f58a80ded120f007bd64f7319eaf3e Mon Sep 17 00:00:00 2001 From: Erik Rehm Date: Mon, 4 Sep 2023 16:03:50 +0200 Subject: [PATCH 4/7] Add when condition for system tests (#64) --- Jenkinsfile.internal | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile.internal b/Jenkinsfile.internal index de0bdeea..6589c1b0 100644 --- a/Jenkinsfile.internal +++ b/Jenkinsfile.internal @@ -34,6 +34,8 @@ pipeline { failFast false parallel { stage('System Tests') { + // The needed artifact is only built for main and pull requests -> skip this job otherwise + when { branch pattern: "PR-\\d+|main", comparator: "REGEXP"} steps { build job: '../systemTests', parameters: [string(name: 'artifactName', value: "${JOB_BASE_NAME}"), string(name: 'commitHash', value: "${GIT_COMMIT}")] } From 05871b105a4026b7ee70f13874e32b1876d2aa97 Mon Sep 17 00:00:00 2001 From: Erik Rehm Date: Mon, 4 Sep 2023 17:21:16 +0200 Subject: [PATCH 5/7] Fix MS_EXPOSE_REP issues (#64) --- config/spotbugs/spotbugs-exclude.xml | 5 +++++ .../builder/AbstractTestBuilder.groovy | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/config/spotbugs/spotbugs-exclude.xml b/config/spotbugs/spotbugs-exclude.xml index 43b0f379..d4d7d4c6 100644 --- a/config/spotbugs/spotbugs-exclude.xml +++ b/config/spotbugs/spotbugs-exclude.xml @@ -18,4 +18,9 @@ + + + + + diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy index 851eac73..37a4138b 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy @@ -43,6 +43,22 @@ abstract class AbstractTestBuilder implements Serializable { this.context = context } + static ExecutionConfig getExecutionConfig() { + return executionConfig? new ExecutionConfig(executionConfig) : null + } + + static void setExecutionConfig(ExecutionConfig config) { + executionConfig = config? new ExecutionConfig(config) : null + } + + static TestConfig getTestConfig() { + return testConfig? new TestConfig(testConfig) : null + } + + static void setTestConfig(TestConfig config) { + testConfig = config? new TestConfig(config) : null + } + TestResult runTest() { def toolInstallations = getToolInstallationsOnNode() From b07bbd2450336c17400e02ac9759e9f969e94f3f Mon Sep 17 00:00:00 2001 From: Erik Rehm Date: Tue, 5 Sep 2023 10:08:29 +0200 Subject: [PATCH 6/7] Fix remaining spotbugs findings (#64) --- config/spotbugs/spotbugs-exclude.xml | 2 +- .../builder/AbstractTestBuilder.groovy | 22 ++++++----------- .../builder/TestPackageBuilder.groovy | 4 ++-- .../builder/TestPackageBuilderTest.groovy | 24 +++++++++---------- .../builder/TestProjectBuilderTest.groovy | 24 +++++++++---------- 5 files changed, 34 insertions(+), 42 deletions(-) diff --git a/config/spotbugs/spotbugs-exclude.xml b/config/spotbugs/spotbugs-exclude.xml index d4d7d4c6..fee606c4 100644 --- a/config/spotbugs/spotbugs-exclude.xml +++ b/config/spotbugs/spotbugs-exclude.xml @@ -21,6 +21,6 @@ - + diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy index 37a4138b..8d8b25bd 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy @@ -25,10 +25,10 @@ import java.util.concurrent.TimeoutException * Common base class for all test related steps implemented in this plugin. */ abstract class AbstractTestBuilder implements Serializable { - static String testCasePath - static TestConfig testConfig - static ExecutionConfig executionConfig - static StepContext context + final String testCasePath + final TestConfig testConfig + final ExecutionConfig executionConfig + final StepContext context protected abstract String getTestArtifactName() protected abstract LogConfigUtil getLogConfig() @@ -43,22 +43,14 @@ abstract class AbstractTestBuilder implements Serializable { this.context = context } - static ExecutionConfig getExecutionConfig() { + ExecutionConfig getExecutionConfig() { return executionConfig? new ExecutionConfig(executionConfig) : null } - static void setExecutionConfig(ExecutionConfig config) { - executionConfig = config? new ExecutionConfig(config) : null - } - - static TestConfig getTestConfig() { + TestConfig getTestConfig() { return testConfig? new TestConfig(testConfig) : null } - static void setTestConfig(TestConfig config) { - testConfig = config? new TestConfig(config) : null - } - TestResult runTest() { def toolInstallations = getToolInstallationsOnNode() @@ -68,7 +60,7 @@ abstract class AbstractTestBuilder implements Serializable { getTestArtifactName(), getLogConfig(), getExecutionOrderBuilder(), toolInstallations)) } - private static ArrayList getToolInstallationsOnNode() { + private ArrayList getToolInstallationsOnNode() { /** * This method gets the executable names of the tool installations on the node given by the context. Context is * not reasonably available in the MasterToSlaveCallable, so all info which needs a context must be fetched diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilder.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilder.groovy index d69ddf3e..5419f3d1 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilder.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilder.groovy @@ -18,8 +18,8 @@ class TestPackageBuilder extends AbstractTestBuilder { * Defines the test artifact name. */ private final static String TEST_ARTIFACT_NAME = 'package' - private static PackageConfig packageConfig - private static AnalysisConfig analysisConfig + private final PackageConfig packageConfig + private final AnalysisConfig analysisConfig TestPackageBuilder(String testCasePath, TestConfig testConfig, ExecutionConfig executionConfig, StepContext context, PackageConfig packageConfig, AnalysisConfig analysisConfig){ diff --git a/src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilderTest.groovy b/src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilderTest.groovy index 45cb8bc3..2214c63e 100644 --- a/src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilderTest.groovy +++ b/src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestPackageBuilderTest.groovy @@ -20,13 +20,13 @@ class TestPackageBuilderTest extends Specification { def 'Test Null Values'() { given: - new TestPackageBuilder(null, null, null, null, null, null) + def tpb = new TestPackageBuilder(null, null, null, null, null, null) expect: - TestPackageBuilder.testCasePath == null - TestPackageBuilder.testConfig == null - TestPackageBuilder.executionConfig == null - TestPackageBuilder.context == null + tpb.testCasePath == null + tpb.testConfig == null + tpb.executionConfig == null + tpb.context == null } def 'Test Default Values'() { @@ -37,7 +37,7 @@ class TestPackageBuilderTest extends Specification { final ExecutionConfig executionConfig = new ExecutionConfig() final PackageConfig packageConfig = new PackageConfig(null) final AnalysisConfig analysisConfig = new AnalysisConfig() - new TestPackageBuilder(testCasePath, testConfig, + def tpb = new TestPackageBuilder(testCasePath, testConfig, executionConfig, context, packageConfig, analysisConfig) when: @@ -46,15 +46,15 @@ class TestPackageBuilderTest extends Specification { ExecutionOrder order = executionOrderBuilder.build() then: - assertBuilder() + assertBuilder(tpb) assertExecutionOrder(order) } - void assertBuilder() { - assert TestPackageBuilder.testCasePath == 'testFile' - assert TestPackageBuilder.testConfig != null - assert TestPackageBuilder.executionConfig != null - assert TestPackageBuilder.context != null + void assertBuilder(TestPackageBuilder tpb) { + assert tpb.testCasePath == 'testFile' + assert tpb.testConfig != null + assert tpb.executionConfig != null + assert tpb.context != null } void assertExecutionOrder(ExecutionOrder order) { diff --git a/src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestProjectBuilderTest.groovy b/src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestProjectBuilderTest.groovy index 593c58d9..360f79f4 100644 --- a/src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestProjectBuilderTest.groovy +++ b/src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/TestProjectBuilderTest.groovy @@ -18,13 +18,13 @@ class TestProjectBuilderTest extends Specification { def 'Test Null Values'() { given: - new TestProjectBuilder(null, null, null, null) + def tpb = new TestProjectBuilder(null, null, null, null) expect: - TestProjectBuilder.testCasePath == null - TestProjectBuilder.testConfig == null - TestProjectBuilder.executionConfig == null - TestProjectBuilder.context == null + tpb.testCasePath == null + tpb.testConfig == null + tpb.executionConfig == null + tpb.context == null } def 'Test Default Values'() { @@ -33,7 +33,7 @@ class TestProjectBuilderTest extends Specification { final String testCasePath = 'testFile' final TestConfig testConfig = new TestConfig() final ExecutionConfig executionConfig = new ExecutionConfig() - new TestProjectBuilder(testCasePath, testConfig, + def tpb = new TestProjectBuilder(testCasePath, testConfig, executionConfig, context) when: @@ -41,15 +41,15 @@ class TestProjectBuilderTest extends Specification { ExecutionOrder order = executionOrderBuilder.build() then: - assertBuilder() + assertBuilder(tpb) assertExecutionOrder(order) } - void assertBuilder() { - assert TestProjectBuilder.testCasePath == 'testFile' - assert TestProjectBuilder.testConfig != null - assert TestProjectBuilder.executionConfig != null - assert TestProjectBuilder.context != null + void assertBuilder(TestProjectBuilder tpb) { + assert tpb.testCasePath == 'testFile' + assert tpb.testConfig != null + assert tpb.executionConfig != null + assert tpb.context != null } void assertExecutionOrder(ExecutionOrder order) { From f92317a0b22d732168e96f1a38a7dc5b56f41861 Mon Sep 17 00:00:00 2001 From: Erik Rehm Date: Thu, 7 Sep 2023 13:14:22 +0200 Subject: [PATCH 7/7] Apply review remarks (#64) --- gradle.properties | 2 +- .../ecutestexecution/builder/AbstractTestBuilder.groovy | 4 ++-- .../plugins/ecutestexecution/configs/ExecutionConfig.groovy | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4a336729..e17d25b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ jpiVersion=0.43.0 jenkinsVersion=2.332.3 gradleVersion=7.3 openapiVersion=6.1.0 -spotBugsPlugin=5.0.13 +spotBugsPlugin=5.1.3 spotBugsVersion=4.7.3 cyclonedxVersion=1.7.2 depCheckVersion=7.4.1 diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy index 8d8b25bd..463eb266 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/builder/AbstractTestBuilder.groovy @@ -44,11 +44,11 @@ abstract class AbstractTestBuilder implements Serializable { } ExecutionConfig getExecutionConfig() { - return executionConfig? new ExecutionConfig(executionConfig) : null + return executionConfig ? new ExecutionConfig(executionConfig) : null } TestConfig getTestConfig() { - return testConfig? new TestConfig(testConfig) : null + return testConfig ? new TestConfig(testConfig) : null } TestResult runTest() { diff --git a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/ExecutionConfig.groovy b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/ExecutionConfig.groovy index f5b05a5e..82ae063a 100644 --- a/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/ExecutionConfig.groovy +++ b/src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/ExecutionConfig.groovy @@ -10,7 +10,6 @@ import hudson.Extension import hudson.model.AbstractDescribableImpl import hudson.model.Descriptor import hudson.util.FormValidation -import org.apache.tools.ant.taskdefs.Exec import org.kohsuke.stapler.DataBoundConstructor import org.kohsuke.stapler.DataBoundSetter import org.kohsuke.stapler.QueryParameter