Skip to content

Commit 5b85fdc

Browse files
committed
Fix integration tests
And also update the test to use pmd/7.0.x and error recovery
1 parent 21047b9 commit 5b85fdc

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

test/integration_test_pmd_report_builder.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ def setup
1010
end
1111

1212
def test_build
13-
logger.level = Logger::INFO
14-
projects = ProjectsParser.new.parse('test/resources/project-test.xml')
15-
builder = PmdReportBuilder.new('config/design.xml', projects,
16-
'target/repositories/pmd', 'pmd_releases/6.7.0')
13+
argv = %w[-r target/repositories/pmd -b master -p origin/pmd/7.0.x
14+
-c test/resources/pmd7-config.xml -l test/resources/project-test.xml
15+
--error-recovery --debug]
16+
options = PmdTester::Options.new(argv)
17+
projects = ProjectsParser.new.parse(options.project_list)
18+
19+
builder = PmdReportBuilder.new(projects, options, options.config, options.patch_branch)
1720
builder.build
1821

1922
assert_equal(0, $CHILD_STATUS.exitstatus)
23+
assert_path_exist('target/reports/origin_pmd_7.0.x/checkstyle/pmd_report.xml')
2024
end
2125
end

test/resources/pmd7-config.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
3+
<ruleset name="Java Rules for PMD7 integration test"
4+
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
7+
<description>Java Rules for PMD7 integration test</description>
8+
9+
<rule ref="category/java/bestpractices.xml/MissingOverride"/>
10+
<rule ref="category/java/bestpractices.xml/UnusedAssignment"/>
11+
</ruleset>

test/resources/project-test.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ xsi:noNamespaceSchemaLocation="projectlist_1_1_0.xsd">
99
<type>git</type>
1010
<connection>https://github.com/checkstyle/checkstyle</connection>
1111
<tag>checkstyle-8.0</tag>
12-
<exclude-pattern>.*/src/test/resources-noncompilable/.*</exclude-pattern>
13-
<exclude-pattern>.*/src/test/resources/.*</exclude-pattern>
12+
<exclude-pattern>.*/target/test-classes/com/puppycrawl/tools/checkstyle/.*</exclude-pattern>
13+
<exclude-pattern>.*/target/generated-sources/.*</exclude-pattern>
1414

1515
<build-command><![CDATA[#!/usr/bin/env bash
1616
if test -e classpath.txt; then
@@ -23,6 +23,7 @@ mvn dependency:build-classpath -DincludeScope=test -Dmdep.outputFile=classpath.t
2323
<auxclasspath-command>echo -n "$(pwd)/target/classes:$(pwd)/target/test-classes:"; cat classpath.txt</auxclasspath-command>
2424
</project>
2525

26+
<!-- this project configuration is here, so that PMD's repo is cloned into target/repositories for integration tests -->
2627
<project>
2728
<name>pmd</name>
2829
<type>git</type>

0 commit comments

Comments
 (0)