@Test public void should_export_xPath_rule() { Rule rule = Rule.create(PmdConstants.REPOSITORY_KEY, "MyOwnRule", "This is my own xpath rule.") .setConfigKey(PmdConstants.XPATH_CLASS) .setRepositoryKey(PmdConstants.REPOSITORY_KEY); rule.createParameter(PmdConstants.XPATH_EXPRESSION_PARAM); rule.createParameter(PmdConstants.XPATH_MESSAGE_PARAM); RulesProfile profile = RulesProfile.create(); ActiveRule xpath = profile.activateRule(rule, null); xpath.setParameter(PmdConstants.XPATH_EXPRESSION_PARAM, " xpath.setParameter(PmdConstants.XPATH_MESSAGE_PARAM, "This is bad"); String exportedXml = exporter.exportProfile(PmdConstants.REPOSITORY_KEY, profile); assertThat(exportedXml).satisfies(equalsIgnoreEOL(PmdTestUtils.getResourceContent("/org/sonar/plugins/pmd/export_xpath_rules.xml"))); }
@Override public void exportProfile(RulesProfile profile, Writer writer) { String profileName = profile.getName(); PmdRuleset tree = createPmdRuleset(PmdConstants.REPOSITORY_KEY, profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY), profileName); exportPmdRulesetToXml(tree, writer, profileName); }
PmdProfileExporter extends ProfileExporter { @Override public void exportProfile(RulesProfile profile, Writer writer) { String profileName = profile.getName(); PmdRuleset tree = createPmdRuleset(PmdConstants.REPOSITORY_KEY, profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY), profileName); exportPmdRulesetToXml(tree, writer, profileName); } }
PmdProfileExporter extends ProfileExporter { @Override public void exportProfile(RulesProfile profile, Writer writer) { String profileName = profile.getName(); PmdRuleset tree = createPmdRuleset(PmdConstants.REPOSITORY_KEY, profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY), profileName); exportPmdRulesetToXml(tree, writer, profileName); } PmdProfileExporter(); }
PmdProfileExporter extends ProfileExporter { @Override public void exportProfile(RulesProfile profile, Writer writer) { String profileName = profile.getName(); PmdRuleset tree = createPmdRuleset(PmdConstants.REPOSITORY_KEY, profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY), profileName); exportPmdRulesetToXml(tree, writer, profileName); } PmdProfileExporter(); @Override void exportProfile(RulesProfile profile, Writer writer); String exportProfile(String repositoryKey, RulesProfile profile); }
PmdProfileExporter extends ProfileExporter { @Override public void exportProfile(RulesProfile profile, Writer writer) { String profileName = profile.getName(); PmdRuleset tree = createPmdRuleset(PmdConstants.REPOSITORY_KEY, profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY), profileName); exportPmdRulesetToXml(tree, writer, profileName); } PmdProfileExporter(); @Override void exportProfile(RulesProfile profile, Writer writer); String exportProfile(String repositoryKey, RulesProfile profile);  }