use of org.sonar.core.platform.PluginRepository in project sonarqube by SonarSource.
the class InstalledPluginReferentialFactoryTest method should_create_plugin_referential.
@Test
public void should_create_plugin_referential() {
PluginInfo info = new PluginInfo("foo");
PluginRepository pluginRepository = mock(PluginRepository.class);
when(pluginRepository.getPluginInfos()).thenReturn(newArrayList(info));
InstalledPluginReferentialFactory factory = new InstalledPluginReferentialFactory(pluginRepository);
assertThat(factory.getInstalledPluginReferential()).isNull();
factory.start();
assertThat(factory.getInstalledPluginReferential()).isNotNull();
assertThat(factory.getInstalledPluginReferential().getPlugins()).hasSize(1);
}
use of org.sonar.core.platform.PluginRepository in project sonarqube by SonarSource.
the class PageRepositoryTest method fail_if_page_with_wrong_format.
@Test
public void fail_if_page_with_wrong_format() {
PageDefinition plugin = context -> context.addPage(Page.builder("my_key").setName("N1").build()).addPage(Page.builder("my_plugin/my_key").setName("N2").build());
underTest = new PageRepository(pluginRepository, new PageDefinition[] { plugin });
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("Page 'N1' with key 'my_key' does not respect the format plugin_key/extension_point_key (ex: governance/project_dump)");
underTest.start();
}
use of org.sonar.core.platform.PluginRepository in project sonarqube by SonarSource.
the class PageRepositoryTest method filter_by_navigation_and_qualifier.
@Test
public void filter_by_navigation_and_qualifier() {
PageDefinition plugin = context -> context.addPage(Page.builder("my_plugin/K1").setName("K1").build()).addPage(Page.builder("my_plugin/K2").setName("K2").setScope(COMPONENT).setComponentQualifiers(Qualifier.PROJECT).build()).addPage(Page.builder("my_plugin/K3").setName("K3").setScope(COMPONENT).setComponentQualifiers(Qualifier.MODULE).build()).addPage(Page.builder("my_plugin/K4").setName("K4").setScope(GLOBAL).build()).addPage(Page.builder("my_plugin/K5").setName("K5").setScope(COMPONENT).setComponentQualifiers(Qualifier.VIEW).build());
underTest = new PageRepository(pluginRepository, new PageDefinition[] { plugin });
underTest.start();
List<Page> result = underTest.getComponentPages(false, Qualifiers.PROJECT);
assertThat(result).extracting(Page::getKey).containsExactly("my_plugin/K2");
}
use of org.sonar.core.platform.PluginRepository in project sonarqube by SonarSource.
the class ComponentActionTest method init.
private void init(Page... pages) {
PluginRepository pluginRepository = mock(PluginRepository.class);
when(pluginRepository.hasPlugin(anyString())).thenReturn(true);
PageRepository pageRepository = new PageRepository(pluginRepository, new PageDefinition[] { context -> {
for (Page page : pages) {
context.addPage(page);
}
} });
pageRepository.start();
ws = new WsActionTester(new ComponentAction(dbClient, pageRepository, resourceTypes, userSession, new ComponentFinder(dbClient), new QualityGateFinder(dbClient)));
}
use of org.sonar.core.platform.PluginRepository in project sonarqube by SonarSource.
the class DefaultI18nTest method before.
@Before
public void before() {
PluginRepository pluginRepository = mock(PluginRepository.class);
List<PluginInfo> plugins = Arrays.asList(newPlugin("sqale"), newPlugin("frpack"), newPlugin("checkstyle"), newPlugin("other"));
when(pluginRepository.getPluginInfos()).thenReturn(plugins);
underTest = new DefaultI18n(pluginRepository, system2);
underTest.doStart(getClass().getClassLoader());
}
Aggregations