]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8684 Update response examples for removed WS
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 30 Jan 2017 11:25:40 +0000 (12:25 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 30 Jan 2017 12:26:36 +0000 (13:26 +0100)
12 files changed:
server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/TimeMachineWs.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java
server/sonar-server/src/main/java/org/sonar/server/user/ws/UserPropertiesWs.java
server/sonar-server/src/main/java/org/sonar/server/ws/RemovedWebServiceHandler.java
server/sonar-server/src/main/resources/org/sonar/server/component/ws/resources-example-index.json
server/sonar-server/src/main/resources/org/sonar/server/component/ws/resources-example-search.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/measure/ws/timemachine-example-index.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-index.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-list.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/user/ws/user_properties-index-example.xml [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/ws/removed-ws-example.json [new file with mode: 0644]

index 716d8221502c898bb32528222da0d19f8818672e..299102c64fe0e201fcbf8b302c673731d29bec7c 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.server.component.ws;
 
-import com.google.common.io.Resources;
 import org.sonar.api.server.ws.WebService;
 import org.sonar.server.ws.RemovedWebServiceHandler;
 
@@ -46,7 +45,7 @@ public class ResourcesWs implements WebService {
       .setSince("2.10")
       .setDeprecatedSince("5.4")
       .setHandler(RemovedWebServiceHandler.INSTANCE)
-      .setResponseExample(Resources.getResource(this.getClass(), "resources-example-index.json"));
+      .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample());
   }
 
 }
index 279268b674b43db89afb8fcaba16eed58597dd68..9f30ccc1058d2844f9401643a019bcafa18b89e5 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.server.measure.ws;
 
-import com.google.common.io.Resources;
 import org.sonar.api.server.ws.WebService;
 import org.sonar.server.ws.RemovedWebServiceHandler;
 
@@ -40,7 +39,7 @@ public class TimeMachineWs implements WebService {
       .setSince("2.10")
       .setDeprecatedSince("6.3")
       .setHandler(RemovedWebServiceHandler.INSTANCE)
-      .setResponseExample(Resources.getResource(this.getClass(), "timemachine-example-index.json"));
+      .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample());
   }
 
 }
index 0ecb585ae05413246ded643c4d941ff6d416563f..dff4269e9a17d9943258daa1fecf592af7af2c5b 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.server.qualityprofile.ws;
 
-import com.google.common.io.Resources;
 import org.sonar.api.server.ws.WebService;
 import org.sonar.server.ws.RemovedWebServiceHandler;
 
@@ -55,7 +54,7 @@ public class ProfilesWs implements WebService {
       .setSince("3.3")
       .setDeprecatedSince("5.2")
       .setHandler(RemovedWebServiceHandler.INSTANCE)
-      .setResponseExample(Resources.getResource(ProfilesWs.class, "example-index.json"));
+      .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample());
   }
 
   private static void defineListAction(NewController controller) {
@@ -65,6 +64,6 @@ public class ProfilesWs implements WebService {
       .setSince("3.3")
       .setDeprecatedSince("5.2")
       .setHandler(RemovedWebServiceHandler.INSTANCE)
-      .setResponseExample(Resources.getResource(ProfilesWs.class, "example-list.json"));
+      .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample());
   }
 }
index 0caad8934e65bab8050149e69be34dc95ee3e994..42590c9b49b986141936da30bbfc0a38764a4332 100644 (file)
@@ -38,8 +38,8 @@ public class UserPropertiesWs implements WebService {
       .setDescription("This web service is removed")
       .setSince("2.6")
       .setDeprecatedSince("6.3")
-      .setResponseExample(getClass().getResource("user_properties-index-example.xml"))
-      .setHandler(RemovedWebServiceHandler.INSTANCE);
+      .setHandler(RemovedWebServiceHandler.INSTANCE)
+      .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample());
   }
 
 }
index 8a3700c338926570ce3cadc9ac953b0a7fec2586..f61f973959c1eb8cd04b5c474a251a59d2b9eb06 100644 (file)
@@ -20,6 +20,8 @@
 
 package org.sonar.server.ws;
 
+import com.google.common.io.Resources;
+import java.net.URL;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.RequestHandler;
 import org.sonar.api.server.ws.Response;
@@ -38,4 +40,8 @@ public enum RemovedWebServiceHandler implements RequestHandler {
   public void handle(Request request, Response response) throws Exception {
     throw new ServerException(HTTP_GONE, String.format("The web service '%s' doesn't exist anymore, please read its documentation to use alternatives", request.getPath()));
   }
+
+  public URL getResponseExample() {
+    return Resources.getResource(RemovedWebServiceHandler.class, "removed-ws-example.json");
+  }
 }
