use of org.jqassistant.schema.plugin.v1.JqassistantPlugin in project jqa-core-framework by buschmais.
the class ScannerPluginRepositoryImpl method getScannerPlugins.
private void getScannerPlugins(List<JqassistantPlugin> plugins) {
for (JqassistantPlugin plugin : plugins) {
IdClassListType scannerTypes = plugin.getScanner();
if (scannerTypes != null) {
for (IdClassType classType : scannerTypes.getClazz()) {
ScannerPlugin<?, ?> scannerPlugin = createInstance(classType.getValue());
if (scannerPlugin != null) {
scannerPlugin.initialize();
String id = classType.getId();
if (id == null) {
id = scannerPlugin.getClass().getSimpleName();
}
scannerPlugins.put(id, scannerPlugin);
}
}
}
}
}
use of org.jqassistant.schema.plugin.v1.JqassistantPlugin in project jqa-core-framework by buschmais.
the class PluginIdGeneratorTest method idGenerationWorksAsExpected.
// todo null
// todo ""
@ParameterizedTest
@MethodSource("parameterProvider")
void idGenerationWorksAsExpected(String name, String id, String expected) {
JqassistantPlugin plugin = Mockito.mock(JqassistantPlugin.class);
Mockito.when(plugin.getName()).thenReturn(name);
Mockito.when(plugin.getId()).thenReturn(id);
JqassistantPlugin apply = generator.apply(plugin);
Mockito.verify(apply).setId(expected);
}
use of org.jqassistant.schema.plugin.v1.JqassistantPlugin in project jqa-core-framework by buschmais.
the class PluginIdGeneratorTest method pluginWithIdWithoutAnyWhitespaceWillNotBeModified.
@Test
void pluginWithIdWithoutAnyWhitespaceWillNotBeModified() {
JqassistantPlugin plugin = Mockito.mock(JqassistantPlugin.class);
Mockito.when(plugin.getName()).thenReturn("Time Maschine Plugin");
Mockito.when(plugin.getId()).thenReturn("org.timed.plugin");
JqassistantPlugin apply = generator.apply(plugin);
Mockito.verify(apply, never()).setId(Mockito.anyString());
}
use of org.jqassistant.schema.plugin.v1.JqassistantPlugin 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 org.jqassistant.schema.plugin.v1.JqassistantPlugin in project jqa-core-framework by buschmais.
the class PluginRepositoryImplTest method returnedCollectionForTheOverviewIsUnmodifiable.
@Test
void returnedCollectionForTheOverviewIsUnmodifiable() {
PluginConfigurationReader pluginConfigurationReader = Mockito.mock(PluginConfigurationReader.class);
JqassistantPlugin pluginA = Mockito.mock(JqassistantPlugin.class);
JqassistantPlugin pluginB = Mockito.mock(JqassistantPlugin.class);
JqassistantPlugin pluginC = Mockito.mock(JqassistantPlugin.class);
doReturn("jqa.a").when(pluginA).getId();
doReturn("A").when(pluginA).getName();
doReturn("jqa.b").when(pluginB).getId();
doReturn("B").when(pluginB).getName();
doReturn("jqa.c").when(pluginC).getId();
doReturn("C").when(pluginC).getName();
doReturn(Arrays.asList(pluginA, pluginB, pluginC)).when(pluginConfigurationReader).getPlugins();
doReturn(PluginRepositoryImplTest.class.getClassLoader()).when(pluginConfigurationReader).getClassLoader();
PluginRepository pluginRepository = new PluginRepositoryImpl(pluginConfigurationReader);
pluginRepository.initialize();
Collection<PluginInfo> overview = pluginRepository.getPluginOverview();
SoftAssertions.assertSoftly(overviewOfPlugins -> {
overviewOfPlugins.assertThatThrownBy(() -> overview.clear()).isInstanceOf(RuntimeException.class);
overviewOfPlugins.assertThatThrownBy(() -> overview.removeIf(i -> true)).isInstanceOf(RuntimeException.class);
});
}
Aggregations