diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-02-18 18:33:19 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-02-18 18:33:19 +0100 |
commit | de6e3dddc1e85d0983a53b7d26b5fbfc40922cea (patch) | |
tree | cbd98e60dfeef8cfae90b9808776c61a8a6af181 | |
parent | 027e925c4f16d35a849a89611862b99a300be53d (diff) | |
download | sonarqube-de6e3dddc1e85d0983a53b7d26b5fbfc40922cea.tar.gz sonarqube-de6e3dddc1e85d0983a53b7d26b5fbfc40922cea.zip |
Removed classes that has been moved to the update center module
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/platform/Platform.java | 4 | ||||
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginCenterFactory.java (renamed from sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginReferentialFactory.java) | 4 | ||||
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/plugins/PluginUpdate.java | 92 | ||||
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/plugins/SonarUpdate.java | 100 | ||||
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrixFactory.java | 8 | ||||
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java | 6 | ||||
-rw-r--r-- | sonar-server/src/test/java/org/sonar/server/plugins/PluginUpdateTest.java | 74 | ||||
-rw-r--r-- | sonar-server/src/test/java/org/sonar/server/plugins/SonarUpdateTest.java | 61 |
8 files changed, 11 insertions, 338 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java index 7305d3f7699..835f141d075 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java @@ -79,7 +79,7 @@ import org.sonar.server.notifications.NotificationService; import org.sonar.server.notifications.reviews.ReviewsNotificationManager; import org.sonar.server.plugins.ApplicationDeployer; import org.sonar.server.plugins.DefaultServerPluginRepository; -import org.sonar.server.plugins.InstalledPluginReferentialFactory; +import org.sonar.server.plugins.InstalledPluginCenterFactory; import org.sonar.server.plugins.PluginDeployer; import org.sonar.server.plugins.PluginDownloader; import org.sonar.server.plugins.ServerExtensionInstaller; @@ -182,7 +182,7 @@ public final class Platform { rootContainer.addSingleton(daoClass); } rootContainer.addSingleton(PluginDeployer.class); - rootContainer.addSingleton(InstalledPluginReferentialFactory.class); + rootContainer.addSingleton(InstalledPluginCenterFactory.class); rootContainer.addSingleton(DefaultServerPluginRepository.class); rootContainer.addSingleton(DefaultServerFileSystem.class); diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginReferentialFactory.java b/sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginCenterFactory.java index f1fab59fe22..86b1f890801 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginReferentialFactory.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/InstalledPluginCenterFactory.java @@ -34,13 +34,13 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class InstalledPluginReferentialFactory implements ServerComponent { +public class InstalledPluginCenterFactory implements ServerComponent { private final PluginDeployer pluginDeployer; private PluginRepository pluginRepository; private Version sonarVersion; - public InstalledPluginReferentialFactory(PluginRepository pluginRepository, Server server, PluginDeployer pluginDeployer) { + public InstalledPluginCenterFactory(PluginRepository pluginRepository, Server server, PluginDeployer pluginDeployer) { this.pluginRepository = pluginRepository; this.pluginDeployer = pluginDeployer; this.sonarVersion = Version.create(server.getVersion()); diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/PluginUpdate.java b/sonar-server/src/main/java/org/sonar/server/plugins/PluginUpdate.java deleted file mode 100644 index ec3ed36077d..00000000000 --- a/sonar-server/src/main/java/org/sonar/server/plugins/PluginUpdate.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.server.plugins; - -import org.sonar.updatecenter.common.Plugin; -import org.sonar.updatecenter.common.Release; -import org.sonar.updatecenter.common.Version; - -@Deprecated -public final class PluginUpdate { - - public enum Status { - COMPATIBLE, INCOMPATIBLE, REQUIRE_SONAR_UPGRADE - } - - private Status status = Status.INCOMPATIBLE; - private Release release; - - public Status getStatus() { - return status; - } - - public boolean isCompatible() { - return Status.COMPATIBLE.equals(status); - } - - public boolean isIncompatible() { - return Status.INCOMPATIBLE.equals(status); - } - - public boolean requiresSonarUpgrade() { - return Status.REQUIRE_SONAR_UPGRADE.equals(status); - } - - public void setStatus(Status status) { - this.status = status; - } - - public Plugin getPlugin() { - return (Plugin)release.getArtifact(); - } - - public Release getRelease() { - return release; - } - - public void setRelease(Release release) { - this.release = release; - } - - public static PluginUpdate createWithStatus(Release pluginRelease, Status status) { - PluginUpdate update = new PluginUpdate(); - update.setRelease(pluginRelease); - update.setStatus(status); - return update; - } - - public static PluginUpdate createForPluginRelease(Release pluginRelease, Version sonarVersion) { - PluginUpdate update = new PluginUpdate(); - update.setRelease(pluginRelease); - - if (pluginRelease.supportSonarVersion(sonarVersion)) { - update.setStatus(Status.COMPATIBLE); - - } else { - for (Version requiredSonarVersion : pluginRelease.getRequiredSonarVersions()) { - if (requiredSonarVersion.compareTo(sonarVersion)>0) { - update.setStatus(Status.REQUIRE_SONAR_UPGRADE); - break; - } - } - } - return update; - } -} diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/SonarUpdate.java b/sonar-server/src/main/java/org/sonar/server/plugins/SonarUpdate.java deleted file mode 100644 index 6b4ef69f904..00000000000 --- a/sonar-server/src/main/java/org/sonar/server/plugins/SonarUpdate.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.server.plugins; - -import org.sonar.updatecenter.common.Plugin; -import org.sonar.updatecenter.common.Release; - -import java.util.ArrayList; -import java.util.List; - -@Deprecated -public final class SonarUpdate implements Comparable<SonarUpdate> { - - private Release release; - private List<Plugin> compatiblePlugins = new ArrayList<Plugin>(); - private List<Plugin> incompatiblePlugins = new ArrayList<Plugin>(); - private List<Release> pluginsToUpgrade = new ArrayList<Release>(); - - public SonarUpdate(Release release) { - this.release = release; - } - - public Release getRelease() { - return release; - } - - public List<Plugin> getCompatiblePlugins() { - return compatiblePlugins; - } - - public List<Plugin> getIncompatiblePlugins() { - return incompatiblePlugins; - } - - public List<Release> getPluginsToUpgrade() { - return pluginsToUpgrade; - } - - public boolean hasWarnings() { - return isIncompatible() || requiresPluginUpgrades(); - } - - public boolean requiresPluginUpgrades() { - return !pluginsToUpgrade.isEmpty(); - } - - public boolean isIncompatible() { - return !incompatiblePlugins.isEmpty(); - } - - public void addCompatiblePlugin(Plugin plugin) { - compatiblePlugins.add(plugin); - } - - public void addIncompatiblePlugin(Plugin plugin) { - incompatiblePlugins.add(plugin); - } - - public void addPluginToUpgrade(Release plugin) { - pluginsToUpgrade.add(plugin); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SonarUpdate update = (SonarUpdate) o; - return release.equals(update.release); - } - - @Override - public int hashCode() { - return release.hashCode(); - } - - public int compareTo(SonarUpdate su) { - return release.compareTo(su.release); - } -} diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrixFactory.java b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrixFactory.java index da8b9fe5c38..df1e60583da 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrixFactory.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrixFactory.java @@ -32,11 +32,11 @@ public final class UpdateCenterMatrixFactory implements ServerComponent { private UpdateCenterClient centerClient; private Version sonarVersion; - private InstalledPluginReferentialFactory installedPluginReferentialFactory; + private InstalledPluginCenterFactory installedPluginCenterFactory; - public UpdateCenterMatrixFactory(UpdateCenterClient centerClient, InstalledPluginReferentialFactory installedPluginReferentialFactory, Server server) { + public UpdateCenterMatrixFactory(UpdateCenterClient centerClient, InstalledPluginCenterFactory installedPluginCenterFactory, Server server) { this.centerClient = centerClient; - this.installedPluginReferentialFactory = installedPluginReferentialFactory; + this.installedPluginCenterFactory = installedPluginCenterFactory; this.sonarVersion = Version.create(server.getVersion()); } @@ -44,7 +44,7 @@ public final class UpdateCenterMatrixFactory implements ServerComponent { PluginReferential updateCenterPluginReferential = centerClient.getPlugins(refreshUpdateCenter); if (updateCenterPluginReferential != null) { return PluginCenter.create(updateCenterPluginReferential, - installedPluginReferentialFactory.getInstalledPluginReferential(), + installedPluginCenterFactory.getInstalledPluginReferential(), sonarVersion) .setDate(centerClient.getLastRefreshDate()); } else { diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java index 1b8d27f3b4e..05b736156be 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java @@ -72,7 +72,7 @@ import org.sonar.server.platform.ServerIdGenerator; import org.sonar.server.platform.ServerSettings; import org.sonar.server.platform.SettingsChangeNotifier; import org.sonar.server.plugins.DefaultServerPluginRepository; -import org.sonar.server.plugins.InstalledPluginReferentialFactory; +import org.sonar.server.plugins.InstalledPluginCenterFactory; import org.sonar.server.plugins.PluginDeployer; import org.sonar.server.plugins.PluginDownloader; import org.sonar.server.plugins.UpdateCenterMatrixFactory; @@ -178,7 +178,7 @@ public final class JRubyFacade { } public void uninstallPlugin(String pluginKey) { - get(InstalledPluginReferentialFactory.class).uninstall(pluginKey); + get(InstalledPluginCenterFactory.class).uninstall(pluginKey); } public void cancelPluginUninstalls() { @@ -194,7 +194,7 @@ public final class JRubyFacade { } public PluginCenter getInstalledPluginCenter() { - return get(InstalledPluginReferentialFactory.class).getPluginCenter(); + return get(InstalledPluginCenterFactory.class).getPluginCenter(); } // PLUGINS ------------------------------------------------------------------ diff --git a/sonar-server/src/test/java/org/sonar/server/plugins/PluginUpdateTest.java b/sonar-server/src/test/java/org/sonar/server/plugins/PluginUpdateTest.java deleted file mode 100644 index e433f83014c..00000000000 --- a/sonar-server/src/test/java/org/sonar/server/plugins/PluginUpdateTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.server.plugins; - -import org.junit.Test; -import org.sonar.updatecenter.common.Plugin; -import org.sonar.updatecenter.common.Release; -import org.sonar.updatecenter.common.Version; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; - -public class PluginUpdateTest { - - @Test - public void createForCompatibleRelease() { - Version sonarVersion = Version.create("2.2"); - Release pluginRelease = new Release(new Plugin("fake"), "1.0"); - pluginRelease.addRequiredSonarVersions(Version.create("2.1"), Version.create("2.2"), Version.create("2.3")); - - PluginUpdate update = PluginUpdate.createForPluginRelease(pluginRelease, sonarVersion); - - assertThat(update.getRelease(), is(pluginRelease)); - assertThat(update.isCompatible(), is(true)); - assertThat(update.isIncompatible(), is(false)); - assertThat(update.requiresSonarUpgrade(), is(false)); - } - - @Test - public void createForSonarUpgrade() { - Version sonarVersion = Version.create("2.0"); - Release pluginRelease = new Release(new Plugin("fake"), "1.0"); - pluginRelease.addRequiredSonarVersions(Version.create("2.1"), Version.create("2.2"), Version.create("2.3")); - - PluginUpdate update = PluginUpdate.createForPluginRelease(pluginRelease, sonarVersion); - - assertThat(update.getRelease(), is(pluginRelease)); - assertThat(update.isCompatible(), is(false)); - assertThat(update.isIncompatible(), is(false)); - assertThat(update.requiresSonarUpgrade(), is(true)); - } - - @Test - public void createForIncompatibleReleae() { - Version sonarVersion = Version.create("2.4"); - Release pluginRelease = new Release(new Plugin("fake"), "1.0"); - pluginRelease.addRequiredSonarVersions(Version.create("2.1"), Version.create("2.2"), Version.create("2.3")); - - // the plugin is only compatible with older versions of sonar - PluginUpdate update = PluginUpdate.createForPluginRelease(pluginRelease, sonarVersion); - - assertThat(update.getRelease(), is(pluginRelease)); - assertThat(update.isCompatible(), is(false)); - assertThat(update.isIncompatible(), is(true)); - assertThat(update.requiresSonarUpgrade(), is(false)); - } -} diff --git a/sonar-server/src/test/java/org/sonar/server/plugins/SonarUpdateTest.java b/sonar-server/src/test/java/org/sonar/server/plugins/SonarUpdateTest.java deleted file mode 100644 index ea93b1cfca0..00000000000 --- a/sonar-server/src/test/java/org/sonar/server/plugins/SonarUpdateTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.server.plugins; - -import org.junit.Test; -import org.sonar.updatecenter.common.Plugin; -import org.sonar.updatecenter.common.Release; -import org.sonar.updatecenter.common.Sonar; -import org.sonar.updatecenter.common.Version; - -import static org.fest.assertions.Assertions.assertThat; - -public class SonarUpdateTest { - - @Test - public void incompatibleUpdateIfSomePluginsAreIncompatible() { - SonarUpdate update = new SonarUpdate(new Release(new Sonar(), "2.3")); - update.addIncompatiblePlugin(new Plugin("old")); - - assertThat(update.isIncompatible()).isTrue(); - assertThat(update.hasWarnings()).isTrue(); - assertThat(update.requiresPluginUpgrades()).isFalse(); - } - - @Test - public void incompatibleUpdateIfRequiredPluginUpgrades() { - SonarUpdate update = new SonarUpdate(new Release(new Sonar(), "2.3")); - update.addPluginToUpgrade(new Release(new Plugin("old"), Version.create("0.2"))); - - assertThat(update.isIncompatible()).isFalse(); - assertThat(update.hasWarnings()).isTrue(); - assertThat(update.requiresPluginUpgrades()).isTrue(); - } - - @Test - public void equals() { - SonarUpdate update1 = new SonarUpdate(new Release(new Sonar(), "2.2")); - SonarUpdate update2 = new SonarUpdate(new Release(new Sonar(), "2.3")); - - assertThat(update1).isEqualTo(update1); - assertThat(update1).isEqualTo(new SonarUpdate(new Release(new Sonar(), "2.2"))); - assertThat(update1).isNotEqualTo(update2); - } -} |