本文整理汇总了Java中com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java RuleConfiguration类的具体用法?Java RuleConfiguration怎么用?Java RuleConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RuleConfiguration类属于com.buschmais.jqassistant.core.rule.api.reader包,在下文中一共展示了RuleConfiguration类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: withOptions
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
@Override
public void withOptions(final CommandLine options) throws CliConfigurationException {
super.withOptions(options);
String ruleParametersFileName = getOptionValue(options, CMDLINE_OPTION_RULEPARAMETERS, null);
if (ruleParametersFileName != null) {
this.ruleParametersFile = new File(ruleParametersFileName);
if (!this.ruleParametersFile.exists()) {
throw new CliConfigurationException("Cannot find rule parameters file '" + ruleParametersFileName + "'.");
}
} else {
this.ruleParametersFile = null;
}
reportDirectory = getOptionValue(options, CMDLINE_OPTION_REPORTDIR, DEFAULT_REPORT_DIRECTORY);
String severityValue = getOptionValue(options, CMDLINE_OPTION_SEVERITY, null);
if (severityValue != null) {
Severity severity = getSeverity(severityValue);
failOnSeverity = severity;
LOGGER.warn("'" + CMDLINE_OPTION_SEVERITY + "' has been deprecated, please use '" + CMDLINE_OPTION_FAIL_ON_SEVERITY + "' instead.");
} else {
failOnSeverity = getSeverity(getOptionValue(options, CMDLINE_OPTION_FAIL_ON_SEVERITY, RuleConfiguration.DEFAULT.getDefaultConstraintSeverity().getValue()));
}
warnOnSeverity = getSeverity(getOptionValue(options, CMDLINE_OPTION_WARN_ON_SEVERITY, RuleConfiguration.DEFAULT.getDefaultConceptSeverity().getValue()));
executeAppliedConcepts = options.hasOption(CMDLINE_OPTION_EXECUTEAPPLIEDCONCEPTS);
}
示例2: testReadUrlSource
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
@Test
public void testReadUrlSource() throws Exception {
RuleSetBuilder ruleSetBuilder = RuleSetBuilder.newInstance();
URL url = getClass().getResource("/test-concepts.xml");
RuleSetReader reader = new XmlRuleSetReader(RuleConfiguration.builder().build());
reader.read(singletonList(new UrlRuleSource(url)), 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"));
}
示例3: getRuleConfiguration
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
protected RuleConfiguration getRuleConfiguration() {
Severity defaultConceptSeverity = DEFAULT.getDefaultConceptSeverity();
Severity defaultConstraintSeverity = DEFAULT.getDefaultConstraintSeverity();
Severity defaultGroupSeverity = DEFAULT.getDefaultGroupSeverity();
if (rule != null) {
defaultConceptSeverity = rule.getDefaultConceptSeverity();
defaultConstraintSeverity = rule.getDefaultConstraintSeverity();
defaultGroupSeverity = rule.getDefaultGroupSeverity();
}
return RuleConfiguration.builder()
.defaultConceptSeverity(defaultConceptSeverity != null ? defaultConceptSeverity : DEFAULT.getDefaultConceptSeverity())
.defaultConstraintSeverity(
defaultConstraintSeverity != null ? defaultConstraintSeverity : DEFAULT.getDefaultConstraintSeverity())
.defaultGroupSeverity(defaultGroupSeverity != null ? defaultGroupSeverity : DEFAULT.getDefaultGroupSeverity()).build();
}
示例4: withOptions
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
@Override
public void withOptions(CommandLine options) throws CliConfigurationException {
String rulesUrl = getOptionValue(options, CMDLINE_OPTION_RULESURL, null);
if (rulesUrl != null) {
try {
this.rulesUrl = new URL(rulesUrl);
} catch (MalformedURLException e) {
throw new CliConfigurationException("'" + rulesUrl + "' is not a valid URL.", e);
}
}
ruleDirectory = getOptionValue(options, CMDLINE_OPTION_R, Task.DEFAULT_RULE_DIRECTORY);
groupIds = getOptionValues(options, CMDLINE_OPTION_GROUPS, Collections.<String> emptyList());
constraintIds = getOptionValues(options, CMDLINE_OPTION_CONSTRAINTS, Collections.<String> emptyList());
conceptIds = getOptionValues(options, CMDLINE_OPTION_CONCEPTS, Collections.<String> emptyList());
RuleConfiguration.RuleConfigurationBuilder ruleConfigurationBuilder = RuleConfiguration.builder();
String defaultGroupSeverityValue = getOptionValue(options, CMDLINE_OPTION_DEFAULT_GROUP_SEVERITY);
if (defaultGroupSeverityValue != null) {
ruleConfigurationBuilder.defaultGroupSeverity(getSeverity(defaultGroupSeverityValue));
}
String defaultConceptSeverityValue = getOptionValue(options, CMDLINE_OPTION_DEFAULT_CONCEPT_SEVERITY);
if (defaultConceptSeverityValue != null) {
ruleConfigurationBuilder.defaultConceptSeverity(getSeverity(defaultConceptSeverityValue));
}
String defaultConstraintSeverityValue = getOptionValue(options, CMDLINE_OPTION_DEFAULT_CONSTRAINT_SEVERITY);
if (defaultConstraintSeverityValue != null) {
ruleConfigurationBuilder.defaultConstraintSeverity(getSeverity(defaultConstraintSeverityValue));
}
ruleConfiguration = ruleConfigurationBuilder.build();
}
示例5: RuleSetWriterImpl
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
public RuleSetWriterImpl(RuleConfiguration ruleConfiguration) {
this.ruleConfiguration = ruleConfiguration;
try {
jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
} catch (JAXBException e) {
throw new IllegalArgumentException("Cannot create JAXB context.", e);
}
}
示例6: XmlRuleSetReader
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
public XmlRuleSetReader(RuleConfiguration ruleConfiguration) {
this.ruleConfiguration = ruleConfiguration;
Map<String, String> namespaceMappings = new HashMap<>();
namespaceMappings.put(NAMESPACE_RULES_1_0, NAMESPACE_RULES_1_3);
namespaceMappings.put(NAMESPACE_RULES_1_1, NAMESPACE_RULES_1_3);
namespaceMappings.put(NAMESPACE_RULES_1_2, NAMESPACE_RULES_1_3);
this.jaxbUnmarshaller = new JAXBUnmarshaller<>(JqassistantRules.class, SCHEMA, namespaceMappings);
}
示例7: asciidocDefaultSeverity
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
@Test
public void asciidocDefaultSeverity() throws RuleException {
RuleConfiguration ruleConfiguration = RuleConfiguration.builder().defaultConceptSeverity(Severity.CRITICAL).defaultConstraintSeverity(Severity.CRITICAL)
.defaultGroupSeverity(Severity.CRITICAL).build();
RuleSet ruleSet = RuleSetTestHelper.readRuleSet("/severity.adoc", ruleConfiguration);
verifyDefaultSeverities(ruleSet, Severity.CRITICAL);
}
示例8: xmlDefaultSeverity
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
@Test
public void xmlDefaultSeverity() throws RuleException {
RuleConfiguration ruleConfiguration = RuleConfiguration.builder().defaultConceptSeverity(Severity.CRITICAL).defaultConstraintSeverity(Severity.CRITICAL)
.defaultGroupSeverity(Severity.CRITICAL).build();
RuleSet ruleSet = RuleSetTestHelper.readRuleSet("/severity.xml", ruleConfiguration);
verifyDefaultSeverities(ruleSet, Severity.CRITICAL);
}
示例9: readRuleSet
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
public static RuleSet readRuleSet(String resource, RuleConfiguration ruleConfiguration) throws RuleException {
RuleSetBuilder ruleSetBuilder = RuleSetBuilder.newInstance();
CompoundRuleSetReader reader = new CompoundRuleSetReader(ruleConfiguration);
URL url = RuleSetTestHelper.class.getResource(resource);
assertThat("Cannot read resource URL:" + resource, url, notNullValue());
RuleSource ruleSource = new UrlRuleSource(url);
reader.read(Collections.singletonList(ruleSource), ruleSetBuilder);
return ruleSetBuilder.getRuleSet();
}
示例10: testReadCompoundSources
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
@Test
public void testReadCompoundSources() throws Exception {
File adocFile = ClasspathResource.getFile("/junit-without-assert.adoc");
File xmlFile = ClasspathResource.getFile("/test-concepts.xml");
RuleSetBuilder ruleSetBuilder = RuleSetBuilder.newInstance();
RuleSetReader reader = new CompoundRuleSetReader(RuleConfiguration.builder().build());
reader.read(asList(new FileRuleSource(adocFile), new FileRuleSource(xmlFile)), ruleSetBuilder);
RuleSet ruleSet = ruleSetBuilder.getRuleSet();
assertThat(ruleSet.getConceptBucket().size(), equalTo(3));
assertThat(ruleSet.getConstraintBucket().size(), equalTo(2));
assertThat(ruleSet.getConceptBucket().getIds(), containsInAnyOrder("junit4:TestClassOrMethod",
"junit4:AssertMethod",
"java:Throwable"));
assertThat(ruleSet.getConstraintBucket().getIds(), containsInAnyOrder("junit4:TestMethodWithoutAssertion",
"example:ConstructorOfDateMustNotBeUsed"));
assertThat(ruleSet.getGroupsBucket().size(), equalTo(1));
Group group = ruleSet.getGroupsBucket().getById("default");
assertThat(group.getId(), equalTo("default"));
assertThat(group.getConcepts(), aMapWithSize(1));
assertThat(group.getConcepts(), hasKey("java:Throwable"));
assertThat(group.getConstraints().size(), equalTo(1));
assertThat(group.getConstraints(), hasKey("example:ConstructorOfDateMustNotBeUsed"));
}
示例11: AsciiDocRuleSetReader
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
public AsciiDocRuleSetReader(RuleConfiguration ruleConfiguration) {
this.ruleConfiguration = ruleConfiguration;
}
示例12: CompoundRuleSetReader
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
public CompoundRuleSetReader(RuleConfiguration ruleConfiguration) {
ruleSetReaders = asList(new XmlRuleSetReader(ruleConfiguration), new AsciiDocRuleSetReader(ruleConfiguration));
}
示例13: xmlRuleDefaultSeverity
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
@Test
public void xmlRuleDefaultSeverity() throws RuleException {
RuleConfiguration ruleConfiguration = RuleConfiguration.builder().build();
RuleSet ruleSet = RuleSetTestHelper.readRuleSet("/severity.xml", ruleConfiguration);
verifyRuleDefaultSeverity(ruleSet);
}
示例14: asciidocRuleDefaultSeverity
import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
@Test
public void asciidocRuleDefaultSeverity() throws RuleException {
RuleConfiguration ruleConfiguration = RuleConfiguration.builder().build();
RuleSet ruleSet = RuleSetTestHelper.readRuleSet("/severity.adoc", ruleConfiguration);
verifyRuleDefaultSeverity(ruleSet);
}