aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-09-05 18:20:37 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-09-11 11:28:29 +0200
commit272dfe918009de0938fde9835961b37420808ffa (patch)
treed30aedc09acbdf53c59b112c04f7f4950e48825a
parentb6a2847855ffd7d2c499639473336b65a73e2c51 (diff)
downloadsonarqube-272dfe918009de0938fde9835961b37420808ffa.tar.gz
sonarqube-272dfe918009de0938fde9835961b37420808ffa.zip
SONAR-9181 Sanitize json example filenames of api/projects domain
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java2
-rw-r--r--server/sonar-server/src/main/resources/org/sonar/server/project/ws/ghosts-example.json (renamed from server/sonar-server/src/main/resources/org/sonar/server/project/ws/projects-example-ghosts.json)0
-rw-r--r--server/sonar-server/src/main/resources/org/sonar/server/project/ws/provisioned-example.json (renamed from server/sonar-server/src/main/resources/org/sonar/server/project/ws/projects-example-provisioned.json)0
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java4
6 files changed, 4 insertions, 8 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java
index 2c7dd00c722..ab90d8496c6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java
@@ -70,7 +70,7 @@ public class GhostsAction implements ProjectsWsAction {
.setDescription("List ghost projects.<br> " +
"With the current architecture, it's no more possible to have invisible ghost projects. Therefore, the web service is deprecated.<br> " +
"Requires 'Administer System' permission.")
- .setResponseExample(Resources.getResource(getClass(), "projects-example-ghosts.json"))
+ .setResponseExample(Resources.getResource(getClass(), "ghosts-example.json"))
.setSince("5.2")
.setDeprecatedSince("6.6")
.addPagingParams(100, MAX_LIMIT)
diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java
index a19e83f044f..a5fcf853663 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java
@@ -78,7 +78,7 @@ public class ProvisionedAction implements ProjectsWsAction {
"Require 'Create Projects' permission.")
.setSince("5.2")
.setDeprecatedSince("6.6")
- .setResponseExample(Resources.getResource(getClass(), "projects-example-provisioned.json"))
+ .setResponseExample(Resources.getResource(getClass(), "provisioned-example.json"))
.setHandler(this)
.addPagingParams(100, MAX_LIMIT)
.addSearchQuery("sonar", "names", "keys")
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/project/ws/projects-example-ghosts.json b/server/sonar-server/src/main/resources/org/sonar/server/project/ws/ghosts-example.json
index 87444dadeaa..87444dadeaa 100644
--- a/server/sonar-server/src/main/resources/org/sonar/server/project/ws/projects-example-ghosts.json
+++ b/server/sonar-server/src/main/resources/org/sonar/server/project/ws/ghosts-example.json
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/project/ws/projects-example-provisioned.json b/server/sonar-server/src/main/resources/org/sonar/server/project/ws/provisioned-example.json
index 6361d3cd0ec..6361d3cd0ec 100644
--- a/server/sonar-server/src/main/resources/org/sonar/server/project/ws/projects-example-provisioned.json
+++ b/server/sonar-server/src/main/resources/org/sonar/server/project/ws/provisioned-example.json
diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java
index 5350d3090cb..47c73884037 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.server.project.ws;
-import com.google.common.io.Resources;
import java.util.function.Consumer;
import org.apache.commons.lang.StringUtils;
import org.junit.Rule;
@@ -216,8 +215,7 @@ public class GhostsActionTest {
.setParam("organization", organization.getKey())
.execute();
- assertJson(result.getInput())
- .isSimilarTo(Resources.getResource(getClass(), "projects-example-ghosts.json"));
+ assertJson(result.getInput()).isSimilarTo(ws.getDef().responseExampleAsString());
}
@Test
diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java
index 269a85ba068..07b0782bce5 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.server.project.ws;
-import com.google.common.io.Resources;
import org.apache.commons.lang.StringUtils;
import org.junit.Rule;
import org.junit.Test;
@@ -192,8 +191,7 @@ public class ProvisionedActionTest {
.setParam(PARAM_ORGANIZATION, org.getKey())
.execute();
- assertJson(result.getInput())
- .isSimilarTo(Resources.getResource(getClass(), "projects-example-provisioned.json"));
+ assertJson(result.getInput()).isSimilarTo(ws.getDef().responseExampleAsString());
}
@Test