From 55dfa5865f5de6ae44f37dcf28985e7501d16fe5 Mon Sep 17 00:00:00 2001 From: Sébastien Lesaint Date: Wed, 12 Oct 2016 10:44:02 +0200 Subject: SONAR-8190 SONAR-8191 SONAR-8206 rename api/root/* to api/roots/* --- .../org/sonarqube/ws/client/DefaultWsClient.java | 10 ++-- .../java/org/sonarqube/ws/client/WsClient.java | 4 +- .../org/sonarqube/ws/client/root/RootService.java | 50 ----------------- .../org/sonarqube/ws/client/root/RootsService.java | 50 +++++++++++++++++ .../sonarqube/ws/client/root/RootServiceTest.java | 65 ---------------------- .../sonarqube/ws/client/root/RootsServiceTest.java | 65 ++++++++++++++++++++++ 6 files changed, 122 insertions(+), 122 deletions(-) delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootService.java create mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootsService.java delete mode 100644 sonar-ws/src/test/java/org/sonarqube/ws/client/root/RootServiceTest.java create mode 100644 sonar-ws/src/test/java/org/sonarqube/ws/client/root/RootsServiceTest.java (limited to 'sonar-ws/src') diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java index 8f96d055746..eff30072e0d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java @@ -29,7 +29,7 @@ import org.sonarqube.ws.client.project.ProjectsService; import org.sonarqube.ws.client.projectlinks.ProjectLinksService; import org.sonarqube.ws.client.qualitygate.QualityGatesService; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; -import org.sonarqube.ws.client.root.RootService; +import org.sonarqube.ws.client.root.RootsService; import org.sonarqube.ws.client.rule.RulesService; import org.sonarqube.ws.client.setting.SettingsService; import org.sonarqube.ws.client.system.SystemService; @@ -58,7 +58,7 @@ class DefaultWsClient implements WsClient { private final ProjectsService projectsService; private final ProjectLinksService projectLinksService; private final SettingsService settingsService; - private final RootService rootService; + private final RootsService rootsService; DefaultWsClient(WsConnector wsConnector) { this.wsConnector = wsConnector; @@ -76,7 +76,7 @@ class DefaultWsClient implements WsClient { this.projectsService = new ProjectsService(wsConnector); this.projectLinksService = new ProjectLinksService(wsConnector); this.settingsService = new SettingsService(wsConnector); - this.rootService = new RootService(wsConnector); + this.rootsService = new RootsService(wsConnector); } @Override @@ -155,7 +155,7 @@ class DefaultWsClient implements WsClient { } @Override - public RootService rootService() { - return rootService; + public RootsService rootService() { + return rootsService; } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java index 4514f55ec2d..add8512bca2 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java @@ -29,7 +29,7 @@ import org.sonarqube.ws.client.project.ProjectsService; import org.sonarqube.ws.client.projectlinks.ProjectLinksService; import org.sonarqube.ws.client.qualitygate.QualityGatesService; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; -import org.sonarqube.ws.client.root.RootService; +import org.sonarqube.ws.client.root.RootsService; import org.sonarqube.ws.client.rule.RulesService; import org.sonarqube.ws.client.setting.SettingsService; import org.sonarqube.ws.client.system.SystemService; @@ -96,5 +96,5 @@ public interface WsClient { /** * @since 6.2 */ - RootService rootService(); + RootsService rootService(); } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootService.java deleted file mode 100644 index 90d4d5e1713..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootService.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.root; - -import org.sonarqube.ws.WsRoot; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.WsConnector; - -public class RootService extends BaseService { - public RootService(WsConnector wsConnector) { - super(wsConnector, "api/root"); - } - - public WsRoot.SearchWsResponse search() { - return call(new GetRequest(path("search")), WsRoot.SearchWsResponse.parser()); - } - - public void setRoot(String login) { - PostRequest post = new PostRequest(path("set_root")) - .setParam("login", login); - - call(post); - } - - public void unsetRoot(String login) { - PostRequest post = new PostRequest(path("unset_root")) - .setParam("login", login); - - call(post); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootsService.java new file mode 100644 index 00000000000..2e9853d2cf4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootsService.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.root; + +import org.sonarqube.ws.WsRoot; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +public class RootsService extends BaseService { + public RootsService(WsConnector wsConnector) { + super(wsConnector, "api/roots"); + } + + public WsRoot.SearchWsResponse search() { + return call(new GetRequest(path("search")), WsRoot.SearchWsResponse.parser()); + } + + public void setRoot(String login) { + PostRequest post = new PostRequest(path("set_root")) + .setParam("login", login); + + call(post); + } + + public void unsetRoot(String login) { + PostRequest post = new PostRequest(path("unset_root")) + .setParam("login", login); + + call(post); + } +} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/root/RootServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/root/RootServiceTest.java deleted file mode 100644 index 616c6eb5832..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/root/RootServiceTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.root; - -import org.junit.Rule; -import org.junit.Test; -import org.sonarqube.ws.client.ServiceTester; -import org.sonarqube.ws.client.WsConnector; - -import static org.mockito.Mockito.mock; - -public class RootServiceTest { - private static final String SOME_LOGIN = "johnDoe"; - - @Rule - public ServiceTester serviceTester = new ServiceTester<>(new RootService(mock(WsConnector.class))); - - private RootService underTest = serviceTester.getInstanceUnderTest(); - - @Test - public void search() { - underTest.search(); - - serviceTester.assertThat(serviceTester.getGetRequest()) - .hasPath("search") - .andNoOtherParam(); - } - - @Test - public void setRoot() { - underTest.setRoot(SOME_LOGIN); - - serviceTester.assertThat(serviceTester.getPostRequest()) - .hasPath("set_root") - .hasParam("login", SOME_LOGIN) - .andNoOtherParam(); - } - - @Test - public void unsetRoot() { - underTest.unsetRoot(SOME_LOGIN); - - serviceTester.assertThat(serviceTester.getPostRequest()) - .hasPath("unset_root") - .hasParam("login", SOME_LOGIN) - .andNoOtherParam(); - } -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/root/RootsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/root/RootsServiceTest.java new file mode 100644 index 00000000000..9eec001e196 --- /dev/null +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/root/RootsServiceTest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.root; + +import org.junit.Rule; +import org.junit.Test; +import org.sonarqube.ws.client.ServiceTester; +import org.sonarqube.ws.client.WsConnector; + +import static org.mockito.Mockito.mock; + +public class RootsServiceTest { + private static final String SOME_LOGIN = "johnDoe"; + + @Rule + public ServiceTester serviceTester = new ServiceTester<>(new RootsService(mock(WsConnector.class))); + + private RootsService underTest = serviceTester.getInstanceUnderTest(); + + @Test + public void search() { + underTest.search(); + + serviceTester.assertThat(serviceTester.getGetRequest()) + .hasPath("search") + .andNoOtherParam(); + } + + @Test + public void setRoot() { + underTest.setRoot(SOME_LOGIN); + + serviceTester.assertThat(serviceTester.getPostRequest()) + .hasPath("set_root") + .hasParam("login", SOME_LOGIN) + .andNoOtherParam(); + } + + @Test + public void unsetRoot() { + underTest.unsetRoot(SOME_LOGIN); + + serviceTester.assertThat(serviceTester.getPostRequest()) + .hasPath("unset_root") + .hasParam("login", SOME_LOGIN) + .andNoOtherParam(); + } +} -- cgit v1.2.3