diff options
author | fmallet <freddy.mallet@gmail.com> | 2010-09-16 08:47:47 +0000 |
---|---|---|
committer | fmallet <freddy.mallet@gmail.com> | 2010-09-16 08:47:47 +0000 |
commit | af671ec593977add8ea924b4f9f88302bd0ef81c (patch) | |
tree | 9bcfb15239ec4c28e0daf9bde50bbd75b49f99c1 /plugins/sonar-pmd-plugin | |
parent | f27104c1d98ac616ba1c91c3cfe96e0e495b725a (diff) | |
download | sonarqube-af671ec593977add8ea924b4f9f88302bd0ef81c.tar.gz sonarqube-af671ec593977add8ea924b4f9f88302bd0ef81c.zip |
Prevent Unit Tests from generating report file outside of the /target directory
Diffstat (limited to 'plugins/sonar-pmd-plugin')
4 files changed, 4 insertions, 16 deletions
diff --git a/plugins/sonar-pmd-plugin/pmd-result.xml b/plugins/sonar-pmd-plugin/pmd-result.xml deleted file mode 100644 index b95ea127b30..00000000000 --- a/plugins/sonar-pmd-plugin/pmd-result.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<pmd version="4.2.5" timestamp="2010-09-15T23:57:48.955"> -</pmd>
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdExecutorTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdExecutorTest.java index 64343d7d97f..eabaddb6abb 100644 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdExecutorTest.java +++ b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdExecutorTest.java @@ -50,6 +50,7 @@ public class PmdExecutorTest { File root = new File(getClass().getResource("/org/sonar/plugins/pmd/PmdExecutorTest/executeOnManySourceDirs/").toURI()); when(fs.getSourceFiles(Java.INSTANCE)).thenReturn(Arrays.asList(new File(root, "src1/FirstClass.java"), new File(root, "src2/SecondClass.java"))); when(fs.getSourceCharset()).thenReturn(Charset.forName("UTF-8")); + when(fs.getSonarWorkingDirectory()).thenReturn(new File("target")); project.setFileSystem(fs); PmdConfiguration conf = mock(PmdConfiguration.class); @@ -74,6 +75,7 @@ public class PmdExecutorTest { ProjectFileSystem fs = mock(ProjectFileSystem.class); when(fs.getSourceFiles(Java.INSTANCE)).thenReturn(Arrays.asList(new File("test-resources/ignorePmdFailures/DoesNotCompile.java"))); when(fs.getSourceCharset()).thenReturn(Charset.forName("UTF-8")); + when(fs.getSonarWorkingDirectory()).thenReturn(new File("target")); project.setFileSystem(fs); PmdConfiguration conf = mock(PmdConfiguration.class); diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileExporterTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileExporterTest.java index 594c4cbc75f..d6189e13196 100644 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileExporterTest.java +++ b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileExporterTest.java @@ -27,8 +27,6 @@ import org.sonar.plugins.pmd.xml.PmdRule; import org.sonar.test.TestUtils; import org.xml.sax.SAXException; -import com.thoughtworks.xstream.io.xml.JDomReader; - public class PmdProfileExporterTest { private PmdProfileExporter exporter = new PmdProfileExporter(); @@ -61,7 +59,8 @@ public class PmdProfileExporterTest { xpath.setParameter(PmdConstants.XPATH_EXPRESSION_PARAM, "//FieldDeclaration"); xpath.setParameter(PmdConstants.XPATH_MESSAGE_PARAM, "This is bad"); exporter.exportProfile(profile, xmlOutput); - assertEquals(TestUtils.getResourceContent("/org/sonar/plugins/pmd/export_xpath_rules.xml"), StringUtils.remove(xmlOutput.toString(), '\r')); + assertEquals(TestUtils.getResourceContent("/org/sonar/plugins/pmd/export_xpath_rules.xml"), + StringUtils.remove(xmlOutput.toString(), '\r')); } @Test diff --git a/plugins/sonar-pmd-plugin/toto.txt b/plugins/sonar-pmd-plugin/toto.txt deleted file mode 100644 index 08cd17216b9..00000000000 --- a/plugins/sonar-pmd-plugin/toto.txt +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<resultset>
- <rule class="net.sourceforge.pmd.rules.XPathRule" message="This is bad" name="MyOwnRule">
- <priority>3</priority>
- <properties>
- <property name="xpath" value="//FieldDeclaration" />
- </properties>
- </rule>
-</resultset>
-
|