diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-12-16 15:27:24 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-12-19 10:12:54 +0100 |
commit | 95ab6f6776c4b8e4ead3a4f6215c9c03c9b475c5 (patch) | |
tree | 6c5fc22660b58ba557cab2be13c7d2f9789f79df /sonar-ws/src | |
parent | 6a94b3b976758fb094488c36b9c178e6ef811f81 (diff) | |
download | sonarqube-95ab6f6776c4b8e4ead3a4f6215c9c03c9b475c5.tar.gz sonarqube-95ab6f6776c4b8e4ead3a4f6215c9c03c9b475c5.zip |
SONAR-7288 Create WS api/favorites/remove
Diffstat (limited to 'sonar-ws/src')
3 files changed, 19 insertions, 1 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesService.java index dab17b13317..91eede2140b 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesService.java @@ -25,10 +25,11 @@ import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsConnector; import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_ADD; +import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_REMOVE; import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.CONTROLLER_FAVORITES; import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT; -public class FavoritesService extends BaseService{ +public class FavoritesService extends BaseService { public FavoritesService(WsConnector wsConnector) { super(wsConnector, CONTROLLER_FAVORITES); } @@ -38,4 +39,10 @@ public class FavoritesService extends BaseService{ call(post); } + + public void remove(String component) { + PostRequest post = new PostRequest(path(ACTION_REMOVE)).setParam(PARAM_COMPONENT, component); + + call(post); + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesWsParameters.java index 5349f5fcf34..3c39c735ede 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesWsParameters.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesWsParameters.java @@ -24,6 +24,7 @@ public class FavoritesWsParameters { public static final String CONTROLLER_FAVORITES = "api/favorites"; public static final String ACTION_ADD = "add"; + public static final String ACTION_REMOVE = "remove"; public static final String PARAM_COMPONENT = "component"; diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/FavoritesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/FavoritesServiceTest.java index 4b6c8a40feb..b6ce72fa1da 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/FavoritesServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/FavoritesServiceTest.java @@ -43,4 +43,14 @@ public class FavoritesServiceTest { .hasParam(PARAM_COMPONENT, "my_project") .andNoOtherParam(); } + + @Test + public void remove() { + underTest.remove("my_project"); + + serviceTester.assertThat(serviceTester.getPostRequest()) + .hasPath("remove") + .hasParam(PARAM_COMPONENT, "my_project") + .andNoOtherParam(); + } } |