Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<pmd.version>7.15.0</pmd.version> <!-- pmd version used for tests -->
<surefire.version>3.5.3</surefire.version>
<junit.version>5.13.3</junit.version>
<checkstyle.plugin.version>3.6.0</checkstyle.plugin.version>
<checkstyle.version>10.26.1</checkstyle.version>

<central-publishing.waitMaxTime>10800</central-publishing.waitMaxTime> <!-- 10800s = 180min = 3h -->
</properties>
Expand Down Expand Up @@ -198,6 +200,35 @@
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Copy link
Contributor

@Pankraz76 Pankraz76 Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but no. Why is there no (SSOT) parent doing this like in maven?

Now we having this problem 2 times, in maintenance and replacing it with the next tool.

<version>${checkstyle.plugin.version}</version>
<executions>
<execution>
<id>checkstyle-check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<configuration>
<configLocation>${project.basedir}/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-config.xml</configLocation>
<suppressionsLocation>${project.basedir}/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-suppressions.xml</suppressionsLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<excludeGeneratedSources>true</excludeGeneratedSources>
<includes>**/*.java,**/*.kt</includes>
<resourceIncludes>**/*.properties,**/*.less</resourceIncludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down Expand Up @@ -271,6 +302,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<!-- configuration is in plugin management section -->
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AccumulatingConsoleReporter extends StatelessTestsetInfoConsoleReportEvent

private final boolean showSkippedTests;

