use of org.sonar.updatecenter.common.PluginManifest in project sonarqube by SonarSource.
the class PluginInfoTest method create_from_complete_manifest.
@Test
public void create_from_complete_manifest() throws Exception {
PluginManifest manifest = new PluginManifest();
manifest.setKey("fbcontrib");
manifest.setVersion("2.0");
manifest.setName("Java");
manifest.setMainClass("org.fb.FindbugsPlugin");
manifest.setBasePlugin("findbugs");
manifest.setSonarVersion("4.5.1");
manifest.setDescription("the desc");
manifest.setHomepage("http://fbcontrib.org");
manifest.setImplementationBuild("SHA1");
manifest.setLicense("LGPL");
manifest.setOrganization("SonarSource");
manifest.setOrganizationUrl("http://sonarsource.com");
manifest.setIssueTrackerUrl("http://jira.com");
manifest.setRequirePlugins(new String[] { "java:2.0", "pmd:1.3" });
manifest.setSonarLintSupported(true);
File jarFile = temp.newFile();
PluginInfo pluginInfo = PluginInfo.create(jarFile, manifest);
assertThat(pluginInfo.getBasePlugin()).isEqualTo("findbugs");
assertThat(pluginInfo.getDescription()).isEqualTo("the desc");
assertThat(pluginInfo.getHomepageUrl()).isEqualTo("http://fbcontrib.org");
assertThat(pluginInfo.getImplementationBuild()).isEqualTo("SHA1");
assertThat(pluginInfo.getIssueTrackerUrl()).isEqualTo("http://jira.com");
assertThat(pluginInfo.getLicense()).isEqualTo("LGPL");
assertThat(pluginInfo.getOrganizationName()).isEqualTo("SonarSource");
assertThat(pluginInfo.getOrganizationUrl()).isEqualTo("http://sonarsource.com");
assertThat(pluginInfo.getMinimalSqVersion().getName()).isEqualTo("4.5.1");
assertThat(pluginInfo.getRequiredPlugins()).extracting("key").containsOnly("java", "pmd");
assertThat(pluginInfo.isSonarLintSupported()).isTrue();
}
use of org.sonar.updatecenter.common.PluginManifest in project sonarqube by SonarSource.
the class PluginReferentialMetadataConverter method toPluginManifest.
private static PluginManifest toPluginManifest(PluginInfo metadata) {
PluginManifest pluginManifest = new PluginManifest();
pluginManifest.setKey(metadata.getKey());
pluginManifest.setName(metadata.getName());
Version version = metadata.getVersion();
if (version != null) {
pluginManifest.setVersion(version.getName());
}
pluginManifest.setDescription(metadata.getDescription());
pluginManifest.setMainClass(metadata.getMainClass());
pluginManifest.setOrganization(metadata.getOrganizationName());
pluginManifest.setOrganizationUrl(metadata.getOrganizationUrl());
pluginManifest.setLicense(metadata.getLicense());
pluginManifest.setHomepage(metadata.getHomepageUrl());
pluginManifest.setIssueTrackerUrl(metadata.getIssueTrackerUrl());
pluginManifest.setBasePlugin(metadata.getBasePlugin());
pluginManifest.setRequirePlugins(Collections2.transform(metadata.getRequiredPlugins(), RequiredPluginToString.INSTANCE).toArray(new String[metadata.getRequiredPlugins().size()]));
return pluginManifest;
}
use of org.sonar.updatecenter.common.PluginManifest in project sonarqube by SonarSource.
the class PluginInfoTest method create_from_minimal_manifest.
@Test
public void create_from_minimal_manifest() throws Exception {
PluginManifest manifest = new PluginManifest();
manifest.setKey("java");
manifest.setVersion("1.0");
manifest.setName("Java");
manifest.setMainClass("org.foo.FooPlugin");
File jarFile = temp.newFile();
PluginInfo pluginInfo = PluginInfo.create(jarFile, manifest);
assertThat(pluginInfo.getKey()).isEqualTo("java");
assertThat(pluginInfo.getName()).isEqualTo("Java");
assertThat(pluginInfo.getVersion().getName()).isEqualTo("1.0");
assertThat(pluginInfo.getJarFile()).isSameAs(jarFile);
assertThat(pluginInfo.getMainClass()).isEqualTo("org.foo.FooPlugin");
assertThat(pluginInfo.getBasePlugin()).isNull();
assertThat(pluginInfo.getDescription()).isNull();
assertThat(pluginInfo.getHomepageUrl()).isNull();
assertThat(pluginInfo.getImplementationBuild()).isNull();
assertThat(pluginInfo.getIssueTrackerUrl()).isNull();
assertThat(pluginInfo.getLicense()).isNull();
assertThat(pluginInfo.getOrganizationName()).isNull();
assertThat(pluginInfo.getOrganizationUrl()).isNull();
assertThat(pluginInfo.getMinimalSqVersion()).isNull();
assertThat(pluginInfo.getRequiredPlugins()).isEmpty();
assertThat(pluginInfo.isSonarLintSupported()).isFalse();
}
Aggregations