use of com.buschmais.jqassistant.core.rule.impl.reader.XmlRuleParserPlugin in project jqa-core-framework by buschmais.
the class XmlRuleParserPluginTest method testReadUrlSource.
@Test
void testReadUrlSource() throws Exception {
RuleSetBuilder ruleSetBuilder = RuleSetBuilder.newInstance();
URL url = getClass().getResource("/test-concepts.xml");
RuleParserPlugin reader = new XmlRuleParserPlugin();
reader.initialize();
reader.configure(RuleConfiguration.builder().build());
UrlRuleSource ruleSource = new UrlRuleSource(url);
assertThat(reader.accepts(ruleSource), equalTo(true));
reader.parse(ruleSource, ruleSetBuilder);
RuleSet ruleSet = ruleSetBuilder.getRuleSet();
assertThat(ruleSet.getConceptBucket().size(), equalTo(1));
assertThat(ruleSet.getConstraintBucket().size(), equalTo(1));
assertThat(ruleSet.getConceptBucket().getIds(), contains("java:Throwable"));
assertThat(ruleSet.getConstraintBucket().getIds(), contains("example:ConstructorOfDateMustNotBeUsed"));
assertThat(ruleSet.getGroupsBucket().size(), equalTo(1));
Group group = ruleSet.getGroupsBucket().getById("default");
assertThat(group.getId(), equalTo("default"));
}
use of com.buschmais.jqassistant.core.rule.impl.reader.XmlRuleParserPlugin in project jqa-core-framework by buschmais.
the class RuleSetTestHelper method getDefaultRuleParserPlugins.
public static List<RuleParserPlugin> getDefaultRuleParserPlugins(RuleConfiguration ruleConfiguration) throws RuleException {
List<RuleParserPlugin> ruleParserPlugins = asList(new AsciidocRuleParserPlugin(), new XmlRuleParserPlugin(), new YamlRuleParserPlugin());
for (RuleParserPlugin ruleParserPlugin : ruleParserPlugins) {
ruleParserPlugin.initialize();
ruleParserPlugin.configure(ruleConfiguration);
}
return ruleParserPlugins;
}
Aggregations