forked from phoedos/pmd
Merge branch 'pmd7-lang-registry-non-static' into pmd7-language-lifecycle
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<java.version>8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--
|
||||
hamcrest and junit are scope compile,
|
||||
@@ -37,6 +41,10 @@
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-test-schema</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,7 @@ import org.junit.Ignore;
|
||||
|
||||
import net.sourceforge.pmd.Rule;
|
||||
import net.sourceforge.pmd.lang.LanguageVersion;
|
||||
import net.sourceforge.pmd.test.schema.RuleTestDescriptor;
|
||||
|
||||
/**
|
||||
* Stores the information required to run a complete test.
|
||||
@@ -44,7 +45,7 @@ public class TestDescriptor {
|
||||
}
|
||||
|
||||
public TestDescriptor(String code, String description, int numberOfProblemsExpected, Rule rule,
|
||||
LanguageVersion languageVersion) {
|
||||
LanguageVersion languageVersion) {
|
||||
this.rule = rule;
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
@@ -52,6 +53,22 @@ public class TestDescriptor {
|
||||
this.languageVersion = languageVersion;
|
||||
}
|
||||
|
||||
// for compatibility
|
||||
TestDescriptor(RuleTestDescriptor td, String absoluteUriToTestXmlFile, int lineNumber) {
|
||||
this.rule = td.getRule();
|
||||
this.code = td.getCode();
|
||||
this.description = td.getDescription();
|
||||
this.numberOfProblemsExpected = td.getExpectedProblems();
|
||||
this.expectedLineNumbers = td.getExpectedLineNumbers();
|
||||
this.expectedMessages = td.getExpectedMessages();
|
||||
this.isRegressionTest = !td.isDisabled();
|
||||
this.numberInDocument = td.getIndex();
|
||||
this.properties = td.getProperties();
|
||||
this.languageVersion = td.getLanguageVersion();
|
||||
this.numberInDocument = td.getIndex();
|
||||
this.setTestSourceUri(absoluteUriToTestXmlFile, lineNumber);
|
||||
}
|
||||
|
||||
public int getNumberInDocument() {
|
||||
return numberInDocument;
|
||||
}
|
||||
|
@@ -1,69 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schema
|
||||
xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://pmd.sourceforge.net/rule-tests"
|
||||
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
|
||||
elementFormDefault="qualified">
|
||||
xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
|
||||
targetNamespace="http://pmd.sourceforge.net/rule-tests"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<element name="test-data">
|
||||
<complexType>
|
||||
<group ref="tns:testCodeOrCodeFragment" minOccurs="1" maxOccurs="unbounded"></group>
|
||||
<choice maxOccurs="unbounded">
|
||||
<element name="test-code" minOccurs="0" maxOccurs="unbounded" type="tns:testType"/>
|
||||
<element name="code-fragment" minOccurs="0" maxOccurs="unbounded" type="tns:codeFragmentType">
|
||||
<annotation>
|
||||
<documentation>
|
||||
A code fragment that can be referred to by several tests.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</element>
|
||||
</choice>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<group name="testCodeOrCodeFragment">
|
||||
<complexType name="testType">
|
||||
<sequence>
|
||||
<element name="test-code" minOccurs="0" maxOccurs="unbounded" type="tns:testCodeType"></element>
|
||||
<element name="code-fragment" minOccurs="0" maxOccurs="unbounded" type="tns:codeFragmentType"></element>
|
||||
</sequence>
|
||||
</group>
|
||||
|
||||
<complexType name="testCodeType">
|
||||
<sequence>
|
||||
<element name="description" type="string"></element>
|
||||
<element name="description" type="string"/>
|
||||
<element name="rule-property" minOccurs="0" maxOccurs="unbounded">
|
||||
<complexType>
|
||||
<simpleContent>
|
||||
<extension base="string">
|
||||
<attribute name="name" type="string" use="required"></attribute>
|
||||
<attribute name="name" type="string" use="required"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
</element>
|
||||
<element name="expected-problems" type="integer"></element>
|
||||
<element name="expected-linenumbers" type="string" minOccurs="0"></element>
|
||||
|
||||
<element name="expected-problems" type="nonNegativeInteger"/>
|
||||
<element name="expected-linenumbers" type="string" minOccurs="0"/>
|
||||
<element name="expected-messages" minOccurs="0">
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element name="message" type="string" maxOccurs="unbounded"></element>
|
||||
<element name="message" type="string" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
</element>
|
||||
<choice>
|
||||
<element name="code"></element>
|
||||
<element name="code" type="string"/>
|
||||
<element name="code-ref">
|
||||
<complexType>
|
||||
<attribute name="id" type="IDREF" use="required"></attribute>
|
||||
<attribute name="id" type="IDREF" use="required"/>
|
||||
</complexType>
|
||||
</element>
|
||||
</choice>
|
||||
<element name="source-type" minOccurs="0" default="java">
|
||||
<simpleType>
|
||||
<restriction base="string">
|
||||
<pattern value="(apex|ecmascript|java|jsp|modelica|plsql|pom|scala|swift|vf|vm|wsdl|xml|xsl)( [\w\d._-]+)?"></pattern>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<element name="source-type" minOccurs="0" default="" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Language version of the source, eg 'java 8'.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</element>
|
||||
</sequence>
|
||||
<attribute name="reinitializeRule" type="boolean" default="true"></attribute>
|
||||
<attribute name="regressionTest" type="boolean" default="true"></attribute>
|
||||
<attribute name="useAuxClasspath" type="boolean" default="true"></attribute>
|
||||
<attribute name="reinitializeRule" type="boolean" default="true"/>
|
||||
<attribute name="regressionTest" type="boolean" default="true">
|
||||
<annotation>
|
||||
<documentation>
|
||||
This attribute is deprecated. Use "disabled" instead.
|
||||
If this attribute is set to "false", then the test is ignored.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="useAuxClasspath" type="boolean" default="true"/>
|
||||
|
||||
<attribute name="disabled" type="boolean" default="false">
|
||||
<annotation>
|
||||
<documentation>
|
||||
A reason why the test is disabled/ignored should be provided as a comment for the test.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
|
||||
<complexType name="codeFragmentType">
|
||||
<simpleContent>
|
||||
<extension base="string">
|
||||
<attribute name="id" type="ID" use="required"></attribute>
|
||||
<attribute name="id" type="ID" use="required"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
Reference in New Issue
Block a user