aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-09-28 10:23:02 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-02 17:18:15 +0200
commit8f2a6d59a4be822a74cb0b3d2ec233c5f3c824fb (patch)
tree86bd094c98ce8bb6ebb155aff8e2bba92f5a79a9 /server
parent94a98c6f367c3ecebc4f24e0a123c5091b7525ec (diff)
downloadsonarqube-8f2a6d59a4be822a74cb0b3d2ec233c5f3c824fb.tar.gz
sonarqube-8f2a6d59a4be822a74cb0b3d2ec233c5f3c824fb.zip
SONAR-1330 Remove qualityprofiles from api/rules/app
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java23
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java59
2 files changed, 0 insertions, 82 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java
index c632542e592..c2ffa261bbd 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java
@@ -29,7 +29,6 @@ import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.permission.OrganizationPermission;
-import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.server.user.UserSession;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_ORGANIZATION;
@@ -73,7 +72,6 @@ public class AppAction implements RulesWsAction {
JsonWriter json = response.newJsonWriter();
json.beginObject();
addPermissions(organization, json);
- addProfiles(dbSession, organization, json);
addLanguages(json);
addRuleRepositories(json, dbSession);
json.endObject().close();
@@ -85,27 +83,6 @@ public class AppAction implements RulesWsAction {
json.prop("canWrite", canWrite);
}
- private void addProfiles(DbSession dbSession, OrganizationDto organization, JsonWriter json) {
- json.name("qualityprofiles").beginArray();
- for (QProfileDto profile : dbClient.qualityProfileDao().selectOrderedByOrganizationUuid(dbSession, organization)) {
- if (languageIsSupported(profile)) {
- json
- .beginObject()
- .prop("key", profile.getKee())
- .prop("name", profile.getName())
- .prop("lang", profile.getLanguage())
- .prop("parentKey", profile.getParentKee())
- .prop("isBuiltIn", profile.isBuiltIn())
- .endObject();
- }
- }
- json.endArray();
- }
-
- private boolean languageIsSupported(QProfileDto profile) {
- return languages.get(profile.getLanguage()) != null;
- }
-
private void addLanguages(JsonWriter json) {
json.name("languages").beginObject();
for (Language language : languages.all()) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java
index 7cfeed6dcd5..a1346d28df4 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java
@@ -29,13 +29,11 @@ import org.sonar.api.utils.System2;
import org.sonar.db.DbTester;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.permission.OrganizationPermission;
-import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.db.rule.RuleRepositoryDto;
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.language.LanguageTesting;
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.organization.TestDefaultOrganizationProvider;
-import org.sonar.server.qualityprofile.QProfileTesting;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
@@ -108,56 +106,6 @@ public class AppActionTest {
}
@Test
- public void response_contains_quality_profiles_of_default_organization() {
- insertQualityProfiles(db.getDefaultOrganization());
-
- String json = tester.newRequest().execute().getInput();
- assertJson(json).isSimilarTo("{" +
- "\"qualityprofiles\": [" +
- " {" +
- " \"key\": \"XOO_P1\"," +
- " \"name\": \"P1\"," +
- " \"lang\": \"xoo\"," +
- " \"isBuiltIn\": true" +
- " }," +
- " {" +
- " \"key\": \"XOO_P2\"," +
- " \"name\": \"P2\"," +
- " \"lang\": \"xoo\"," +
- " \"parentKey\": \"XOO_P1\"," +
- " \"isBuiltIn\": false" +
- " }" +
- " ]" +
- "}");
- }
-
- @Test
- public void response_contains_quality_profiles_of_specified_organization() {
- OrganizationDto org = db.organizations().insert();
- insertQualityProfiles(org);
-
- String json = tester.newRequest()
- .setParam("organization", org.getKey())
- .execute().getInput();
-
- assertJson(json).isSimilarTo("{" +
- "\"qualityprofiles\": [" +
- " {" +
- " \"key\": \"XOO_P1\"," +
- " \"name\": \"P1\"," +
- " \"lang\": \"xoo\"" +
- " }," +
- " {" +
- " \"key\": \"XOO_P2\"," +
- " \"name\": \"P2\"," +
- " \"lang\": \"xoo\"," +
- " \"parentKey\": \"XOO_P1\"" +
- " }" +
- " ]" +
- "}");
- }
-
- @Test
public void throw_NotFoundException_if_organization_does_not_exist() {
expectedException.expect(NotFoundException.class);
expectedException.expectMessage("No organization with key 'does_not_exist'");
@@ -218,11 +166,4 @@ public class AppActionTest {
db.getSession().commit();
}
- private void insertQualityProfiles(OrganizationDto organization) {
- QProfileDto profile1 = QProfileTesting.newXooP1(organization).setIsBuiltIn(true);
- QProfileDto profile2 = QProfileTesting.newXooP2(organization).setParentKee(QProfileTesting.XOO_P1_KEY);
- db.getDbClient().qualityProfileDao().insert(db.getSession(), profile1);
- db.getDbClient().qualityProfileDao().insert(db.getSession(), profile2);
- db.commit();
- }
}