当前位置: 首页>>代码示例>>Java>>正文


Java RuleConfiguration类代码示例

本文整理汇总了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);
}
 
开发者ID:buschmais,项目名称:jqa-commandline-tool,代码行数:25,代码来源:AnalyzeTask.java

示例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"));
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:18,代码来源:CompoundRuleSetReaderTest.java

示例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();
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:16,代码来源:AbstractMojo.java

示例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();
}
 
开发者ID:buschmais,项目名称:jqa-commandline-tool,代码行数:30,代码来源:AbstractAnalyzeTask.java

示例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);
    }
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:9,代码来源:RuleSetWriterImpl.java

示例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);
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:9,代码来源:XmlRuleSetReader.java

示例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);
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:8,代码来源:SeverityTest.java

示例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);
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:8,代码来源:SeverityTest.java

示例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();
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:10,代码来源:RuleSetTestHelper.java

示例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"));
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:29,代码来源:CompoundRuleSetReaderTest.java

示例11: AsciiDocRuleSetReader

import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
public AsciiDocRuleSetReader(RuleConfiguration ruleConfiguration) {
    this.ruleConfiguration = ruleConfiguration;
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:4,代码来源:AsciiDocRuleSetReader.java

示例12: CompoundRuleSetReader

import com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration; //导入依赖的package包/类
public CompoundRuleSetReader(RuleConfiguration ruleConfiguration) {
    ruleSetReaders = asList(new XmlRuleSetReader(ruleConfiguration), new AsciiDocRuleSetReader(ruleConfiguration));
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:4,代码来源:CompoundRuleSetReader.java

示例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);
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:7,代码来源:SeverityTest.java

示例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);
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:7,代码来源:SeverityTest.java


注:本文中的com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。