use of com.buschmais.jqassistant.core.report.api.ReportPlugin in project jqa-core-framework by buschmais.
the class ReportPluginRepositoryImpl method getReportPlugins.
private Map<String, ReportPlugin> getReportPlugins(List<JqassistantPlugin> plugins) throws PluginRepositoryException {
Map<String, ReportPlugin> reportPlugins = new HashMap<>();
for (JqassistantPlugin plugin : plugins) {
ReportType reportType = plugin.getReport();
if (reportType != null) {
for (IdClassType classType : reportType.getClazz()) {
ReportPlugin reportPlugin = createInstance(classType.getValue());
if (reportPlugin != null) {
try {
reportPlugin.initialize();
} catch (ReportException e) {
throw new PluginRepositoryException("Cannot initialize report plugin " + reportPlugin, e);
}
String id = classType.getId();
if (id == null) {
id = reportPlugin.getClass().getSimpleName();
}
reportPlugins.put(id, reportPlugin);
}
}
}
}
return reportPlugins;
}
use of com.buschmais.jqassistant.core.report.api.ReportPlugin in project jqa-core-framework by buschmais.
the class PluginRepositoryTest method getReportPluginProperties.
private Map<String, Object> getReportPluginProperties(PluginRepository pluginRepository, Map<String, Object> properties) throws PluginRepositoryException {
ReportPluginRepository reportPluginRepository = pluginRepository.getReportPluginRepository();
Map<String, ReportPlugin> reportPlugins = reportPluginRepository.getReportPlugins(properties);
assertThat(reportPlugins.size(), greaterThan(0));
for (ReportPlugin reportPlugin : reportPlugins.values()) {
if (reportPlugin instanceof TestReportPlugin) {
return ((TestReportPlugin) reportPlugin).getProperties();
}
}
return null;
}
use of com.buschmais.jqassistant.core.report.api.ReportPlugin in project jqa-core-framework by buschmais.
the class AnalyzerVisitorTest method missingParameter.
@Test
public void missingParameter() throws RuleException {
String statement = "match (n) return n";
Concept concept = createConcept(statement);
ReportPlugin reportWriter = mock(ReportPlugin.class);
try {
AnalyzerVisitor analyzerVisitor = new AnalyzerVisitor(configuration, Collections.<String, String>emptyMap(), store, reportWriter, console);
analyzerVisitor.visitConcept(concept, Severity.MINOR);
fail("Expecting an " + RuleExecutorException.class.getName());
} catch (RuleExecutorException e) {
String message = e.getMessage();
assertThat(message, containsString(concept.getId()));
assertThat(message, containsString(PARAMETER_WITHOUT_DEFAULT));
}
}
Aggregations