Search in sources :

Example 1 with ScannerPlugin

use of com.buschmais.jqassistant.core.scanner.api.ScannerPlugin in project jqa-core-framework by buschmais.

the class PluginRepositoryTest method repositories.

@Test
public void repositories() throws PluginRepositoryException {
    PluginConfigurationReader pluginConfigurationReader = new PluginConfigurationReaderImpl(PluginRepositoryTest.class.getClassLoader());
    PluginRepository pluginRepository = new PluginRepositoryImpl(pluginConfigurationReader);
    // Scanner plugins
    ScannerContext scannerContext = mock(ScannerContext.class);
    Map<String, ScannerPlugin<?, ?>> scannerPlugins = pluginRepository.getScannerPluginRepository().getScannerPlugins(scannerContext, Collections.<String, Object>emptyMap());
    assertThat(scannerPlugins.size(), equalTo(2));
    assertThat(scannerPlugins.get(TestScannerPlugin.class.getSimpleName()), notNullValue());
    assertThat(scannerPlugins.get("testScanner"), notNullValue());
    // Report plugins
    Map<String, ReportPlugin> reportPlugins = pluginRepository.getReportPluginRepository().getReportPlugins(Collections.<String, Object>emptyMap());
    assertThat(reportPlugins.size(), equalTo(2));
    assertThat(reportPlugins.get(TestReportPlugin.class.getSimpleName()), notNullValue());
    assertThat(reportPlugins.get("testReport"), notNullValue());
}
Also used : ReportPlugin(com.buschmais.jqassistant.core.report.api.ReportPlugin) TestReportPlugin(com.buschmais.jqassistant.plugin.impl.plugin.TestReportPlugin) ScannerPlugin(com.buschmais.jqassistant.core.scanner.api.ScannerPlugin) TestScannerPlugin(com.buschmais.jqassistant.plugin.impl.plugin.TestScannerPlugin) PluginConfigurationReaderImpl(com.buschmais.jqassistant.core.plugin.impl.PluginConfigurationReaderImpl) ScannerContext(com.buschmais.jqassistant.core.scanner.api.ScannerContext) PluginRepositoryImpl(com.buschmais.jqassistant.core.plugin.impl.PluginRepositoryImpl) Test(org.junit.Test)

Example 2 with ScannerPlugin

use of com.buschmais.jqassistant.core.scanner.api.ScannerPlugin in project jqa-core-framework by buschmais.

the class PluginRepositoryImplTest method getScannerPluginProperties.

private Map<String, Object> getScannerPluginProperties(PluginRepository pluginRepository, Map<String, Object> properties) {
    ScannerPluginRepository scannerPluginRepository = pluginRepository.getScannerPluginRepository();
    ScannerContext scannerContext = mock(ScannerContext.class);
    Map<String, ScannerPlugin<?, ?>> scannerPlugins = scannerPluginRepository.getScannerPlugins(scannerContext, properties);
    assertThat(scannerPlugins).isNotEmpty();
    for (ScannerPlugin<?, ?> scannerPlugin : scannerPlugins.values()) {
        if (scannerPlugin instanceof TestScannerPlugin) {
            return ((TestScannerPlugin) scannerPlugin).getProperties();
        }
    }
    return null;
}
Also used : TestScannerPlugin(com.buschmais.jqassistant.core.plugin.impl.plugin.TestScannerPlugin) ScannerPluginRepository(com.buschmais.jqassistant.core.scanner.spi.ScannerPluginRepository) TestScannerPlugin(com.buschmais.jqassistant.core.plugin.impl.plugin.TestScannerPlugin) ScannerPlugin(com.buschmais.jqassistant.core.scanner.api.ScannerPlugin) ScannerContext(com.buschmais.jqassistant.core.scanner.api.ScannerContext)

Example 3 with ScannerPlugin

use of com.buschmais.jqassistant.core.scanner.api.ScannerPlugin in project jqa-core-framework by buschmais.

the class PluginRepositoryTest method getScannerPluginProperties.

private Map<String, Object> getScannerPluginProperties(PluginRepository pluginRepository, Map<String, Object> properties) throws PluginRepositoryException {
    ScannerPluginRepository scannerPluginRepository = pluginRepository.getScannerPluginRepository();
    ScannerContext scannerContext = mock(ScannerContext.class);
    Map<String, ScannerPlugin<?, ?>> scannerPlugins = scannerPluginRepository.getScannerPlugins(scannerContext, properties);
    assertThat(scannerPlugins.size(), greaterThan(0));
    for (ScannerPlugin<?, ?> scannerPlugin : scannerPlugins.values()) {
        if (scannerPlugin instanceof TestScannerPlugin) {
            return ((TestScannerPlugin) scannerPlugin).getProperties();
        }
    }
    return null;
}
Also used : TestScannerPlugin(com.buschmais.jqassistant.plugin.impl.plugin.TestScannerPlugin) ScannerPlugin(com.buschmais.jqassistant.core.scanner.api.ScannerPlugin) TestScannerPlugin(com.buschmais.jqassistant.plugin.impl.plugin.TestScannerPlugin) ScannerContext(com.buschmais.jqassistant.core.scanner.api.ScannerContext)

