當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。