]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7297 Rename file examples of issues WS
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 6 Jan 2017 15:15:04 +0000 (16:15 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 10 Jan 2017 08:20:36 +0000 (09:20 +0100)
17 files changed:
server/sonar-server/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java
server/sonar-server/src/main/java/org/sonar/server/issue/ws/ChangelogAction.java
server/sonar-server/src/main/java/org/sonar/server/issue/ws/ComponentTagsAction.java
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/issue/ws/TagsAction.java
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/authors-example.json [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/changelog-example.json [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/component-tags-example.json [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-authors.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-changelog.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-component-tags.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-search.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-tags.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-transitions.json [deleted file]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/search-example.json [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/tags-example.json [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/issue/ws/ChangelogActionTest.java

index 29c9c16472585e1b7e06503105e186bfc3950a26..e932c9dd93f86f9c5b9c1c558ffaa4c2a12fbc7b 100644 (file)
@@ -60,7 +60,7 @@ public class AuthorsAction implements IssuesWsAction {
     NewAction action = controller.createAction(ACTION_AUTHORS)
       .setSince("5.1")
       .setDescription("Search SCM accounts which match a given query")
-      .setResponseExample(Resources.getResource(this.getClass(), "example-authors.json"))
+      .setResponseExample(Resources.getResource(this.getClass(), "authors-example.json"))
       .setHandler(this);
 
     action.createParam(Param.TEXT_QUERY)
index 6709d3b866a57224d03217ef3e5e4b9321e658e4..b7d63fec1e7a5a986ee565667ba6b3a5854caf0d 100644 (file)
@@ -73,7 +73,7 @@ public class ChangelogAction implements IssuesWsAction {
         "Since 6.3, changes on effort are returning raw value in minutes, it doesn't return anymore the duration.")
       .setSince("4.1")
       .setHandler(this)
-      .setResponseExample(Resources.getResource(IssuesWs.class, "example-changelog.json"));
+      .setResponseExample(Resources.getResource(IssuesWs.class, "changelog-example.json"));
     action.createParam(PARAM_ISSUE)
       .setDescription("Issue key")
       .setRequired(true)
index 4286621abb38e433c8c6aa746b80fa10c22c6b86..1e6ce03835981853885246ee3fd43eae341d1ca5 100644 (file)
@@ -59,7 +59,7 @@ public class ComponentTagsAction implements IssuesWsAction {
       .setSince("5.1")
       .setInternal(true)
       .setDescription("List tags for the issues under a given component (including issues on the descendants of the component)")
-      .setResponseExample(Resources.getResource(getClass(), "example-component-tags.json"));
+      .setResponseExample(Resources.getResource(getClass(), "component-tags-example.json"));
     action.createParam(PARAM_COMPONENT_UUID)
       .setDescription("A component UUID")
       .setRequired(true)
index a781d229366d93372312ba4a6c3f049d7779e4e4..52dfde6a0b3ac7c5b9f9c93122853fa599c482c6 100644 (file)
@@ -128,7 +128,7 @@ public class SearchAction implements IssuesWsAction {
           "Since 5.5, response field 'reporter' has been removed, as manual issue feature has been dropped.",
         PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS, PARAM_COMPONENTS, PARAM_COMPONENT_ROOT_UUIDS, PARAM_COMPONENT_ROOTS)
       .setSince("3.6")
-      .setResponseExample(getClass().getResource("example-search.json"));
+      .setResponseExample(getClass().getResource("search-example.json"));
 
     action.addPagingParams(100, MAX_LIMIT);
     action.createParam(Param.FACETS)
index f486d2fe0ca3fa339f7219ff4aad1b1c72412584..da5fd97cf466cbf7cdd89a851c42c8a7df034b29 100644 (file)
@@ -46,7 +46,7 @@ public class TagsAction implements IssuesWsAction {
       .setHandler(this)
       .setSince("5.1")
       .setDescription("List tags matching a given query")
-      .setResponseExample(Resources.getResource(getClass(), "example-tags.json"));
+      .setResponseExample(Resources.getResource(getClass(), "tags-example.json"));
     action.createParam(Param.TEXT_QUERY)
       .setDescription("A pattern to match tags against")
       .setExampleValue("misra");
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/authors-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/authors-example.json
new file mode 100644 (file)
index 0000000..7750054
--- /dev/null
@@ -0,0 +1,15 @@
+{
+  "authors": {
+    "more": true,
+    "results": [
+      {
+        "key": "leia.organa",
+        "text": "leia.organa"
+      },
+      {
+        "key": "luke@skywalker.name",
+        "text": "luke@skywalker.name"
+      }
+    ]
+  }
+}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/changelog-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/changelog-example.json
new file mode 100644 (file)
index 0000000..7d962cb
--- /dev/null
@@ -0,0 +1,17 @@
+{
+  "changelog": [
+    {
+      "user": "john.smith",
+      "userName": "John Smith",
+      "email": "john@smith.com",
+      "creationDate": "2014-03-04T23:03:44+0100",
+      "diffs": [
+        {
+          "key": "severity",
+          "newValue": "BLOCKER",
+          "oldValue": "MAJOR"
+        }
+      ]
+    }
+  ]
+}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/component-tags-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/component-tags-example.json
new file mode 100644 (file)
index 0000000..3e00535
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "tags": [
+    { key: "convention", value: 42 },
+    { key: "cwe", value: 12 },
+    { key: "security", value: 5 }
+  ]
+}
\ No newline at end of file
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-authors.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-authors.json
deleted file mode 100644 (file)
index 7750054..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "authors": {
-    "more": true,
-    "results": [
-      {
-        "key": "leia.organa",
-        "text": "leia.organa"
-      },
-      {
-        "key": "luke@skywalker.name",
-        "text": "luke@skywalker.name"
-      }
-    ]
-  }
-}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-changelog.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-changelog.json
deleted file mode 100644 (file)
index 7d962cb..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-  "changelog": [
-    {
-      "user": "john.smith",
-      "userName": "John Smith",
-      "email": "john@smith.com",
-      "creationDate": "2014-03-04T23:03:44+0100",
-      "diffs": [
-        {
-          "key": "severity",
-          "newValue": "BLOCKER",
-          "oldValue": "MAJOR"
-        }
-      ]
-    }
-  ]
-}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-component-tags.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-component-tags.json
deleted file mode 100644 (file)
index 3e00535..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "tags": [
-    { key: "convention", value: 42 },
-    { key: "cwe", value: 12 },
-    { key: "security", value: 5 }
-  ]
-}
\ No newline at end of file
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-search.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-search.json
deleted file mode 100644 (file)
index 2bb9d5f..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-{
-  "paging": {
-    "pageIndex": 1,
-    "pageSize": 100,
-    "total": 1
-  },
-  "issues": [
-    {
-      "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123",
-      "component": "com.github.kevinsawicki:http-request:com.github.kevinsawicki.http.HttpRequest",
-      "project": "com.github.kevinsawicki:http-request",
-      "rule": "checkstyle:com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck",
-      "status": "RESOLVED",
-      "resolution": "FALSE-POSITIVE",
-      "severity": "MINOR",
-      "message": "'3' is a magic number.",
-      "line": 530,
-      "textRange": {
-        "startLine": 81,
-        "endLine": 81,
-        "startOffset": 0,
-        "endOffset": 134
-      },
-      "author": "Developer 1",
-      "effort": "2h1min",
-      "creationDate": "2013-05-13T17:55:39+0200",
-      "updateDate": "2013-05-13T17:55:39+0200",
-      "tags": ["bug"],
-      "type": "RELIABILITY",
-      "comments": [
-        {
-          "key": "7d7c56f5-7b5a-41b9-87f8-36fa70caa5ba",
-          "login": "john.smith",
-          "htmlText": "Must be &quot;final&quot;!",
-          "markdown": "Must be \"final\"!",
-          "updatable": false,
-          "createdAt": "2013-05-13T18:08:34+0200"
-        }
-      ],
-      "attr": {
-        "jira-issue-key": "SONAR-1234"
-      },
-      "transitions": [
-        "unconfirm",
-        "resolve",
-        "falsepositive"
-      ],
-      "actions": [
-        "comment"
-      ]
-    }
-  ],
-  "components": [
-    {
-      "key": "com.github.kevinsawicki:http-request:src/main/java/com/github/kevinsawicki/http/HttpRequest.java",
-      "enabled": true,
-      "qualifier": "FIL",
-      "name": "HttpRequest.java",
-      "longName": "src/main/java/com/github/kevinsawicki/http/HttpRequest.java",
-      "path": "src/main/java/com/github/kevinsawicki/http/HttpRequest.java"
-    },
-    {
-      "key": "com.github.kevinsawicki:http-request",
-      "enabled": true,
-      "qualifier": "TRK",
-      "name": "http-request",
-      "longName": "http-request"
-    }
-  ],
-  "rules": [
-    {
-      "key": "checkstyle:com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck",
-      "name": "Magic Number",
-      "status": "READY",
-      "lang": "java",
-      "langName": "Java"
-    }
-  ],
-  "users": [
-    {
-      "login": "admin",
-      "name": "Administrator",
-      "active": true,
-      "email": "admin@sonarqube.org"
-    }
-  ]
-
-}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-tags.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-tags.json
deleted file mode 100644 (file)
index 4b25b0c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "tags": ["convention", "security", "cwe"]
-}
\ No newline at end of file
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-transitions.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/example-transitions.json
deleted file mode 100644 (file)
index fcee98b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "transitions": ["confirm", "resolve", "falsepositive"]
-}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/search-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/search-example.json
new file mode 100644 (file)
index 0000000..2bb9d5f
--- /dev/null
@@ -0,0 +1,88 @@
+{
+  "paging": {
+    "pageIndex": 1,
+    "pageSize": 100,
+    "total": 1
+  },
+  "issues": [
+    {
+      "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123",
+      "component": "com.github.kevinsawicki:http-request:com.github.kevinsawicki.http.HttpRequest",
+      "project": "com.github.kevinsawicki:http-request",
+      "rule": "checkstyle:com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck",
+      "status": "RESOLVED",
+      "resolution": "FALSE-POSITIVE",
+      "severity": "MINOR",
+      "message": "'3' is a magic number.",
+      "line": 530,
+      "textRange": {
+        "startLine": 81,
+        "endLine": 81,
+        "startOffset": 0,
+        "endOffset": 134
+      },
+      "author": "Developer 1",
+      "effort": "2h1min",
+      "creationDate": "2013-05-13T17:55:39+0200",
+      "updateDate": "2013-05-13T17:55:39+0200",
+      "tags": ["bug"],
+      "type": "RELIABILITY",
+      "comments": [
+        {
+          "key": "7d7c56f5-7b5a-41b9-87f8-36fa70caa5ba",
+          "login": "john.smith",
+          "htmlText": "Must be &quot;final&quot;!",
+          "markdown": "Must be \"final\"!",
+          "updatable": false,
+          "createdAt": "2013-05-13T18:08:34+0200"
+        }
+      ],
+      "attr": {
+        "jira-issue-key": "SONAR-1234"
+      },
+      "transitions": [
+        "unconfirm",
+        "resolve",
+        "falsepositive"
+      ],
+      "actions": [
+        "comment"
+      ]
+    }
+  ],
+  "components": [
+    {
+      "key": "com.github.kevinsawicki:http-request:src/main/java/com/github/kevinsawicki/http/HttpRequest.java",
+      "enabled": true,
+      "qualifier": "FIL",
+      "name": "HttpRequest.java",
+      "longName": "src/main/java/com/github/kevinsawicki/http/HttpRequest.java",
+      "path": "src/main/java/com/github/kevinsawicki/http/HttpRequest.java"
+    },
+    {
+      "key": "com.github.kevinsawicki:http-request",
+      "enabled": true,
+      "qualifier": "TRK",
+      "name": "http-request",
+      "longName": "http-request"
+    }
+  ],
+  "rules": [
+    {
+      "key": "checkstyle:com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck",
+      "name": "Magic Number",
+      "status": "READY",
+      "lang": "java",
+      "langName": "Java"
+    }
+  ],
+  "users": [
+    {
+      "login": "admin",
+      "name": "Administrator",
+      "active": true,
+      "email": "admin@sonarqube.org"
+    }
+  ]
+
+}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/tags-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/tags-example.json
new file mode 100644 (file)
index 0000000..4b25b0c
--- /dev/null
@@ -0,0 +1,3 @@
+{
+  "tags": ["convention", "security", "cwe"]
+}
\ No newline at end of file
index bc79be09e332795a8f601406956646a4bc72c6a5..9783a0d9c79371af73ffbeecdd56c1fd97da6271 100644 (file)
@@ -261,7 +261,7 @@ public class ChangelogActionTest {
 
     String result = tester.newRequest().setParam("issue", issueDto.getKey()).execute().getInput();
 
-    assertJson(result).isSimilarTo(getClass().getResource("example-changelog.json"));
+    assertJson(result).isSimilarTo(getClass().getResource("changelog-example.json"));
   }
 
   @Test