]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6376 SONAR-6383 remove artifact from JSON response 269/head
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 29 Apr 2015 14:15:42 +0000 (16:15 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 30 Apr 2015 10:04:26 +0000 (12:04 +0200)
server/sonar-server/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java
server/sonar-server/src/main/resources/org/sonar/server/plugins/ws/example-installed_plugins.json
server/sonar-server/src/main/resources/org/sonar/server/plugins/ws/example-pending_plugins.json
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledPluginsWsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingPluginsWsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginWSCommonsTest.java

index 553e592e3f2d0eacc0cceb4a48f06e030a6b8847..08cc27555b4977c630feffb9653eab9176956a36 100644 (file)
@@ -75,8 +75,6 @@ public class PluginWSCommons {
 
     writeMetadata(jsonWriter, pluginMetadata);
 
-    writeArtifact(jsonWriter, pluginMetadata);
-
     jsonWriter.endObject();
   }
 
@@ -93,18 +91,6 @@ public class PluginWSCommons {
     jsonWriter.prop(PROPERTY_IMPLEMENTATION_BUILD, pluginMetadata.getImplementationBuild());
   }
 
-  public void writeArtifact(JsonWriter jsonWriter, PluginMetadata pluginMetadata) {
-    if (pluginMetadata.getFile() == null) {
-      return;
-    }
-
-    jsonWriter.name(OBJECT_ARTIFACT).beginObject();
-
-    jsonWriter.prop(PROPERTY_NAME, pluginMetadata.getFile().getName());
-
-    jsonWriter.endObject();
-  }
-
   public void writePluginUpdate(JsonWriter jsonWriter, PluginUpdate pluginUpdate) {
     jsonWriter.beginObject();
     Plugin plugin = pluginUpdate.getPlugin();
index 5c87a337d370f16707c519fa8e91652e6b88aca6..c0035e3c45a8204443aa7541f9abb6b2e0cc4fd5 100644 (file)
       "organizationUrl": "http://www.sonarsource.com",
       "homepage": "http://redirect.sonarsource.com/plugins/scmgit.html",
       "issueTrackerUrl": "http://jira.codehaus.org/browse/SONARSCGIT",
-      "implementationBuild": "9ce9d330c313c296fab051317cc5ad4b26319e07",
-      "artifact": {
-        "name": "sonar-scm-git-plugin-1.0.jar"
-      }
+      "implementationBuild": "9ce9d330c313c296fab051317cc5ad4b26319e07"
     },
     {
       "key": "java",
       "organizationUrl": "http://www.sonarsource.com",
       "homepage": "http://redirect.sonarsource.com/plugins/java.html",
       "issueTrackerUrl": "http://jira.codehaus.org/browse/SONARJAVA",
-      "implementationBuild": "65396a609ddface8b311a6a665aca92a7da694f1",
-      "artifact": {
-        "name": "sonar-java-plugin-3.0.jar"
-      }
+      "implementationBuild": "65396a609ddface8b311a6a665aca92a7da694f1"
     },
     {
       "key": "scmsvn",
       "organizationUrl": "http://www.sonarsource.com",
       "homepage": "http://redirect.sonarsource.com/plugins/scmsvn.html",
       "issueTrackerUrl": "http://jira.codehaus.org/browse/SONARSCSVN",
-      "implementationBuild": "213fc8a8b582ff530b12dd4a59a6512be1071234",
-      "artifact": {
-        "name": "sonar-scm-svn-plugin-1.0.jar"
-      }
+      "implementationBuild": "213fc8a8b582ff530b12dd4a59a6512be1071234"
     }
   ]
 }
