Search in sources :

Example 1 with Plugin

use of org.sonar.updatecenter.common.Plugin in project sonarqube by SonarSource.

the class UpgradesAction method writeIncompatiblePlugins.

private void writeIncompatiblePlugins(JsonWriter jsonWriter, List<Plugin> incompatiblePlugins) {
    jsonWriter.name(ARRAY_INCOMPATIBLE).beginArray();
    for (Plugin incompatiblePlugin : incompatiblePlugins) {
        jsonWriter.beginObject();
        pluginWSCommons.writePlugin(jsonWriter, incompatiblePlugin);
        jsonWriter.endObject();
    }
    jsonWriter.endArray();
}
Also used : Plugin(org.sonar.updatecenter.common.Plugin)

Example 2 with Plugin

use of org.sonar.updatecenter.common.Plugin in project sonarqube by SonarSource.

the class UpdatesAction method writePluginUpdateAggregate.

private void writePluginUpdateAggregate(JsonWriter jsonWriter, PluginUpdateAggregate aggregate) {
    jsonWriter.beginObject();
    Plugin plugin = aggregate.getPlugin();
    pluginWSCommons.writePlugin(jsonWriter, plugin);
    writeUpdates(jsonWriter, aggregate.getUpdates());
    jsonWriter.endObject();
}
Also used : Plugin(org.sonar.updatecenter.common.Plugin)

Example 3 with Plugin

use of org.sonar.updatecenter.common.Plugin in project sonarqube by SonarSource.

the class PluginUpdateAggregator method aggregate.

public Collection<PluginUpdateAggregate> aggregate(@Nullable Collection<PluginUpdate> pluginUpdates) {
    if (pluginUpdates == null || pluginUpdates.isEmpty()) {
        return Collections.emptyList();
    }
    Map<Plugin, PluginUpdateAggregateBuilder> builders = Maps.newHashMap();
    for (PluginUpdate pluginUpdate : pluginUpdates) {
        Plugin plugin = pluginUpdate.getPlugin();
        PluginUpdateAggregateBuilder builder = builders.get(plugin);
        if (builder == null) {
            builder = PluginUpdateAggregateBuilder.builderFor(plugin);
            builders.put(plugin, builder);
        }
        builder.add(pluginUpdate);
    }
    return Lists.newArrayList(transform(builders.values(), BuilderToPluginUpdateAggregate.INSTANCE));
}
Also used : PluginUpdate(org.sonar.updatecenter.common.PluginUpdate) Plugin(org.sonar.updatecenter.common.Plugin)

Example 4 with Plugin

use of org.sonar.updatecenter.common.Plugin in project sonarqube by SonarSource.

the class PluginWSCommons method writeUpdateProperties.

/**
   * Write the update properties to the specified jsonwriter.
   * <pre>
   * "status": "COMPATIBLE",
   * "requires": [
   *   {
   *     "key": "java",
   *     "name": "Java",
   *     "description": "SonarQube rule engine."
   *   }
   * ]
   * </pre>
   */
public void writeUpdateProperties(JsonWriter jsonWriter, PluginUpdate pluginUpdate) {
    jsonWriter.prop(PROPERTY_STATUS, toJSon(pluginUpdate.getStatus()));
    jsonWriter.name(ARRAY_REQUIRES).beginArray();
    Release release = pluginUpdate.getRelease();
    for (Plugin child : filter(transform(release.getOutgoingDependencies(), ReleaseToArtifact.INSTANCE), Plugin.class)) {
        jsonWriter.beginObject();
        jsonWriter.prop(PROPERTY_KEY, child.getKey());
        jsonWriter.prop(PROPERTY_NAME, child.getName());
        jsonWriter.prop(PROPERTY_DESCRIPTION, child.getDescription());
        jsonWriter.endObject();
    }
    jsonWriter.endArray();
}
Also used : Release(org.sonar.updatecenter.common.Release) Plugin(org.sonar.updatecenter.common.Plugin)

Example 5 with Plugin

use of org.sonar.updatecenter.common.Plugin in project sonarqube by SonarSource.

the class UpgradesActionTest method createSonar_51_update.

private static SonarUpdate createSonar_51_update() {
    Plugin brandingPlugin = Plugin.factory("branding").setCategory("Integration").setName("Branding").setDescription("Allows to add your own logo to the SonarQube UI.").setHomepageUrl("http://docs.codehaus.org/display/SONAR/Branding+Plugin").setLicense("GNU LGPL 3").setOrganization("SonarSource").setOrganizationUrl("http://www.sonarsource.com").setIssueTrackerUrl("http://jira.sonarsource.com/browse/SONARPLUGINS/component/14663").setSourcesUrl("https://github.com/SonarCommunity/sonar-branding");
    Plugin viewsPlugin = Plugin.factory("views").setName("Views").setCategory("Governance").setDescription("Create aggregation trees to group projects. Projects can for instance be grouped by applications,   applications by team, teams by department.").setHomepageUrl("https://redirect.sonarsource.com/plugins/views.html").setLicense("Commercial").setOrganization("SonarSource").setOrganizationUrl("http://www.sonarsource.com").setTermsConditionsUrl("http://dist.sonarsource.com/SonarSource_Terms_And_Conditions.pdf").setIssueTrackerUrl("http://jira.sonarsource.com/browse/VIEWS");
    release = new Release(new Sonar(), Version.create("5.1.0.5498")).setDate(DateUtils.parseDate("2015-04-02")).setDescription("New overall layout, merge Issues Drilldown [...]").setDownloadUrl("http://dist.sonar.codehaus.org/sonarqube-5.1.zip").setChangelogUrl("http://jira.sonarsource.com/secure/ReleaseNote.jspa?projectId=11694&version=20666");
    SonarUpdate sonarUpdate = new SonarUpdate(release);
    sonarUpdate.addIncompatiblePlugin(brandingPlugin);
    sonarUpdate.addPluginToUpgrade(new Release(viewsPlugin, Version.create("2.8.0.5498")).setDisplayVersion("2.8 (build 5498)"));
    return sonarUpdate;
}
Also used : Sonar(org.sonar.updatecenter.common.Sonar) Release(org.sonar.updatecenter.common.Release) Plugin(org.sonar.updatecenter.common.Plugin) SonarUpdate(org.sonar.updatecenter.common.SonarUpdate)

Aggregations

Plugin (org.sonar.updatecenter.common.Plugin)16 Release (org.sonar.updatecenter.common.Release)9 Test (org.junit.Test)7 File (java.io.File)5 URI (java.net.URI)4 SonarException (org.sonar.api.utils.SonarException)2 ArrayList (java.util.ArrayList)1 JsonWriter (org.sonar.api.utils.text.JsonWriter)1 PluginInfo (org.sonar.core.platform.PluginInfo)1 PluginUpdate (org.sonar.updatecenter.common.PluginUpdate)1 Sonar (org.sonar.updatecenter.common.Sonar)1 SonarUpdate (org.sonar.updatecenter.common.SonarUpdate)1 UpdateCenter (org.sonar.updatecenter.common.UpdateCenter)1