index 905f3bb54a0e1fdc71501a524656e2dbcf906697..5ee255d0324e040c92278d341d4c3dca8239532c 100644 (file)
@@ -1,42 +1,7 @@
-[
-  {
-    "id": 2865,
-    "key": "org.codehaus.sonar:sonar",
-    "name": "Sonar",
-    "scope": "PRJ",
-    "qualifier": "TRK",
-    "date": "2012-08-10T04:03:51+0200",
-    "creationDate": "2012-08-10T04:03:51+0200",
-    "lname": "Sonar",
-
-    // Only available at file level
-    "lang": "java",
-
-    // Only available at project and module levels
-    "version": "3.3-SNAPSHOT",
-    "description": "Open source platform for continuous inspection of code quality",
-
-    // Description of differential periods
-    "p1": "previous_analysis",
-    "p1p": "2012-08-09",
-    "p1d": "2012-08-09T04:04:01+0200",
-    "p2": "days",
-    "p2p": "7",
-    "p2d": "2012-08-03T04:03:51+0200",
-
-    // Values for the selected metrics
-    "msr": [
-      {
-        "key": "coverage",
-        "val": 70.3,
-        "frmt_val": "70.3%",
-        "alert": null,
-        "alert_text": null,
-        "trend": 0,
-        "var": 0,
-        "var1": 0.0,
-        "var2": 0.0
-      }
-    ]
-  }
-]
+{
+  "errors": [
+    {
+      "msg": "The web service '/api/resources/index' doesn't exists anymore, please read its documentation to use alternatives"
+    }
+  ]
+}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/component/ws/resources-example-search.json b/server/sonar-server/src/main/resources/org/sonar/server/component/ws/resources-example-search.json
deleted file mode 100644 (file)
index fc4c74a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-{
-  "total": 405,
-  "page": 1,
-  "page_size": 10,
-  "data": [
-    {
-      "id": 21434,
-      "key": "org.codehaus.mojo:sonar-maven-plugin:src/main/java/org/codehaus/mojo/sonar/SonarMojo.java",
-      "nm": "src/main/java/org/codehaus/mojo/sonar/SonarMojo.java",
-      "q": "FIL"
-    },
-    {
-      "id": 4138,
-      "key": "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/Sonar.java",
-      "nm": "src/main/java/org/sonar/wsclient/Sonar.java",
-      "q": "FIL"
-    },
-    {
-      "id": 3868,
-      "key": "org.codehaus.sonar:sonar-server:src/main/java/org/sonar/server/platform/SonarHome.java",
-      "nm": "src/main/java/org/sonar/server/platform/SonarHome.java",
-      "q": "FIL"
-    }
-  ]
-}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/measure/ws/timemachine-example-index.json b/server/sonar-server/src/main/resources/org/sonar/server/measure/ws/timemachine-example-index.json
deleted file mode 100644 (file)
index 0fb7a62..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-[
-  {
-    "cols": [
-      {
-        "metric": "complexity"
-      },
-      {
-        "metric": "lines"
-      }
-    ],
-    "cells": [
-      {
-        "d": "2011-10-02T00:01:00+0200",
-        "v": [
-          11879,
-          94500
-        ]
-      },
-      {
-        "d": "2011-10-25T12:27:41+0200",
-        "v": [
-          13528,
-          102508
-        ]
-      }
-    ]
-  }
-]
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-index.json b/server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-index.json
deleted file mode 100644 (file)
index b80303d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-[
-  {
-    "name": "Sonar way",
-    "language": "java",
-    "default": true,
-    "rules": [
-      {
-        "key": "DuplicatedBlocks",
-        "repo": "common-java",
-        "severity": "MAJOR"
-      },
-      {
-        "key": "InsufficientBranchCoverage",
-        "repo": "common-java",
-        "severity": "MAJOR",
-        "params": [
-          {
-            "key": "minimumBranchCoverageRatio",
-            "value": "65.0"
-          }
-        ]
-      },
-      {
-        "key": "S00105",
-        "repo": "squid",
-        "severity": "MINOR"
-      },
-      {
-        "key": "MethodCyclomaticComplexity",
-        "repo": "squid",
-        "severity": "MAJOR",
-        "params": [
-          {
-            "key": "max",
-            "value": "10"
-          }
-        ]
-      }
-    ]
-  }
-]
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-list.json b/server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-list.json
deleted file mode 100644 (file)
index 21f3b63..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-[
-  {
-    "name": "Sonar way with Findbugs",
-    "language": "java",
-    "default": false
-  },
-  {
-    "name": "Sonar way",
-    "language": "java",
-    "default": false
-  }
-]
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/user/ws/user_properties-index-example.xml b/server/sonar-server/src/main/resources/org/sonar/server/user/ws/user_properties-index-example.xml
deleted file mode 100644 (file)
index 58b6d4b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<properties>
-  <property>
-    <key>favourite</key>
-    <value><![CDATA[]]></value>
-  </property>
-  <property>
-    <key>favourite</key>
-    <value><![CDATA[]]></value>
-  </property>
-  <property>
-    <key>notification.ChangesOnMyIssue.EmailNotificationChannel</key>
-    <value><![CDATA[true]]></value>
-  </property>
-  <property>
-    <key>notification.SQ-MyNewIssues.EmailNotificationChannel</key>
-    <value><![CDATA[true]]></value>
-  </property>
-  <property>
-    <key>notification.ChangesOnMyIssue.EmailNotificationChannel</key>
-    <value><![CDATA[true]]></value>
-  </property>
-  <property>
-    <key>notification.SQ-MyNewIssues.EmailNotificationChannel</key>
-    <value><![CDATA[true]]></value>
-  </property>
-  <property>
-    <key>notification.NewIssues.EmailNotificationChannel</key>
-    <value><![CDATA[true]]></value>
-  </property>
-</properties>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/ws/removed-ws-example.json b/server/sonar-server/src/main/resources/org/sonar/server/ws/removed-ws-example.json
new file mode 100644 (file)
index 0000000..6764a13
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "errors": [
+    {
+      "msg": "The web service '/api/...' doesn't exists anymore, please read its documentation to use alternatives"
+    }
+  ]
+}