public AccumulatingConsoleReporter(ConsoleLogger logger, boolean showSuccessfulTests, boolean showFailedTests, boolean showSkippedTests) {
AccumulatingConsoleReporter(ConsoleLogger logger, boolean showSuccessfulTests, boolean showFailedTests, boolean showSkippedTests) {
super(logger);
this.showSuccessfulTests = showSuccessfulTests;
this.showFailedTests = showFailedTests;
Expand Down Expand Up @@ -213,18 +213,20 @@ private static String getTestCaseName(WrappedReportEntry entry, String testSetNa
private static void accumulateTestSetStats(TestSetStats accumulated, Collection<WrappedReportEntry> reportEntries) {
for (WrappedReportEntry entry : reportEntries) {
switch (entry.getReportEntryType()) {
case SUCCESS:
accumulated.testSucceeded(entry);
break;
case SKIPPED:
accumulated.testSkipped(entry);
break;
case FAILURE:
accumulated.testFailure(entry);
break;
case ERROR:
accumulated.testError(entry);
break;
case SUCCESS:
accumulated.testSucceeded(entry);
break;
case SKIPPED:
accumulated.testSkipped(entry);
break;
case FAILURE:
accumulated.testFailure(entry);
break;
case ERROR:
accumulated.testError(entry);
break;
default:
throw new IllegalStateException("Unknown report entry type: " + entry.getReportEntryType());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/

package net.sourceforge.pmd.buildtools.surefire.junit;

import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/

package net.sourceforge.pmd.buildtools.surefire.junit;

import org.junit.platform.engine.UniqueId;
Expand All @@ -7,7 +11,7 @@ class RootContainer {
private final TestIdentifier testIdentifier;
private boolean hasTests = false;

public RootContainer(TestIdentifier testIdentifier) {
RootContainer(TestIdentifier testIdentifier) {
this.testIdentifier = testIdentifier;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/

package net.sourceforge.pmd.buildtools.surefire.junit;

import java.lang.management.ManagementFactory;
Expand Down Expand Up @@ -30,7 +34,7 @@ class TestExecutionListener implements org.junit.platform.launcher.TestExecution

private final TestReportListener<TestOutputReportEntry> testReportListener;

public TestExecutionListener(TestReportListener<TestOutputReportEntry> testReportListener) {
TestExecutionListener(TestReportListener<TestOutputReportEntry> testReportListener) {
this.testReportListener = testReportListener;
}

Expand Down Expand Up @@ -90,19 +94,21 @@ public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult

determineRootContainer(testIdentifier).ifPresent(RootContainer::markHasAtLeastOneTest);
switch (testExecutionResult.getStatus()) {
case SUCCESSFUL:
testReportListener.testSucceeded(reportEntry);
break;
case FAILED:
if (isAssertionError) {
testReportListener.testFailed(reportEntry);
} else {
testReportListener.testError(reportEntry);
}
break;
case ABORTED:
testReportListener.testAssumptionFailure(reportEntry);
break;
case SUCCESSFUL:
testReportListener.testSucceeded(reportEntry);
break;
case FAILED:
if (isAssertionError) {
testReportListener.testFailed(reportEntry);
} else {
testReportListener.testError(reportEntry);
}
break;
case ABORTED:
testReportListener.testAssumptionFailure(reportEntry);
break;
default:
throw new IllegalStateException("Unknown execution result status: " + testExecutionResult.getStatus());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class AccumulatingConsoleReporterTest {

private MockedConsoleLogger logger;
private AccumulatingConsoleReporter reporter;

@BeforeEach
void setup() {
logger = new MockedConsoleLogger();
Expand Down Expand Up @@ -172,13 +173,13 @@ void junitSuiteReport() {
reporter.testSetCompleted(testSuiteReport, EMPTY_STATS, EMPTY);

logger.assertInfo(
"Running net.sourceforge.pmd.test.Suite" + NL +
" Running net.sourceforge.pmd.test.Simple1" + NL +
" └─ ✘ testFailMethod" + NL +
" Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.122 s <<< FAILURE! -- in net.sourceforge.pmd.test.Simple1" + NL +
" Running net.sourceforge.pmd.test.Simple2" + NL +
" Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.124 s -- in net.sourceforge.pmd.test.Simple2" + NL +
"Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.371 s <<< FAILURE! -- in net.sourceforge.pmd.test.Suite" + NL
"Running net.sourceforge.pmd.test.Suite" + NL
+ " Running net.sourceforge.pmd.test.Simple1" + NL
+ " └─ ✘ testFailMethod" + NL
+ " Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.122 s <<< FAILURE! -- in net.sourceforge.pmd.test.Simple1" + NL
+ " Running net.sourceforge.pmd.test.Simple2" + NL
+ " Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.124 s -- in net.sourceforge.pmd.test.Simple2" + NL
+ "Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.371 s <<< FAILURE! -- in net.sourceforge.pmd.test.Suite" + NL
);
}

Expand All @@ -192,8 +193,8 @@ void failForEmptyTestSet() {
reporter.testSetCompleted(wrappedReportEntry, EMPTY_STATS, EMPTY);

logger.assertInfo(
"Running net.sourceforge.pmd.test.Simple" + NL +
"Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.123 s -- in net.sourceforge.pmd.test.Simple" + NL
"Running net.sourceforge.pmd.test.Simple" + NL
+ "Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.123 s -- in net.sourceforge.pmd.test.Simple" + NL
);
logger.assertError(
"No tests were executed! Test class: net.sourceforge.pmd.test.Simple" + NL
Expand All @@ -203,12 +204,15 @@ void failForEmptyTestSet() {
private SimpleReportEntry createTestSet(String className) {
return createTestSet(className, null);
}

private SimpleReportEntry createTestSet(String className, String sourceText) {
return new SimpleReportEntry(RunMode.NORMAL_RUN, testRunId++, className, sourceText, null, null);
}

private SimpleReportEntry createTestCase(SimpleReportEntry testSet, String methodName) {
return new SimpleReportEntry(RunMode.NORMAL_RUN, testRunId++, testSet.getSourceName(), null, methodName, null);
}

private SimpleReportEntry createTestCaseKotest(SimpleReportEntry testSet, String sourceText) {
return new SimpleReportEntry(RunMode.NORMAL_RUN, testRunId++, testSet.getSourceName(), sourceText, null, null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/

package net.sourceforge.pmd.buildtools.surefire;

import static org.hamcrest.MatcherAssert.assertThat;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/

package net.sourceforge.pmd.buildtools.surefire.junit;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -297,28 +301,28 @@ private static class MyTestDescriptor implements TestDescriptor {
private final UniqueId uniqueId;
private final TestSource source;

public MyTestDescriptor(String testClass) {
MyTestDescriptor(String testClass) {
this.testClass = testClass;
this.type = Type.CONTAINER;
this.uniqueId = UniqueId.forEngine("jupiter").append("class", testClass);
this.source = ClassSource.from(testClass);
}

public MyTestDescriptor(UniqueId uniqueId, String testClass) {
MyTestDescriptor(UniqueId uniqueId, String testClass) {
this.testClass = testClass;
this.type = Type.CONTAINER;
this.uniqueId = uniqueId;
this.source = ClassSource.from(testClass);
}

public MyTestDescriptor(String testClass, String testMethod) {
MyTestDescriptor(String testClass, String testMethod) {
this.testClass = testClass;
this.type = Type.TEST;
this.uniqueId = UniqueId.forEngine("jupiter").append("class", testClass).append("method", testMethod);
this.source = MethodSource.from(testClass, testMethod);
}

public MyTestDescriptor(String testClass, String[] testMethods, boolean isTest) {
MyTestDescriptor(String testClass, String[] testMethods, boolean isTest) {
this.testClass = testClass;
this.type = isTest ? Type.TEST : Type.CONTAINER;
UniqueId uniqueId = UniqueId.forEngine("jupiter").append("class", testClass);
Expand Down