</distributionManagement>
<properties>
- <sonarUpdateCenter.version>1.16-build309</sonarUpdateCenter.version>
+ <sonarUpdateCenter.version>1.17</sonarUpdateCenter.version>
<sonarJava.version>4.0</sonarJava.version>
<sonarJavaScript.version>2.14</sonarJavaScript.version>
<sonarCSharp.version>5.3.1</sonarCSharp.version>
}
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.")
.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.")
@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);
public void download_when_update_center_is_unavailable_with_no_exception_thrown() {
when(updateCenterMatrixFactory.getUpdateCenter(anyBoolean())).thenReturn(Optional.<UpdateCenter>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);
*/
@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);
// 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
@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()));
@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);
@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));
// 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);
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;
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;
"{" +
" \"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);
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
);
}
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")
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();
when(updateCenterMatrixFactory.getUpdateCenter(false)).thenReturn(Optional.of(updateCenter));
when(updateCenter.findAllCompatiblePlugins()).thenReturn(
Arrays.asList(
- new Plugin("plugKey")
+ Plugin.factory("plugKey")
.setCategory("cat_1")
)
);
when(updateCenterMatrixFactory.getUpdateCenter(false)).thenReturn(Optional.of(updateCenter));
List<Plugin> 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;
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;
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
+}
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 {
}
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);
}
}
jsonWriter.close();
assertJson(response.outputAsString()).isSimilarTo("{" +
- " \"key\": \"p_key\"," +
+ " \"key\": \"pkey\"," +
" \"name\": \"p_name\"," +
" \"description\": \"p_description\"," +
" \"category\": \"p_category\"," +
jsonWriter.close();
assertJson(response.outputAsString()).isSimilarTo("{" +
- " \"key\": \"p_key\"," +
+ " \"key\": \"pkey\"," +
" \"name\": \"p_name\"," +
" \"description\": \"p_description\"," +
" \"category\": \"p_category\"," +
@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();
" \"update\": {" +
" \"requires\": [" +
" {" +
- " \"key\": \"p_key\"," +
+ " \"key\": \"pkey\"," +
" \"name\": \"p_name\"," +
" \"description\": \"p_description\"" +
" }" +
}
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() {
}
private Plugin newPlugin() {
- return new Plugin("p_key")
+ return Plugin.factory("pkey")
.setName("p_name")
.setCategory("p_category")
.setDescription("p_description")
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);
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")
.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.")
{
"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"
"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"
}