diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-07-28 17:51:57 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-07-28 17:51:57 +0200 |
commit | 0f15f1633e5dfa9b24a61a524f963fc0f68d08c7 (patch) | |
tree | 2551482f805aa5ea72c69f57cb1a29cc4a05ee22 /server/sonar-server | |
parent | 0aab83bc0adf1582c3595b2edba7ecfcc1799ce4 (diff) | |
download | sonarqube-0f15f1633e5dfa9b24a61a524f963fc0f68d08c7.tar.gz sonarqube-0f15f1633e5dfa9b24a61a524f963fc0f68d08c7.zip |
SONAR-6693 WS issue_filters/search return both favorite and non favorite filters
Diffstat (limited to 'server/sonar-server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/issue/filter/AppAction.java | 2 | ||||
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/issue/filter/SearchAction.java | 6 | ||||
-rw-r--r-- | server/sonar-server/src/main/resources/org/sonar/server/issue/filter/example-app.json (renamed from server/sonar-server/src/main/resources/org/sonar/server/issue/filter/app-example-show.json) | 0 | ||||
-rw-r--r-- | server/sonar-server/src/main/resources/org/sonar/server/issue/filter/example-search.json (renamed from server/sonar-server/src/main/resources/org/sonar/server/issue/filter/search-example-show.json) | 2 | ||||
-rw-r--r-- | server/sonar-server/src/test/java/org/sonar/server/issue/filter/SearchActionTest.java | 10 | ||||
-rw-r--r-- | server/sonar-server/src/test/resources/org/sonar/server/issue/filter/SearchActionTest/logged_in_page_with_favorites.json | 32 |
6 files changed, 26 insertions, 26 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/filter/AppAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/filter/AppAction.java index 8facc8d02de..1025d1cd68b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/filter/AppAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/filter/AppAction.java @@ -48,7 +48,7 @@ public class AppAction implements IssueFilterWsAction { .setDescription("Data required for rendering the page 'Issues'") .setInternal(true) .setHandler(this) - .setResponseExample(Resources.getResource(this.getClass(), "app-example-show.json")); + .setResponseExample(Resources.getResource(this.getClass(), "example-app.json")); action .createParam("id") .setDescription("Optionally, the ID of the current filter"); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/filter/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/filter/SearchAction.java index f7e5ab9e205..2c1f3d2a59b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/filter/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/filter/SearchAction.java @@ -49,7 +49,7 @@ public class SearchAction implements IssueFilterWsAction { .setInternal(false) .setHandler(this) .setSince("5.2") - .setResponseExample(Resources.getResource(this.getClass(), "search-example-show.json")); + .setResponseExample(Resources.getResource(this.getClass(), "example-search.json")); } @Override @@ -59,8 +59,8 @@ public class SearchAction implements IssueFilterWsAction { // Favorite filters, if logged in if (userSession.isLoggedIn()) { - List<IssueFilterDto> favorites = service.findFavoriteFilters(userSession); - json.name("favorites").beginArray(); + List<IssueFilterDto> favorites = service.findByUser(userSession); + json.name("issueFilters").beginArray(); for (IssueFilterDto favorite : favorites) { issueFilterJsonWriter.write(json, favorite, userSession); } diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/filter/app-example-show.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/filter/example-app.json index 982d0ef6460..982d0ef6460 100644 --- a/server/sonar-server/src/main/resources/org/sonar/server/issue/filter/app-example-show.json +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/filter/example-app.json diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/filter/search-example-show.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/filter/example-search.json index dbf2ac8b8d1..ff666a72a78 100644 --- a/server/sonar-server/src/main/resources/org/sonar/server/issue/filter/search-example-show.json +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/filter/example-search.json @@ -1,5 +1,5 @@ { - "favorites": [ + "issueFilters": [ { "id": 3, "name": "My Unresolved Issues", diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/SearchActionTest.java index 1d9c0b57698..33fb4c24198 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/SearchActionTest.java @@ -34,8 +34,8 @@ import static org.sonar.test.JsonAssert.assertJson; public class SearchActionTest { static final String EMPTY_JSON = "{}"; - static final String EMPTY_FAVORITES_JSON = "{" + - " \"favorites\": []" + + static final String EMPTY_ISSUE_FILTERS_JSON = "{" + + " \"issueFilters\": []" + "}"; @Rule @@ -63,13 +63,13 @@ public class SearchActionTest { userSessionRule.login("eric").setUserId(123); WsTester.Result result = ws.newGetRequest("api/issue_filters", "search").execute(); - assertJson(result.outputAsString()).isSimilarTo(EMPTY_FAVORITES_JSON); + assertJson(result.outputAsString()).isSimilarTo(EMPTY_ISSUE_FILTERS_JSON); } @Test - public void logged_in_app_with_favorites() throws Exception { + public void logged_in_app_with_all_issue_filters() throws Exception { userSessionRule.login("eric").setUserId(123); - when(service.findFavoriteFilters(userSessionRule)).thenReturn(Arrays.asList( + when(service.findByUser(userSessionRule)).thenReturn(Arrays.asList( new IssueFilterDto() .setId(3L) .setName("My Unresolved Issues") diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/filter/SearchActionTest/logged_in_page_with_favorites.json b/server/sonar-server/src/test/resources/org/sonar/server/issue/filter/SearchActionTest/logged_in_page_with_favorites.json index bbaa677e0fa..d8d65271361 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/filter/SearchActionTest/logged_in_page_with_favorites.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/filter/SearchActionTest/logged_in_page_with_favorites.json @@ -1,18 +1,18 @@ { - "favorites": [ - { - "id": 3, - "name": "My Unresolved Issues", - "shared": true, - "query": "resolved=false|assignees=__me__", - "canModify": false - }, - { - "id": 2, - "name": "False Positive and Won't Fix Issues", - "shared": false, - "query": "resolutions=FALSE-POSITIVE,WONTFIX", - "canModify": false - } - ] + "issueFilters": [ + { + "id": 3, + "name": "My Unresolved Issues", + "shared": true, + "query": "resolved=false|assignees=__me__", + "canModify": false + }, + { + "id": 2, + "name": "False Positive and Won't Fix Issues", + "shared": false, + "query": "resolutions=FALSE-POSITIVE,WONTFIX", + "canModify": false + } + ] } |