aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-03 17:27:29 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-03 17:28:54 +0100
commitf24695d415017ec78e7bc28676715fa136c0efa6 (patch)
tree8ef9ce30943b2d9281ab8d7ecd9a087e36db2ab7
parent9590f2207c793dad39f14f8c516479fce8549958 (diff)
downloadsonarqube-f24695d415017ec78e7bc28676715fa136c0efa6.tar.gz
sonarqube-f24695d415017ec78e7bc28676715fa136c0efa6.zip
Update groupId to subProjectId and rootIt to projectId in issues WS
-rw-r--r--sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java22
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml4
-rw-r--r--sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java12
-rw-r--r--sonar-server/src/main/java/org/sonar/server/issue/DefaultIssueFinder.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java44
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb6
-rw-r--r--sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java3
-rw-r--r--sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java70
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_action_plan.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions_defined_by_plugins.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_assign_to_me_action.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_changelog.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_characteristics.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_comments.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_dates.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_set_severity_action.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_sub_project.json (renamed from sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_module.json)4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_technical_debt.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_transitions.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_users.json2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_without_assign_to_me_action.json2
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/component/Component.java8
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/IssueJsonParserTest.java4
-rw-r--r--sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/issue-with-components.json4
26 files changed, 136 insertions, 77 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java
index a0c38d444d4..0722e1ece76 100644
--- a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java
+++ b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java
@@ -38,8 +38,8 @@ public class ComponentDto implements Component {
private String name;
private String longName;
private String qualifier;
- private Long groupId;
- private Long rootId;
+ private Long projectId;
+ private Long subProjectId;
public Long getId() {
return id;
@@ -110,22 +110,22 @@ public class ComponentDto implements Component {
return this;
}
- @CheckForNull
- public Long groupId() {
- return groupId;
+ public Long projectId() {
+ return projectId;
}
- public ComponentDto setGroupId(@Nullable Long groupId) {
- this.groupId = groupId;
+ public ComponentDto setProjectId(Long projectId) {
+ this.projectId = projectId;
return this;
}
- public Long rootId() {
- return rootId;
+ @CheckForNull
+ public Long subProjectId() {
+ return subProjectId;
}
- public ComponentDto setRootId(Long rootId) {
- this.rootId = rootId;
+ public ComponentDto setSubProjectId(@Nullable Long subProjectId) {
+ this.subProjectId = subProjectId;
return this;
}
diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml
index 706361aade3..19df84bfa7e 100644
--- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml
@@ -27,8 +27,8 @@
p.name as name,
p.long_name as longName,
p.qualifier as qualifier,
- p.root_id as groupId,
- s.root_project_id as rootId
+ s.root_project_id as projectId,
+ p.root_id as subProjectId
</sql>
<resultMap id="snapshotResultMap" type="Snapshot">
diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java
index 4cfad7c3f4b..086868070fd 100644
--- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java
@@ -181,8 +181,8 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
assertThat(component.name()).isEqualTo("RequestContext.java");
assertThat(component.longName()).isEqualTo("org.struts.RequestContext");
assertThat(component.qualifier()).isEqualTo("FIL");
- assertThat(component.groupId()).isEqualTo(2);
- assertThat(component.rootId()).isEqualTo(1);
+ assertThat(component.projectId()).isEqualTo(1);
+ assertThat(component.subProjectId()).isEqualTo(2);
// Module
results = dao.selectComponentsByIds(newArrayList(2L));
@@ -193,8 +193,8 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
assertThat(component.name()).isEqualTo("Struts Core");
assertThat(component.longName()).isEqualTo("Struts Core");
assertThat(component.qualifier()).isEqualTo("BRC");
- assertThat(component.groupId()).isEqualTo(1);
- assertThat(component.rootId()).isEqualTo(1);
+ assertThat(component.subProjectId()).isEqualTo(1);
+ assertThat(component.projectId()).isEqualTo(1);
// Project
results = dao.selectComponentsByIds(newArrayList(1L));
@@ -205,8 +205,8 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
assertThat(component.name()).isEqualTo("Struts");
assertThat(component.longName()).isEqualTo("Apache Struts");
assertThat(component.qualifier()).isEqualTo("TRK");
- assertThat(component.groupId()).isNull();
- assertThat(component.rootId()).isEqualTo(1);
+ assertThat(component.subProjectId()).isNull();
+ assertThat(component.projectId()).isEqualTo(1);
}
@Test
diff --git a/sonar-server/src/main/java/org/sonar/server/issue/DefaultIssueFinder.java b/sonar-server/src/main/java/org/sonar/server/issue/DefaultIssueFinder.java
index eb3263fcbe8..8d94f69b518 100644
--- a/sonar-server/src/main/java/org/sonar/server/issue/DefaultIssueFinder.java
+++ b/sonar-server/src/main/java/org/sonar/server/issue/DefaultIssueFinder.java
@@ -206,7 +206,7 @@ public class DefaultIssueFinder implements IssueFinder {
return findComponents(newHashSet(Iterables.transform(components, new Function<Component, Long>() {
@Override
public Long apply(Component input) {
- return ((ComponentDto) input).groupId();
+ return ((ComponentDto) input).subProjectId();
}
})));
}
@@ -215,7 +215,7 @@ public class DefaultIssueFinder implements IssueFinder {
return findComponents(newHashSet(Iterables.transform(components, new Function<Component, Long>() {
@Override
public Long apply(Component input) {
- return ((ComponentDto) input).rootId();
+ return ((ComponentDto) input).projectId();
}
})));
}
diff --git a/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java b/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java
index dcf82862e1d..f1971a4ad48 100644
--- a/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java
+++ b/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java
@@ -96,11 +96,6 @@ public class IssueShowWsHandler implements RequestHandler {
}
private void writeIssue(IssueQueryResult result, DefaultIssue issue, JsonWriter json) {
- // component, module and project can be null if they were removed
- ComponentDto component = (ComponentDto) result.component(issue);
- ComponentDto module = (ComponentDto) getModule(result, component);
- ComponentDto project = (ComponentDto) geProject(result, component);
-
String actionPlanKey = issue.actionPlanKey();
ActionPlan actionPlan = result.actionPlan(issue);
Long technicalDebt = issue.debt();
@@ -109,13 +104,6 @@ public class IssueShowWsHandler implements RequestHandler {
json
.prop("key", issue.key())
- .prop("component", issue.componentKey())
- .prop("componentLongName", component != null ? component.longName() : null)
- .prop("componentQualifier", component != null ? component.qualifier() : null)
- // Do not display module long name if module and project are the same
- .prop("moduleLongName", module != null && project != null && !module.getId().equals(project.getId()) ? module.longName() : null)
- .prop("project", issue.projectKey())
- .prop("projectLongName", project != null ? project.longName() : null)
.prop("rule", issue.ruleKey().toString())
.prop("ruleName", result.rule(issue).getName())
.prop("line", issue.line())
@@ -135,21 +123,45 @@ public class IssueShowWsHandler implements RequestHandler {
.prop("closeDate", closeDate != null ? DateUtils.formatDateTime(closeDate) : null)
.prop("fCloseDate", formatDate(issue.closeDate()));
+ addComponents(result, issue, json);
addUserWithLabel(result, issue.assignee(), "assignee", json);
addUserWithLabel(result, issue.reporter(), "reporter", json);
addCharacteristics(result, issue, json);
}
+ private void addComponents(IssueQueryResult result, DefaultIssue issue, JsonWriter json) {
+ // component, module and project can be null if they were removed
+ ComponentDto component = (ComponentDto) result.component(issue);
+ ComponentDto subProject = (ComponentDto) getSubProject(result, component);
+ ComponentDto project = (ComponentDto) geProject(result, component);
+
+ String projectName = project != null ? project.longName() != null ? project.longName() : project.name() : null;
+ // Do not display sub project long name if sub project and project are the same
+ String subProjectName = subProject != null && project != null && !subProject.getId().equals(project.getId()) ?
+ subProject.longName() != null ? subProject.longName() : subProject.name() :
+ null;
+
+ json
+ .prop("component", issue.componentKey())
+ .prop("componentLongName", component != null ? component.longName() : null)
+ .prop("componentQualifier", component != null ? component.qualifier() : null)
+ .prop("project", issue.projectKey())
+ .prop("projectName", projectName)
+ // Do not display sub project long name if sub project and project are the same
+ .prop("subProjectName", subProjectName)
+ ;
+ }
+
/**
* Can be null on project or on removed component
*/
@CheckForNull
- private Component getModule(IssueQueryResult result, @Nullable final ComponentDto component){
+ private Component getSubProject(IssueQueryResult result, @Nullable final ComponentDto component) {
if (component != null) {
return Iterables.find(result.components(), new Predicate<Component>() {
@Override
public boolean apply(Component input) {
- Long groupId = component.groupId();
+ Long groupId = component.subProjectId();
return groupId != null && groupId.equals(((ComponentDto) input).getId());
}
}, null);
@@ -161,12 +173,12 @@ public class IssueShowWsHandler implements RequestHandler {
* Can be null on removed component
*/
@CheckForNull
- private Component geProject(IssueQueryResult result, @Nullable final ComponentDto component){
+ private Component geProject(IssueQueryResult result, @Nullable final ComponentDto component) {
if (component != null) {
return Iterables.find(result.components(), new Predicate<Component>() {
@Override
public boolean apply(Component input) {
- return component.rootId().equals(((ComponentDto) input).getId());
+ return component.projectId().equals(((ComponentDto) input).getId());
}
}, null);
}
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb
index 2eae8b6625b..5e658dc7ba8 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb
@@ -344,9 +344,9 @@ class Api::IssuesController < Api::ApiController
hash[:name] = component.name if component.name
hash[:longName] = component.longName if component.longName
hash[:path] = component.path if component.path
- hash[:groupId] = component.groupId if component.groupId
- # On a root project, groupId is null but rootId is equal to itself, which make no sense.
- hash[:rootId] = component.rootId if component.groupId && component.rootId
+ # On a root project, subProjectId is null but projectId is equal to itself, which make no sense.
+ hash[:projectId] = component.projectId if component.subProjectId && component.projectId
+ hash[:subProjectId] = component.subProjectId if component.subProjectId
hash
end
diff --git a/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java b/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java
index e90614dc445..f35b8b0cd7f 100644
--- a/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/issue/DefaultIssueFinderTest.java
@@ -56,7 +56,8 @@ import static org.mockito.Matchers.anyListOf;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
-public class DefaultIssueFinderTest {
+public class
+ DefaultIssueFinderTest {
private static final int HOURS_IN_DAY = 8;
diff --git a/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java b/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java
index a17a9069587..cf27de1d585 100644
--- a/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java
@@ -134,15 +134,15 @@ public class IssueShowWsHandlerTest {
.setKey("org.sonar.server.issue.IssueClient")
.setLongName("SonarQube :: Issue Client")
.setQualifier("FIL")
- .setGroupId(1L)
- .setRootId(1L)
+ .setSubProjectId(1L)
+ .setProjectId(1L)
));
result.addComponents(Lists.<Component>newArrayList(new ComponentDto()
.setId(1L)
.setKey("org.sonar.Sonar")
.setLongName("SonarQube")
- .setRootId(1L)
+ .setProjectId(1L)
));
MockUserSession.set();
@@ -151,7 +151,7 @@ public class IssueShowWsHandlerTest {
}
@Test
- public void show_issue_with_module() throws Exception {
+ public void show_issue_with_sub_project() throws Exception {
String issueKey = "ABCD";
Issue issue = new DefaultIssue()
.setKey(issueKey)
@@ -173,8 +173,8 @@ public class IssueShowWsHandlerTest {
.setKey("org.sonar.server.issue.IssueClient")
.setLongName("SonarQube :: Issue Client")
.setQualifier("FIL")
- .setGroupId(2L)
- .setRootId(1L)));
+ .setSubProjectId(2L)
+ .setProjectId(1L)));
// Module
result.addComponents(Lists.<Component>newArrayList(new ComponentDto()
@@ -182,8 +182,8 @@ public class IssueShowWsHandlerTest {
.setKey("org.sonar.server.Server")
.setLongName("SonarQube :: Server")
.setQualifier("BRC")
- .setGroupId(1L)
- .setRootId(1L)));
+ .setSubProjectId(1L)
+ .setProjectId(1L)));
// Project
result.addComponents(Lists.<Component>newArrayList(new ComponentDto()
@@ -193,7 +193,53 @@ public class IssueShowWsHandlerTest {
MockUserSession.set();
WsTester.TestRequest request = tester.newRequest("show").setParam("key", issueKey);
- request.execute().assertJson(getClass(), "show_issue_with_module.json");
+ request.execute().assertJson(getClass(), "show_issue_with_sub_project.json");
+ }
+
+ @Test
+ public void use_project_and_sub_project_names_if_no_long_name() throws Exception {
+ String issueKey = "ABCD";
+ Issue issue = new DefaultIssue()
+ .setKey(issueKey)
+ .setComponentKey("org.sonar.server.issue.IssueClient")
+ .setProjectKey("org.sonar.Sonar")
+ .setRuleKey(RuleKey.of("squid", "AvoidCycle"))
+ .setLine(12)
+ .setEffortToFix(2.0)
+ .setMessage("Fix it")
+ .setResolution("FIXED")
+ .setStatus("CLOSED")
+ .setSeverity("MAJOR")
+ .setCreationDate(issue_creation_date);
+ issues.add(issue);
+
+ // File
+ result.addComponents(Lists.<Component>newArrayList(new ComponentDto()
+ .setId(10L)
+ .setKey("org.sonar.server.issue.IssueClient")
+ .setLongName("SonarQube :: Issue Client")
+ .setQualifier("FIL")
+ .setSubProjectId(2L)
+ .setProjectId(1L)));
+
+ // Module
+ result.addComponents(Lists.<Component>newArrayList(new ComponentDto()
+ .setId(2L)
+ .setKey("org.sonar.server.Server")
+ .setName("SonarQube :: Server")
+ .setQualifier("BRC")
+ .setSubProjectId(1L)
+ .setProjectId(1L)));
+
+ // Project
+ result.addComponents(Lists.<Component>newArrayList(new ComponentDto()
+ .setId(1L)
+ .setKey("org.sonar.Sonar")
+ .setName("SonarQube")));
+
+ MockUserSession.set();
+ WsTester.TestRequest request = tester.newRequest("show").setParam("key", issueKey);
+ request.execute().assertJson(getClass(), "show_issue_with_sub_project.json");
}
@Test
@@ -467,15 +513,15 @@ public class IssueShowWsHandlerTest {
.setKey("org.sonar.server.issue.IssueClient")
.setLongName("SonarQube :: Issue Client")
.setQualifier("FIL")
- .setGroupId(1L)
- .setRootId(1L)
+ .setSubProjectId(1L)
+ .setProjectId(1L)
));
result.addComponents(Lists.<Component>newArrayList(new ComponentDto()
.setId(1L)
.setKey("org.sonar.Sonar")
.setLongName("SonarQube")
- .setRootId(1L)
+ .setProjectId(1L)
));
}
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue.json
index be5cd9c8346..6a0eb80bcff 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"line": 12,
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_action_plan.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_action_plan.json
index 49f7db8f8c0..71dff779e78 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_action_plan.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_action_plan.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"actionPlan" : "AP-ABCD",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions.json
index 011a92460cb..eb7f97febca 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"status": "OPEN",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions_defined_by_plugins.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions_defined_by_plugins.json
index 1b75cbc5b7c..9f83417b32a 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions_defined_by_plugins.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions_defined_by_plugins.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"status": "OPEN",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_assign_to_me_action.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_assign_to_me_action.json
index 011a92460cb..eb7f97febca 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_assign_to_me_action.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_assign_to_me_action.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"status": "OPEN",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_changelog.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_changelog.json
index 35bc7c3ef59..ceef684036d 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_changelog.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_changelog.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"creationDate": "2014-01-22T19:10:03+0100",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_characteristics.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_characteristics.json
index 373ad27273c..833d8006244 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_characteristics.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_characteristics.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"characteristic": "Maintainability",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_comments.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_comments.json
index 1e863053a9b..8eba44a1006 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_comments.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_comments.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"creationDate": "2014-01-22T19:10:03+0100",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_dates.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_dates.json
index 67db98ec7c1..de7b32bec99 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_dates.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_dates.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"creationDate": "2014-01-22T19:10:03+0100",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_set_severity_action.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_set_severity_action.json
index 9e2ce2a3daa..242d99c6a3e 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_set_severity_action.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_set_severity_action.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"status": "OPEN",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_module.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_sub_project.json
index fb8f477a206..aa7b9e3860d 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_module.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_sub_project.json
@@ -4,9 +4,9 @@
"component": "org.sonar.server.issue.IssueClient",
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
- "moduleLongName": "SonarQube :: Server",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
+ "subProjectName": "SonarQube :: Server",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"line": 12,
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_technical_debt.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_technical_debt.json
index f938630cfaa..d7cbcc87428 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_technical_debt.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_technical_debt.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"debt": "2 hours 1 minutes",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_transitions.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_transitions.json
index d7646909a37..ed14d165979 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_transitions.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_transitions.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"status": "RESOLVED",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_users.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_users.json
index f26e887d9d6..5f69ff25f67 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_users.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_users.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"assignee": "john",
diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_without_assign_to_me_action.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_without_assign_to_me_action.json
index 4adcdc4d533..ffde3996c13 100644
--- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_without_assign_to_me_action.json
+++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_without_assign_to_me_action.json
@@ -5,7 +5,7 @@
"componentLongName": "SonarQube :: Issue Client",
"componentQualifier": "FIL",
"project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
+ "projectName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
"assignee": "john",
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/component/Component.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/component/Component.java
index 29680c2d21b..c184f9b4ae2 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/component/Component.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/component/Component.java
@@ -60,16 +60,16 @@ public class Component {
* @since 4.2
*/
@CheckForNull
- public Long groupId() {
- return JsonUtils.getLong(json, "groupId");
+ public Long subProjectId() {
+ return JsonUtils.getLong(json, "subProjectId");
}
/**
* @since 4.2
*/
@CheckForNull
- public Long rootId() {
- return JsonUtils.getLong(json, "rootId");
+ public Long projectId() {
+ return JsonUtils.getLong(json, "projectId");
}
/**
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/IssueJsonParserTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/IssueJsonParserTest.java
index bd6c2f81b16..5440852389b 100644
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/IssueJsonParserTest.java
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/IssueJsonParserTest.java
@@ -165,8 +165,8 @@ public class IssueJsonParserTest {
assertThat(component.qualifier()).isEqualTo("CLA");
assertThat(component.name()).isEqualTo("Action");
assertThat(component.longName()).isEqualTo("org.struts.Action");
- assertThat(component.groupId()).isEqualTo(2L);
- assertThat(component.rootId()).isEqualTo(1L);
+ assertThat(component.subProjectId()).isEqualTo(2L);
+ assertThat(component.projectId()).isEqualTo(1L);
}
@Test
diff --git a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/issue-with-components.json b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/issue-with-components.json
index c0b649fdd29..685063b6edb 100644
--- a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/issue-with-components.json
+++ b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/issue-with-components.json
@@ -40,8 +40,8 @@
"name": "Action",
"qualifier": "CLA",
"longName": "org.struts.Action",
- "groupId" : 2,
- "rootId" : 1
+ "subProjectId" : 2,
+ "projectId" : 1
}
],
"paging": {