@Test public void should_dump_ruleset_as_xml() throws Exception { InputFile srcFile = file("src/Class.java", Type.MAIN); InputFile tstFile = file("test/ClassTest.java", Type.TEST); setupPmdRuleSet(PmdConstants.REPOSITORY_KEY, "simple.xml"); setupPmdRuleSet(PmdConstants.TEST_REPOSITORY_KEY, "junit.xml"); fileSystem.add(srcFile); fileSystem.add(tstFile); pmdExecutor.execute(); verify(pmdConfiguration).dumpXmlRuleSet(PmdConstants.REPOSITORY_KEY, PmdTestUtils.getResourceContent("/org/sonar/plugins/pmd/simple.xml")); verify(pmdConfiguration).dumpXmlRuleSet(PmdConstants.TEST_REPOSITORY_KEY, PmdTestUtils.getResourceContent("/org/sonar/plugins/pmd/junit.xml")); }
public Report execute() { TimeProfiler profiler = new TimeProfiler().start("Execute PMD " + PmdVersion.getVersion()); ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader classLoader = createClassloader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } finally { Closeables.closeQuietly(classLoader); Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stop(); } }
PmdExecutor implements BatchExtension { public Report execute() { TimeProfiler profiler = new TimeProfiler().start("Execute PMD " + PmdVersion.getVersion()); ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader classLoader = createClassloader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } finally { Closeables.closeQuietly(classLoader); Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stop(); } } }
PmdExecutor implements BatchExtension { public Report execute() { TimeProfiler profiler = new TimeProfiler().start("Execute PMD " + PmdVersion.getVersion()); ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader classLoader = createClassloader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } finally { Closeables.closeQuietly(classLoader); Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stop(); } } PmdExecutor(FileSystem fileSystem, RulesProfile rulesProfile, PmdProfileExporter pmdProfileExporter,
					   PmdConfiguration pmdConfiguration, JavaResourceLocator javaResourceLocator, Settings settings); }
PmdExecutor implements BatchExtension { public Report execute() { TimeProfiler profiler = new TimeProfiler().start("Execute PMD " + PmdVersion.getVersion()); ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader classLoader = createClassloader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } finally { Closeables.closeQuietly(classLoader); Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stop(); } } PmdExecutor(FileSystem fileSystem, RulesProfile rulesProfile, PmdProfileExporter pmdProfileExporter,
					   PmdConfiguration pmdConfiguration, JavaResourceLocator javaResourceLocator, Settings settings); Report execute(); Iterable<File> javaFiles(Type fileType); Iterable<File> xmlFiles(Type fileType); void executeRules(PmdTemplate pmdFactory, RuleContext ruleContext, Iterable<File> files, String repositoryKey); void executeXmlRules(PmdTemplate pmdFactory, RuleContext ruleContext, Iterable<File> files, String repositoryKey); }
PmdExecutor implements BatchExtension { public Report execute() { TimeProfiler profiler = new TimeProfiler().start("Execute PMD " + PmdVersion.getVersion()); ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader classLoader = createClassloader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } finally { Closeables.closeQuietly(classLoader); Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stop(); } } PmdExecutor(FileSystem fileSystem, RulesProfile rulesProfile, PmdProfileExporter pmdProfileExporter,
					   PmdConfiguration pmdConfiguration, JavaResourceLocator javaResourceLocator, Settings settings); Report execute(); Iterable<File> javaFiles(Type fileType); Iterable<File> xmlFiles(Type fileType); void executeRules(PmdTemplate pmdFactory, RuleContext ruleContext, Iterable<File> files, String repositoryKey); void executeXmlRules(PmdTemplate pmdFactory, RuleContext ruleContext, Iterable<File> files, String repositoryKey);  }