\ No newline at end of file
index 508127f2ff53c483df08c17072ca303df7a51031..078d33d862b8a2daf91e5f1f52a92cfffc72329c 100644 (file)
@@ -1,6 +1,5 @@
 {
-  "installing":
-  [
+  "installing": [
     {
       "key": "scmgit",
       "name": "Git",
       "organizationUrl": "http://www.sonarsource.com",
       "homepage": "http://redirect.sonarsource.com/plugins/scmgit.html",
       "issueTrackerUrl": "http://jira.codehaus.org/browse/SONARSCGIT",
-      "implementationBuild": "9ce9d330c313c296fab051317cc5ad4b26319e07",
-      "artifact": {
-        "name": "sonar-scm-git-plugin-1.0.jar"
-      }
+      "implementationBuild": "9ce9d330c313c296fab051317cc5ad4b26319e07"
     },
     {
       "key": "java",
       "organizationUrl": "http://www.sonarsource.com",
       "homepage": "http://redirect.sonarsource.com/plugins/java.html",
       "issueTrackerUrl": "http://jira.codehaus.org/browse/SONARJAVA",
-      "implementationBuild": "65396a609ddface8b311a6a665aca92a7da694f1",
-      "artifact": {
-        "name": "sonar-java-plugin-3.0.jar"
-      }
+      "implementationBuild": "65396a609ddface8b311a6a665aca92a7da694f1"
     }
   ],
-  "removing":
-  [
+  "removing": [
     {
       "key": "scmsvn",
       "name": "SVN",
       "organizationUrl": "http://www.sonarsource.com",
       "homepage": "http://redirect.sonarsource.com/plugins/scmsvn.html",
       "issueTrackerUrl": "http://jira.codehaus.org/browse/SONARSCSVN",
-      "implementationBuild": "213fc8a8b582ff530b12dd4a59a6512be1071234",
-      "artifact": {
-        "name": "sonar-scm-svn-plugin-1.0.jar"
-      }
+      "implementationBuild": "213fc8a8b582ff530b12dd4a59a6512be1071234"
     }
   ]
 }
index 3a79c281858f5434b6e4f916de5994e7490816fe..c6470051181f58f375776f1357a107200f53d617 100644 (file)
@@ -128,11 +128,7 @@ public class InstalledPluginsWsActionTest {
         "      \"organizationUrl\": \"org_url\"," +
         "      \"homepage\": \"homepage_url\"," +
         "      \"issueTrackerUrl\": \"issueTracker_url\"," +
-        "      \"implementationBuild\": \"sou_rev_sha1\"," +
-        "      \"artifact\":" +
-        "      {" +
-        "        \"name\": \"some.jar\"" +
-        "      }" +
+        "      \"implementationBuild\": \"sou_rev_sha1\"" +
         "    }" +
         "  ]" +
         "}"
index b865069d99d7826213ce583ec944ee5b36d9af16..26e8bfb4cd9fd14dbe64b892fbee27c0e4691823 100644 (file)
@@ -109,10 +109,7 @@ public class PendingPluginsWsActionTest {
         "      \"organizationUrl\": \"http://www.sonarsource.com\"," +
         "      \"homepage\": \"http://redirect.sonarsource.com/plugins/scmgit.html\"," +
         "      \"issueTrackerUrl\": \"http://jira.codehaus.org/browse/SONARSCGIT\"," +
-        "      \"implementationBuild\": \"9ce9d330c313c296fab051317cc5ad4b26319e07\"," +
-        "      \"artifact\": {" +
-        "        \"name\": \"sonar-scm-git-plugin-1.0.jar\"" +
-        "      }" +
+        "      \"implementationBuild\": \"9ce9d330c313c296fab051317cc5ad4b26319e07\"" +
         "    }" +
         "  ]," +
         "  \"removing\": []" +
@@ -141,10 +138,7 @@ public class PendingPluginsWsActionTest {
         "      \"organizationUrl\": \"http://www.sonarsource.com\"," +
         "      \"homepage\": \"http://redirect.sonarsource.com/plugins/scmgit.html\"," +
         "      \"issueTrackerUrl\": \"http://jira.codehaus.org/browse/SONARSCGIT\"," +
-        "      \"implementationBuild\": \"9ce9d330c313c296fab051317cc5ad4b26319e07\"," +
-        "      \"artifact\": {" +
-        "        \"name\": \"sonar-scm-git-plugin-1.0.jar\"" +
-        "      }" +
+        "      \"implementationBuild\": \"9ce9d330c313c296fab051317cc5ad4b26319e07\"" +
         "    }" +
         "  ]" +
         "}"
index 3c9981aa3526e8a6cbb5b629fe939abed90ee888..831bdbd7b78077520e1b6e9a8f3e6cf0f3361f88 100644 (file)
@@ -81,10 +81,7 @@ public class PluginWSCommonsTest {
       "  \"organizationName\": \"SonarSource\"," +
       "  \"organizationUrl\": \"http://www.sonarsource.com\"," +
       "  \"homepage\": \"http://redirect.sonarsource.com/plugins/scmgit.html\"," +
-      "  \"issueTrackerUrl\": \"http://jira.codehaus.org/browse/SONARSCGIT\"," +
-      "  \"artifact\": {" +
-      "    \"name\": \"sonar-scm-git-plugin-1.0.jar\"" +
-      "  }" +
+      "  \"issueTrackerUrl\": \"http://jira.codehaus.org/browse/SONARSCGIT\"" +
       "}");
   }
 
@@ -108,30 +105,6 @@ public class PluginWSCommonsTest {
       "}");
   }
 
-  @Test
-  public void writeArtifact_from_pluginMetadata_supports_null_file() {
-    jsonWriter.beginObject();
-    underTest.writeArtifact(jsonWriter, DefaultPluginMetadata.create("key"));
-    jsonWriter.endObject();
-
-    jsonWriter.close();
-    assertJson(response.outputAsString()).setStrictArrayOrder(true).isSimilarTo("{}");
-  }
-
-  @Test
-  public void writeArtifact_from_pluginMetadata_writes_artifact_object_and_file_name() {
-    jsonWriter.beginObject();
-    underTest.writeArtifact(jsonWriter, GIT_PLUGIN_METADATA);
-    jsonWriter.endObject();
-
-    jsonWriter.close();
-    assertJson(response.outputAsString()).setStrictArrayOrder(true).isSimilarTo("{" +
-      "  \"artifact\": {" +
-      "     \"name\": \"sonar-scm-git-plugin-1.0.jar\"" +
-      "  }" +
-      "}");
-  }
-
   @Test
   public void verify_properties_written_by_writePluginUpdate() {
     underTest.writePluginUpdate(jsonWriter, PluginUpdate.createForPluginRelease(RELEASE, version("1.0")));