use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.
the class PluginsMonitorTest method plugin_name_and_version.
@Test
public void plugin_name_and_version() {
when(repo.getPluginInfos()).thenReturn(Arrays.asList(new PluginInfo("key-1").setName("plugin-1").setVersion(Version.create("1.1")), new PluginInfo("key-2").setName("plugin-2").setVersion(Version.create("2.2")), new PluginInfo("no-version").setName("No Version")));
Map<String, Object> attributes = underTest.attributes();
assertThat(attributes).containsKeys("key-1", "key-2");
assertThat((Map) attributes.get("key-1")).containsEntry("Name", "plugin-1").containsEntry("Version", "1.1");
assertThat((Map) attributes.get("key-2")).containsEntry("Name", "plugin-2").containsEntry("Version", "2.2");
assertThat((Map) attributes.get("no-version")).containsEntry("Name", "No Version").doesNotContainKey("Version");
}
use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.
the class InstalledActionTest method verify_properties_displayed_in_json_per_plugin.
@Test
public void verify_properties_displayed_in_json_per_plugin() throws Exception {
logInAsSystemAdministrator();
String jarFilename = getClass().getSimpleName() + "/" + "some.jar";
when(pluginRepository.getPluginInfos()).thenReturn(of(new PluginInfo("plugKey").setName("plugName").setDescription("desc_it").setVersion(Version.create("1.0")).setLicense("license_hey").setOrganizationName("org_name").setOrganizationUrl("org_url").setHomepageUrl("homepage_url").setIssueTrackerUrl("issueTracker_url").setImplementationBuild("sou_rev_sha1").setJarFile(new File(getClass().getResource(jarFilename).toURI()))));
underTest.handle(request, response);
verifyZeroInteractions(updateCenterMatrixFactory);
assertJson(response.outputAsString()).isSimilarTo("{" + " \"plugins\":" + " [" + " {" + " \"key\": \"plugKey\"," + " \"name\": \"plugName\"," + " \"description\": \"desc_it\"," + " \"version\": \"1.0\"," + " \"license\": \"license_hey\"," + " \"organizationName\": \"org_name\"," + " \"organizationUrl\": \"org_url\"," + " \"homepageUrl\": \"homepage_url\"," + " \"issueTrackerUrl\": \"issueTracker_url\"," + " \"implementationBuild\": \"sou_rev_sha1\"" + " }" + " ]" + "}");
}
use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.
the class PendingActionTest method verify_properties_displayed_in_json_per_installing_removing_and_updating_plugins.
@Test
public void verify_properties_displayed_in_json_per_installing_removing_and_updating_plugins() throws Exception {
logInAsSystemAdministrator();
PluginInfo installed = newPluginInfo("java");
PluginInfo removedPlugin = newPluginInfo("js");
PluginInfo newPlugin = newPluginInfo("php");
newUpdateCenter("scmgit");
when(serverPluginRepository.getPluginInfos()).thenReturn(of(installed));
when(serverPluginRepository.getUninstalledPlugins()).thenReturn(of(removedPlugin));
when(pluginDownloader.getDownloadedPlugins()).thenReturn(of(newPlugin, installed));
underTest.handle(request, response);
assertJson(response.outputAsString()).isSimilarTo("{" + " \"installing\":" + " [" + " {" + " \"key\": \"php\"" + " }" + " ]," + " \"removing\":" + " [" + " {" + " \"key\": \"js\"" + " }" + " ]," + " \"updating\": " + " [" + " {" + " \"key\": \"java\"" + " }" + " ]" + "}");
}
use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.
the class CePluginRepository method getPluginInfo.
@Override
public PluginInfo getPluginInfo(String key) {
checkState(started.get(), NOT_STARTED_YET);
PluginInfo info = pluginInfosByKeys.get(key);
if (info == null) {
throw new IllegalArgumentException(format("Plugin [%s] does not exist", key));
}
return info;
}
use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.
the class CePluginJarExploderTest method plugins_do_not_overlap.
@Test
public void plugins_do_not_overlap() throws Exception {
PluginInfo info1 = PluginInfo.create(plugin1Jar());
PluginInfo info2 = PluginInfo.create(plugin2Jar());
ExplodedPlugin exploded1 = underTest.explode(info1);
ExplodedPlugin exploded2 = underTest.explode(info2);
assertThat(exploded1.getKey()).isEqualTo("test");
assertThat(exploded1.getMain()).isFile().exists().hasName("sonar-test-plugin-0.1-SNAPSHOT.jar");
assertThat(exploded2.getKey()).isEqualTo("test2");
assertThat(exploded2.getMain()).isFile().exists().hasName("sonar-test2-plugin-0.1-SNAPSHOT.jar");
}
Aggregations