From: Julien Lancelot Date: Fri, 15 Jul 2016 09:06:02 +0000 (+0200) Subject: SONAR-7857 Upgrade to update center 1.17 X-Git-Tag: 6.0-RC1~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ee511e6f3a303d97c80968a1eaf808ec0e5ccdcc;p=sonarqube.git SONAR-7857 Upgrade to update center 1.17 --- diff --git a/pom.xml b/pom.xml index 2b6ce8740d6..9aba3be4934 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ - 1.16-build309 + 1.17 4.0 2.14 5.3.1 diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/UpgradesActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/UpgradesActionTest.java index e567008154b..478efa5001a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/UpgradesActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/UpgradesActionTest.java @@ -109,7 +109,7 @@ public class UpgradesActionTest { } private static SonarUpdate createSonar_51_update() { - Plugin brandingPlugin = new Plugin("branding") + Plugin brandingPlugin = Plugin.factory("branding") .setCategory("Integration") .setName("Branding") .setDescription("Allows to add your own logo to the SonarQube UI.") @@ -119,7 +119,7 @@ public class UpgradesActionTest { .setOrganizationUrl("http://www.sonarsource.com") .setIssueTrackerUrl("http://jira.sonarsource.com/browse/SONARPLUGINS/component/14663") .setSourcesUrl("https://github.com/SonarCommunity/sonar-branding"); - Plugin viewsPlugin = new Plugin("views") + 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.") diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java index a80c2eca182..82aeee20103 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java @@ -112,7 +112,7 @@ public class PluginDownloaderTest { @Test public void download_from_url() { - Plugin test = new Plugin("test"); + Plugin test = Plugin.factory("test"); Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/test-1.0.jar"); test.addRelease(test10); @@ -132,7 +132,7 @@ public class PluginDownloaderTest { public void download_when_update_center_is_unavailable_with_no_exception_thrown() { when(updateCenterMatrixFactory.getUpdateCenter(anyBoolean())).thenReturn(Optional.absent()); - Plugin test = new Plugin("test"); + Plugin test = Plugin.factory("test"); Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/test-1.0.jar"); test.addRelease(test10); @@ -145,7 +145,7 @@ public class PluginDownloaderTest { */ @Test public void download_from_redirect_url() { - Plugin test = new Plugin("plugin-test"); + Plugin test = Plugin.factory("plugintest"); Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/redirect?r=release&g=test&a=test&v=1.0&e=jar"); test.addRelease(test10); @@ -156,9 +156,9 @@ public class PluginDownloaderTest { // SONAR-4523: do not corrupt JAR files when restarting the server while a plugin is being downloaded. // The JAR file is downloaded in a temp file - verify(httpDownloader).download(any(URI.class), argThat(new HasFileName("plugin-test-1.0.jar.tmp"))); - assertThat(new File(downloadDir, "plugin-test-1.0.jar")).exists(); - assertThat(new File(downloadDir, "plugin-test-1.0.jar.tmp")).doesNotExist(); + verify(httpDownloader).download(any(URI.class), argThat(new HasFileName("plugintest-1.0.jar.tmp"))); + assertThat(new File(downloadDir, "plugintest-1.0.jar")).exists(); + assertThat(new File(downloadDir, "plugintest-1.0.jar.tmp")).doesNotExist(); } @Test @@ -186,7 +186,7 @@ public class PluginDownloaderTest { @Test public void download_from_file() throws Exception { - Plugin test = new Plugin("test"); + Plugin test = Plugin.factory("test"); File file = testFolder.newFile("test-1.0.jar"); file.createNewFile(); Release test10 = new Release(test, "1.0").setDownloadUrl("file://" + separatorsToUnix(file.getCanonicalPath())); @@ -202,7 +202,7 @@ public class PluginDownloaderTest { @Test public void throw_exception_if_could_not_download() { - Plugin test = new Plugin("test"); + Plugin test = Plugin.factory("test"); Release test10 = new Release(test, "1.0").setDownloadUrl("file://not_found"); test.addRelease(test10); @@ -219,7 +219,7 @@ public class PluginDownloaderTest { @Test public void throw_exception_if_download_fail() { - Plugin test = new Plugin("test"); + Plugin test = Plugin.factory("test"); Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/test-1.0.jar"); test.addRelease(test10); when(updateCenter.findInstallablePlugins("foo", create("1.0"))).thenReturn(newArrayList(test10)); @@ -279,15 +279,15 @@ public class PluginDownloaderTest { // SONAR-5011 @Test public void download_common_transitive_dependency() { - Plugin test1 = new Plugin("test1"); + Plugin test1 = Plugin.factory("test1"); Release test1R = new Release(test1, "1.0").setDownloadUrl("http://server/test1-1.0.jar"); test1.addRelease(test1R); - Plugin test2 = new Plugin("test2"); + Plugin test2 = Plugin.factory("test2"); Release test2R = new Release(test2, "1.0").setDownloadUrl("http://server/test2-1.0.jar"); test2.addRelease(test2R); - Plugin testDep = new Plugin("testdep"); + Plugin testDep = Plugin.factory("testdep"); Release testDepR = new Release(testDep, "1.0").setDownloadUrl("http://server/testdep-1.0.jar"); testDep.addRelease(testDepR); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AbstractUpdateCenterBasedPluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AbstractUpdateCenterBasedPluginsWsActionTest.java index c8cb5055cde..cf2d8ba51f9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AbstractUpdateCenterBasedPluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AbstractUpdateCenterBasedPluginsWsActionTest.java @@ -20,6 +20,7 @@ package org.sonar.server.plugins.ws; import com.google.common.base.Optional; +import java.net.URL; import org.junit.Before; import org.sonar.api.server.ws.Request; import org.sonar.api.utils.DateUtils; @@ -31,8 +32,6 @@ import org.sonar.updatecenter.common.Release; import org.sonar.updatecenter.common.UpdateCenter; import org.sonar.updatecenter.common.Version; -import java.net.URL; - import static org.mockito.Matchers.anyBoolean; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -45,8 +44,8 @@ public abstract class AbstractUpdateCenterBasedPluginsWsActionTest { "{" + " \"plugins\":" + "[]" + "}"; - protected static final Plugin PLUGIN_1 = new Plugin("p_key_1").setName("p_name_1"); - protected static final Plugin PLUGIN_2 = new Plugin("p_key_2").setName("p_name_2").setDescription("p_desc_2"); + protected static final Plugin PLUGIN_1 = Plugin.factory("pkey1").setName("p_name_1"); + protected static final Plugin PLUGIN_2 = Plugin.factory("pkey2").setName("p_name_2").setDescription("p_desc_2"); protected UpdateCenterMatrixFactory updateCenterFactory = mock(UpdateCenterMatrixFactory.class); protected UpdateCenter updateCenter = mock(UpdateCenter.class); @@ -68,7 +67,7 @@ public abstract class AbstractUpdateCenterBasedPluginsWsActionTest { protected static PluginUpdate pluginUpdate(String key, String name) { return PluginUpdate.createWithStatus( - new Release(new Plugin(key).setName(name), Version.create("1.0")), + new Release(Plugin.factory(key).setName(name), Version.create("1.0")), COMPATIBLE ); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailableActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailableActionTest.java index 27db1d72c2d..f5d10cec26f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailableActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailableActionTest.java @@ -41,7 +41,7 @@ import static org.sonar.updatecenter.common.PluginUpdate.Status.REQUIRE_SONAR_UP public class AvailableActionTest extends AbstractUpdateCenterBasedPluginsWsActionTest { - private static final Plugin FULL_PROPERTIES_PLUGIN = new Plugin("p_key") + private static final Plugin FULL_PROPERTIES_PLUGIN = Plugin.factory("pkey") .setName("p_name") .setCategory("p_category") .setDescription("p_description") diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallActionTest.java index 33ddda90f62..a93b3c9153d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallActionTest.java @@ -137,7 +137,7 @@ public class InstallActionTest { public void if_plugin_is_found_available_download_is_triggered_with_latest_version_from_updatecenter() throws Exception { Version version = Version.create("1.0"); when(updateCenter.findAvailablePlugins()).thenReturn(ImmutableList.of( - PluginUpdate.createWithStatus(new Release(new Plugin(PLUGIN_KEY), version), PluginUpdate.Status.COMPATIBLE) + PluginUpdate.createWithStatus(new Release(Plugin.factory(PLUGIN_KEY), version), PluginUpdate.Status.COMPATIBLE) )); WsTester.Result result = validRequest.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java index 2ecc8132f0c..58c1dd49a57 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java @@ -169,7 +169,7 @@ public class InstalledActionTest { when(updateCenterMatrixFactory.getUpdateCenter(false)).thenReturn(Optional.of(updateCenter)); when(updateCenter.findAllCompatiblePlugins()).thenReturn( Arrays.asList( - new Plugin("plugKey") + Plugin.factory("plugKey") .setCategory("cat_1") ) ); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingActionTest.java index 7b82a95890a..6a2cf6d56fd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingActionTest.java @@ -304,7 +304,7 @@ public class PendingActionTest { when(updateCenterMatrixFactory.getUpdateCenter(false)).thenReturn(Optional.of(updateCenter)); List plugins = new ArrayList<>(); for (String pluginKey : pluginKeys) { - plugins.add(new Plugin(pluginKey).setCategory("cat_1")); + plugins.add(Plugin.factory(pluginKey).setCategory("cat_1")); } when(updateCenter.findAllCompatiblePlugins()).thenReturn(plugins); return updateCenter; diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregateBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregateBuilderTest.java index 4e94607746d..b16c897031e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregateBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregateBuilderTest.java @@ -28,8 +28,8 @@ import org.sonar.updatecenter.common.Version; public class PluginUpdateAggregateBuilderTest { - private static final Plugin PLUGIN_1 = new Plugin("key1"); - private static final Plugin PLUGIN_2 = new Plugin("key2"); + private static final Plugin PLUGIN_1 = Plugin.factory("key1"); + private static final Plugin PLUGIN_2 = Plugin.factory("key2"); private static final Version SOME_VERSION = Version.create("1.0"); private static final PluginUpdate.Status SOME_STATUS = PluginUpdate.Status.COMPATIBLE; @@ -49,10 +49,10 @@ public class PluginUpdateAggregateBuilderTest { public void add_uses_equals_which_takes_only_key_into_account() { PluginUpdateAggregateBuilder builder = PluginUpdateAggregateBuilder.builderFor(PLUGIN_1); - builder.add(createPluginUpdate(new Plugin(PLUGIN_1.getKey()))); + builder.add(createPluginUpdate(Plugin.factory(PLUGIN_1.getKey()))); } private static PluginUpdate createPluginUpdate(Plugin plugin) { return PluginUpdate.createWithStatus(new Release(plugin, SOME_VERSION), SOME_STATUS); } -} \ No newline at end of file +} diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregatorTest.java index a3cfb7d910c..899dbbc2bef 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregatorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregatorTest.java @@ -20,15 +20,14 @@ package org.sonar.server.plugins.ws; import com.google.common.collect.ImmutableList; +import java.util.Collection; +import java.util.Collections; import org.junit.Test; import org.sonar.updatecenter.common.Plugin; import org.sonar.updatecenter.common.PluginUpdate; import org.sonar.updatecenter.common.Release; import org.sonar.updatecenter.common.Version; -import java.util.Collection; -import java.util.Collections; - import static org.assertj.core.api.Assertions.assertThat; public class PluginUpdateAggregatorTest { @@ -81,6 +80,6 @@ public class PluginUpdateAggregatorTest { } private PluginUpdate createPluginUpdate(String pluginKey) { - return PluginUpdate.createWithStatus(new Release(new Plugin(pluginKey), SOME_VERSION), SOME_STATUS); + return PluginUpdate.createWithStatus(new Release(Plugin.factory(pluginKey), SOME_VERSION), SOME_STATUS); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginWSCommonsTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginWSCommonsTest.java index 63d87e9fc4f..e232f225f76 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginWSCommonsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginWSCommonsTest.java @@ -86,7 +86,7 @@ public class PluginWSCommonsTest { jsonWriter.close(); assertJson(response.outputAsString()).isSimilarTo("{" + - " \"key\": \"p_key\"," + + " \"key\": \"pkey\"," + " \"name\": \"p_name\"," + " \"description\": \"p_description\"," + " \"category\": \"p_category\"," + @@ -109,7 +109,7 @@ public class PluginWSCommonsTest { jsonWriter.close(); assertJson(response.outputAsString()).isSimilarTo("{" + - " \"key\": \"p_key\"," + + " \"key\": \"pkey\"," + " \"name\": \"p_name\"," + " \"description\": \"p_description\"," + " \"category\": \"p_category\"," + @@ -140,7 +140,7 @@ public class PluginWSCommonsTest { @Test public void writeArtifact_from_release_writes_artifact_object_and_file_name() { jsonWriter.beginObject(); - underTest.writeArtifact(jsonWriter, release("p_key").setDownloadUrl("http://toto.com/file.jar")); + underTest.writeArtifact(jsonWriter, release("pkey").setDownloadUrl("http://toto.com/file.jar")); jsonWriter.endObject(); jsonWriter.close(); @@ -188,7 +188,7 @@ public class PluginWSCommonsTest { " \"update\": {" + " \"requires\": [" + " {" + - " \"key\": \"p_key\"," + + " \"key\": \"pkey\"," + " \"name\": \"p_name\"," + " \"description\": \"p_description\"" + " }" + @@ -202,7 +202,7 @@ public class PluginWSCommonsTest { } private static Release release(String key) { - return new Release(new Plugin(key), version("1.0")); + return new Release(Plugin.factory(key), version("1.0")); } private PluginInfo gitPluginInfo() { @@ -218,7 +218,7 @@ public class PluginWSCommonsTest { } private Plugin newPlugin() { - return new Plugin("p_key") + return Plugin.factory("pkey") .setName("p_name") .setCategory("p_category") .setDescription("p_description") diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdateActionTest.java index d625790cfff..be00df7ebb4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdateActionTest.java @@ -139,7 +139,7 @@ public class UpdateActionTest { public void if_plugin_has_an_update_download_is_triggered_with_latest_version_from_updatecenter() throws Exception { Version version = Version.create("1.0"); when(updateCenter.findPluginUpdates()).thenReturn(ImmutableList.of( - PluginUpdate.createWithStatus(new Release(new Plugin(PLUGIN_KEY), version), Status.COMPATIBLE) + PluginUpdate.createWithStatus(new Release(Plugin.factory(PLUGIN_KEY), version), Status.COMPATIBLE) )); underTest.handle(validRequest, response); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesActionTest.java index 0b4ab210e14..64589dbe2cb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesActionTest.java @@ -34,10 +34,10 @@ import static org.sonar.updatecenter.common.PluginUpdate.Status.COMPATIBLE; import static org.sonar.updatecenter.common.PluginUpdate.Status.INCOMPATIBLE; public class UpdatesActionTest extends AbstractUpdateCenterBasedPluginsWsActionTest { - private static final Plugin JAVA_PLUGIN = new Plugin("java") + private static final Plugin JAVA_PLUGIN = Plugin.factory("java") .setName("Java") .setDescription("SonarQube rule engine."); - private static final Plugin ABAP_PLUGIN = new Plugin("abap") + private static final Plugin ABAP_PLUGIN = Plugin.factory("abap") .setName("ABAP") .setCategory("Languages") .setDescription("Enable analysis and reporting on ABAP projects") @@ -55,7 +55,7 @@ public class UpdatesActionTest extends AbstractUpdateCenterBasedPluginsWsActionT .setDescription("14 new rules, most of them designed to detect potential performance hotspots.") .setDownloadUrl("http://dist.sonarsource.com/abap/download/sonar-abap-plugin-3.2.jar") .setChangelogUrl("http://jira.sonarsource.com/secure/ReleaseNote.jspa?projectId=10054&version=10575"); - private static final Plugin ANDROID_PLUGIN = new Plugin("android") + private static final Plugin ANDROID_PLUGIN = Plugin.factory("android") .setName("Android") .setCategory("Languages") .setDescription("Import Android Lint reports.") diff --git a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/AvailableActionTest/properties_per_plugin.json b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/AvailableActionTest/properties_per_plugin.json index 44e8587022a..dc6002d5d77 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/AvailableActionTest/properties_per_plugin.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/AvailableActionTest/properties_per_plugin.json @@ -1,16 +1,16 @@ { "plugins": [ { - "key": "p_key", + "key": "pkey", "name": "p_name", "category": "p_category", "description": "p_description", "license": "p_license", + "termsAndConditionsUrl": "p_t_and_c_url", "organizationName": "p_orga_name", "organizationUrl": "p_orga_url", "homepageUrl": "p_homepage_url", "issueTrackerUrl": "p_issue_url", - "termsAndConditionsUrl": "p_t_and_c_url", "release": { "version": "1.12.1", "date": "2015-04-16" @@ -19,11 +19,11 @@ "status": "COMPATIBLE", "requires": [ { - "key": "p_key_1", + "key": "pkey1", "name": "p_name_1" }, { - "key": "p_key_2", + "key": "pkey2", "name": "p_name_2", "description": "p_desc_2" }