From 0577e77f6c2d9ae6d2841c2fb19f762352e9c373 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 25 Jun 2014 09:21:25 +0200 Subject: [PATCH] SONAR-5313 Return long name in /api/components/app --- .../java/org/sonar/server/component/ws/ComponentAppAction.java | 1 + sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java | 2 ++ .../org/sonar/server/component/ws/components-example-app.json | 1 + .../org/sonar/server/component/ws/ComponentAppActionTest.java | 2 ++ .../sonar/server/component/ws/ComponentAppActionTest/app.json | 1 + .../component/ws/ComponentAppActionTest/app_with_extension.json | 1 + .../app_with_extension_having_permission.json | 1 + .../ws/ComponentAppActionTest/app_with_issues_measures.json | 1 + .../app_with_issues_measures_when_period_is_set.json | 1 + .../ws/ComponentAppActionTest/app_with_manual_rules.json | 1 + .../component/ws/ComponentAppActionTest/app_with_measures.json | 1 + .../app_with_measures_when_period_is_set.json | 1 + .../component/ws/ComponentAppActionTest/app_with_periods.json | 1 + .../component/ws/ComponentAppActionTest/app_with_rules.json | 1 + .../app_with_rules_when_period_is_set.json | 1 + .../ws/ComponentAppActionTest/app_with_severities.json | 1 + .../app_with_severities_when_period_is_set.json | 1 + .../component/ws/ComponentAppActionTest/app_with_tabs.json | 1 + 18 files changed, 20 insertions(+) diff --git a/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentAppAction.java b/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentAppAction.java index 99ad6391043..e73451be671 100644 --- a/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentAppAction.java +++ b/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentAppAction.java @@ -168,6 +168,7 @@ public class ComponentAppAction implements RequestHandler { json.prop("key", component.key()); json.prop("path", component.path()); json.prop("name", component.name()); + json.prop("longName", component.longName()); json.prop("q", component.qualifier()); ComponentDto subProject = (ComponentDto) nullableComponentById(component.subProjectId(), session); diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java index 3fe51df9928..65935833d6a 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java @@ -35,6 +35,8 @@ import java.util.Locale; import java.util.Map; /** + * Used through ruby code
Internal.i18n
+ * * Bridge between JRuby webapp and Java I18n component */ public class JRubyI18n implements ServerComponent { diff --git a/sonar-server/src/main/resources/org/sonar/server/component/ws/components-example-app.json b/sonar-server/src/main/resources/org/sonar/server/component/ws/components-example-app.json index 2d7477b7b3c..a04bad19e9d 100644 --- a/sonar-server/src/main/resources/org/sonar/server/component/ws/components-example-app.json +++ b/sonar-server/src/main/resources/org/sonar/server/component/ws/components-example-app.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentAppActionTest.java b/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentAppActionTest.java index 81fd5aaac2e..13ebf05e6d5 100644 --- a/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentAppActionTest.java +++ b/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentAppActionTest.java @@ -146,6 +146,7 @@ public class ComponentAppActionTest { MockUserSession.set().setLogin("john").addComponentPermission(UserRole.USER, SUB_PROJECT_KEY, COMPONENT_KEY); ComponentDto file = new ComponentDto().setId(10L).setQualifier("FIL").setKey(COMPONENT_KEY).setName("Plugin.java") + .setLongName("src/main/java/org/sonar/api/Plugin.java") .setPath("src/main/java/org/sonar/api/Plugin.java").setSubProjectId(5L).setProjectId(1L); when(componentDao.getNullableByKey(session, COMPONENT_KEY)).thenReturn(file); when(componentDao.getById(5L, session)).thenReturn(new ComponentDto().setId(5L).setLongName("SonarQube :: Plugin API").setKey(SUB_PROJECT_KEY)); @@ -437,6 +438,7 @@ public class ComponentAppActionTest { private void addComponent() { ComponentDto file = new ComponentDto().setId(10L).setQualifier("FIL").setKey(COMPONENT_KEY).setName("Plugin.java") + .setLongName("src/main/java/org/sonar/api/Plugin.java") .setPath("src/main/java/org/sonar/api/Plugin.java").setSubProjectId(5L).setProjectId(1L); when(componentDao.getNullableByKey(session, COMPONENT_KEY)).thenReturn(file); when(componentDao.getById(5L, session)).thenReturn(new ComponentDto().setId(5L).setLongName("SonarQube :: Plugin API").setKey(SUB_PROJECT_KEY)); diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app.json index 0bc7b8dda36..46ae3cd3d85 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_extension.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_extension.json index e91a1bb424c..c0b27c2ef04 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_extension.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_extension.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_extension_having_permission.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_extension_having_permission.json index c2ea499f586..6d72995e309 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_extension_having_permission.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_extension_having_permission.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_issues_measures.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_issues_measures.json index cbc1c3f8fe9..6e688c0dc30 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_issues_measures.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_issues_measures.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_issues_measures_when_period_is_set.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_issues_measures_when_period_is_set.json index ade74eae2dd..dcd18686119 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_issues_measures_when_period_is_set.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_issues_measures_when_period_is_set.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_manual_rules.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_manual_rules.json index f75d1519346..d70a86c1e39 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_manual_rules.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_manual_rules.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_measures.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_measures.json index 83d040a3682..8f26dd9621c 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_measures.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_measures.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_measures_when_period_is_set.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_measures_when_period_is_set.json index 60e51356b2c..cce534b0462 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_measures_when_period_is_set.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_measures_when_period_is_set.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_periods.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_periods.json index 474d13fb1ec..90ff42e90a0 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_periods.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_periods.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_rules.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_rules.json index e745fe5b119..69a3163fddb 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_rules.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_rules.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_rules_when_period_is_set.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_rules_when_period_is_set.json index 65ac58302ff..9bcea6b0651 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_rules_when_period_is_set.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_rules_when_period_is_set.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_severities.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_severities.json index b490b411ef6..55a6f96ed74 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_severities.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_severities.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_severities_when_period_is_set.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_severities_when_period_is_set.json index d98a9f3634d..567ee9c2c6b 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_severities_when_period_is_set.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_severities_when_period_is_set.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", diff --git a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_tabs.json b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_tabs.json index 3009fb3d416..3288f4217ab 100644 --- a/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_tabs.json +++ b/sonar-server/src/test/resources/org/sonar/server/component/ws/ComponentAppActionTest/app_with_tabs.json @@ -1,5 +1,6 @@ { "key": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/Plugin.java", + "longName": "src/main/java/org/sonar/api/Plugin.java", "path": "src/main/java/org/sonar/api/Plugin.java", "name": "Plugin.java", "q": "FIL", -- 2.39.5