use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.
the class ServerPluginJarExploderTest method copy_all_classloader_files_to_dedicated_directory.
@Test
public void copy_all_classloader_files_to_dedicated_directory() throws Exception {
File deployDir = temp.newFolder();
when(fs.getDeployedPluginsDir()).thenReturn(deployDir);
File jar = TestProjectUtils.jarOf("test-libs-plugin");
PluginInfo info = PluginInfo.create(jar);
ExplodedPlugin exploded = underTest.explode(info);
// all the files loaded by classloaders (JAR + META-INF/libs/*.jar) are copied to the dedicated directory
// web/deploy/{pluginKey}
File pluginDeployDir = new File(deployDir, "testlibs");
assertThat(exploded.getKey()).isEqualTo("testlibs");
assertThat(exploded.getMain()).isFile().exists().hasParent(pluginDeployDir);
assertThat(exploded.getLibs()).extracting("name").containsOnly("commons-daemon-1.0.15.jar", "commons-email-20030310.165926.jar");
for (File lib : exploded.getLibs()) {
assertThat(lib).exists().isFile();
assertThat(lib.getCanonicalPath()).startsWith(pluginDeployDir.getCanonicalPath());
}
}
use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.
the class ServerPluginRepositoryTest method plugin_is_compatible_if_no_entry_point_class_but_extend_other_plugin.
/**
* Some plugins can only extend the classloader of base plugin, without declaring new extensions.
*/
@Test
public void plugin_is_compatible_if_no_entry_point_class_but_extend_other_plugin() {
PluginInfo basePlugin = new PluginInfo("base").setMainClass("org.bar.Bar");
PluginInfo plugin = new PluginInfo("foo").setBasePlugin("base");
Map<String, PluginInfo> plugins = ImmutableMap.of("base", basePlugin, "foo", plugin);
assertThat(ServerPluginRepository.isCompatible(plugin, runtime, plugins)).isTrue();
}
use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.
the class ServerPluginRepositoryTest method plugin_is_incompatible_if_no_entry_point_class.
@Test
public void plugin_is_incompatible_if_no_entry_point_class() {
PluginInfo plugin = new PluginInfo("foo").setName("Foo");
assertThat(ServerPluginRepository.isCompatible(plugin, runtime, Collections.emptyMap())).isFalse();
assertThat(logs.logs()).contains("Plugin Foo [foo] is ignored because entry point class is not defined");
}
use of org.sonar.core.platform.PluginInfo 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.PluginInfo in project sonarqube by SonarSource.
the class PluginReferentialMetadataConverterTest method should_convert_info_to_plugin_referential.
@Test
public void should_convert_info_to_plugin_referential() {
PluginInfo info = new PluginInfo("foo");
PluginReferential pluginReferential = PluginReferentialMetadataConverter.getInstalledPluginReferential(newArrayList(info));
assertThat(pluginReferential).isNotNull();
assertThat(pluginReferential.getPlugins()).hasSize(1);
assertThat(pluginReferential.getPlugins().get(0).getKey()).isEqualTo("foo");
}
Aggregations