Search in sources :

Example 1 with Configuration

use of com.buschmais.jqassistant.core.configuration.api.Configuration in project jqa-core-framework by jQAssistant.

the class ConfigurationLoaderImplTest method loadFromFiles.

@Test
void loadFromFiles() {
    Configuration configuration = configurationLoader.load(Configuration.class);
    assertThat(configuration).isNotNull();
    List<Plugin> plugins = configuration.plugins();
    assertThat(plugins).isNotNull().hasSize(2);
    Scan scan = configuration.scan();
    assertThat(scan).isNotNull();
    assertThat(scan.continueOnError()).isEqualTo(true);
}
Also used : Configuration(com.buschmais.jqassistant.core.configuration.api.Configuration) Scan(com.buschmais.jqassistant.core.scanner.api.configuration.Scan) Plugin(com.buschmais.jqassistant.core.plugin.api.configuration.Plugin) Test(org.junit.jupiter.api.Test)

Example 2 with Configuration

use of com.buschmais.jqassistant.core.configuration.api.Configuration in project jqa-core-framework by buschmais.

the class ConfigurationLoaderImpl method load.

@Override
public Configuration load(File configurationDirectory, ConfigSource... configSources) {
    List<ConfigSource> yamlConfigSources = getYamlConfigSources(configurationDirectory);
    SmallRyeConfig config = new SmallRyeConfigBuilder().withMapping(Configuration.class).addDefaultSources().withSources(yamlConfigSources).withSources(configSources).withValidateUnknown(false).build();
    return config.getConfigMapping(Configuration.class);
}
Also used : ConfigSource(org.eclipse.microprofile.config.spi.ConfigSource) YamlConfigSource(io.smallrye.config.source.yaml.YamlConfigSource) SmallRyeConfigBuilder(io.smallrye.config.SmallRyeConfigBuilder) Configuration(com.buschmais.jqassistant.core.configuration.api.Configuration) SmallRyeConfig(io.smallrye.config.SmallRyeConfig)

Example 3 with Configuration

use of com.buschmais.jqassistant.core.configuration.api.Configuration in project jqa-core-framework by buschmais.

the class ConfigurationLoaderImplTest method load.

@Test
void load() {
    File workingDirectory = new File("src/test/resources/working directory");
    File configurationDirectory = configurationLoader.getDefaultConfigurationDirectory(workingDirectory);
    assertThat(configurationDirectory).isEqualTo(new File(workingDirectory, ".jqassistant"));
    Configuration configuration = configurationLoader.load(configurationDirectory);
    assertThat(configuration).isNotNull();
    List<Plugin> plugins = configuration.plugins();
    assertThat(plugins).isNotNull().hasSize(2);
}
Also used : Configuration(com.buschmais.jqassistant.core.configuration.api.Configuration) File(java.io.File) Plugin(com.buschmais.jqassistant.core.plugin.api.configuration.Plugin) Test(org.junit.jupiter.api.Test)

Example 4 with Configuration

use of com.buschmais.jqassistant.core.configuration.api.Configuration in project jqa-core-framework by jQAssistant.

the class ConfigurationLoaderImplTest method overrideFromSystemProperty.

@Test
void overrideFromSystemProperty() {
    System.setProperty("jqassistant.scan.continue-on-error", "false");
    try {
        Configuration configuration = configurationLoader.load(Configuration.class);
        assertThat(configuration.scan().continueOnError()).isEqualTo(false);
    } finally {
        System.clearProperty("jqassistant.scan.continue-on-error");
    }
}
Also used : Configuration(com.buschmais.jqassistant.core.configuration.api.Configuration) Test(org.junit.jupiter.api.Test)

Example 5 with Configuration

use of com.buschmais.jqassistant.core.configuration.api.Configuration in project jqa-core-framework by jQAssistant.

the class AbstractPluginIT method getScanner.

/**
 * Return an initialized scanner instance using the given properties.
 *
 * @return The scanner instance.
 */
protected Scanner getScanner(Map<String, Object> properties) {
    PropertiesConfigBuilder propertiesConfigBuilder = createPropertiesConfigBuilder().with(Scan.PREFIX, Scan.PROPERTIES, properties);
    Configuration configuration = createConfiguration(propertiesConfigBuilder);
    return getScanner(configuration);
}
Also used : EmbeddedNeo4jConfiguration(com.buschmais.jqassistant.neo4j.backend.bootstrap.EmbeddedNeo4jConfiguration) RuleConfiguration(com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration) AnalyzerConfiguration(com.buschmais.jqassistant.core.analysis.api.AnalyzerConfiguration) StoreConfiguration(com.buschmais.jqassistant.core.store.api.StoreConfiguration) Configuration(com.buschmais.jqassistant.core.configuration.api.Configuration) PropertiesConfigBuilder(com.buschmais.jqassistant.core.configuration.api.PropertiesConfigBuilder)

Aggregations

Configuration (com.buschmais.jqassistant.core.configuration.api.Configuration)5 Test (org.junit.jupiter.api.Test)3 Plugin (com.buschmais.jqassistant.core.plugin.api.configuration.Plugin)2 AnalyzerConfiguration (com.buschmais.jqassistant.core.analysis.api.AnalyzerConfiguration)1 PropertiesConfigBuilder (com.buschmais.jqassistant.core.configuration.api.PropertiesConfigBuilder)1 RuleConfiguration (com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration)1 Scan (com.buschmais.jqassistant.core.scanner.api.configuration.Scan)1 StoreConfiguration (com.buschmais.jqassistant.core.store.api.StoreConfiguration)1 EmbeddedNeo4jConfiguration (com.buschmais.jqassistant.neo4j.backend.bootstrap.EmbeddedNeo4jConfiguration)1 SmallRyeConfig (io.smallrye.config.SmallRyeConfig)1 SmallRyeConfigBuilder (io.smallrye.config.SmallRyeConfigBuilder)1 YamlConfigSource (io.smallrye.config.source.yaml.YamlConfigSource)1 File (java.io.File)1 ConfigSource (org.eclipse.microprofile.config.spi.ConfigSource)1