Example 4 with ScannerPlugin

use of com.buschmais.jqassistant.core.scanner.api.ScannerPlugin in project jqa-core-framework by buschmais.

the class PluginRepositoryImplTest method repositories.

@Test
void repositories() {
    PluginConfigurationReader pluginConfigurationReader = new PluginConfigurationReaderImpl(PluginRepositoryImplTest.class.getClassLoader());
    PluginRepository pluginRepository = new PluginRepositoryImpl(pluginConfigurationReader);
    pluginRepository.initialize();
    // Scanner plugins
    ScannerContext scannerContext = mock(ScannerContext.class);
    Map<String, ScannerPlugin<?, ?>> scannerPlugins = pluginRepository.getScannerPluginRepository().getScannerPlugins(scannerContext, Collections.emptyMap());
    assertThat(scannerPlugins).hasSize(2);
    assertThat(scannerPlugins.get(TestScannerPlugin.class.getSimpleName()), notNullValue());
    assertThat(scannerPlugins.get(TestScannerPlugin.class.getSimpleName())).isNotNull();
    assertThat(scannerPlugins.get("testScanner"), notNullValue());
    assertThat(scannerPlugins.get("testScanner")).isNotNull();
    // Report plugins
    ReportContext reportContext = mock(ReportContext.class);
    Map<String, ReportPlugin> reportPlugins = pluginRepository.getAnalyzerPluginRepository().getReportPlugins(reportContext, Collections.emptyMap());
    assertThat(reportPlugins.size(), equalTo(3));
    assertThat(reportPlugins).hasSize(3);
    assertThat(reportPlugins.get(TestReportPlugin.class.getSimpleName()), notNullValue());
    assertThat(reportPlugins.get(TestReportPlugin.class.getSimpleName())).isNotNull();
    assertThat(reportPlugins.get("testReport"), notNullValue());
    assertThat(reportPlugins.get("testReport")).isNotNull();
    pluginRepository.destroy();
}
Also used : PluginConfigurationReader(com.buschmais.jqassistant.core.plugin.api.PluginConfigurationReader) TestScannerPlugin(com.buschmais.jqassistant.core.plugin.impl.plugin.TestScannerPlugin) ScannerPlugin(com.buschmais.jqassistant.core.scanner.api.ScannerPlugin) ScannerPluginRepository(com.buschmais.jqassistant.core.scanner.spi.ScannerPluginRepository) AnalyzerPluginRepository(com.buschmais.jqassistant.core.analysis.spi.AnalyzerPluginRepository) PluginRepository(com.buschmais.jqassistant.core.plugin.api.PluginRepository) TestScannerPlugin(com.buschmais.jqassistant.core.plugin.impl.plugin.TestScannerPlugin) TestReportPlugin(com.buschmais.jqassistant.core.plugin.impl.plugin.TestReportPlugin) ReportPlugin(com.buschmais.jqassistant.core.report.api.ReportPlugin) TestReportPlugin(com.buschmais.jqassistant.core.plugin.impl.plugin.TestReportPlugin) ScannerContext(com.buschmais.jqassistant.core.scanner.api.ScannerContext) ReportContext(com.buschmais.jqassistant.core.report.api.ReportContext) Test(org.junit.jupiter.api.Test)

Aggregations

ScannerContext (com.buschmais.jqassistant.core.scanner.api.ScannerContext)4 ScannerPlugin (com.buschmais.jqassistant.core.scanner.api.ScannerPlugin)4 TestScannerPlugin (com.buschmais.jqassistant.core.plugin.impl.plugin.TestScannerPlugin)2 ReportPlugin (com.buschmais.jqassistant.core.report.api.ReportPlugin)2 ScannerPluginRepository (com.buschmais.jqassistant.core.scanner.spi.ScannerPluginRepository)2 TestScannerPlugin (com.buschmais.jqassistant.plugin.impl.plugin.TestScannerPlugin)2 AnalyzerPluginRepository (com.buschmais.jqassistant.core.analysis.spi.AnalyzerPluginRepository)1 PluginConfigurationReader (com.buschmais.jqassistant.core.plugin.api.PluginConfigurationReader)1 PluginRepository (com.buschmais.jqassistant.core.plugin.api.PluginRepository)1 PluginConfigurationReaderImpl (com.buschmais.jqassistant.core.plugin.impl.PluginConfigurationReaderImpl)1 PluginRepositoryImpl (com.buschmais.jqassistant.core.plugin.impl.PluginRepositoryImpl)1 TestReportPlugin (com.buschmais.jqassistant.core.plugin.impl.plugin.TestReportPlugin)1 ReportContext (com.buschmais.jqassistant.core.report.api.ReportContext)1 TestReportPlugin (com.buschmais.jqassistant.plugin.impl.plugin.TestReportPlugin)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1