Browse Source

Improve response of POST api/issues/assign

Return the same format as for api/issues/search, except that:
- field "issues" is replaced by "issue"
- of course there are no facets nor paging
- field "languages" is not present (that should be dropped from api/issues/search too)
tags/5.2-RC1
Simon Brandhof 8 years ago
parent
commit
31b625fdf1
34 changed files with 3478 additions and 2105 deletions
  1. 1
    2
      server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java
  2. 1
    1
      server/sonar-server/src/main/java/org/sonar/server/issue/ws/OperationResponseWriter.java
  3. 2
    2
      server/sonar-server/src/main/java/org/sonar/server/issue/ws/Search2Action.java
  4. 61
    32
      server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
  5. 1
    17
      server/sonar-server/src/main/java/org/sonar/server/ws/WsResponseCommonFormat.java
  6. 53
    53
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java
  7. 39
    39
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
  8. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/display_file_facet.json
  9. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/display_module_facet.json
  10. 4
    4
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/display_non_sticky_project_facet.json
  11. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/display_sticky_project_facet.json
  12. 8
    8
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/issues_on_different_projects.json
  13. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_authors.json
  14. 4
    4
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_developer.json
  15. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_directory_uuid.json
  16. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_file_key.json
  17. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_file_uuid.json
  18. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_project_uuid.json
  19. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_test_key.json
  20. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_view_uuid.json
  21. 1
    1
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/assigned_to_me_facet_sticky.json
  22. 1
    1
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json
  23. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets_debt.json
  24. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_zero_facets.json
  25. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/filter_by_assigned_to_me.json
  26. 2
    2
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/hide_rules.json
  27. 4
    4
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/issue_on_removed_file.json
  28. 1
    1
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/issue_with_action_plan.json
  29. 1
    1
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/response_contains_all_fields_except_additional_fields.json
  30. 6
    6
      server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/sort_by_updated_at.json
  31. 54
    308
      sonar-ws/src/main/gen-java/org/sonarqube/ws/Common.java
  32. 3160
    1548
      sonar-ws/src/main/gen-java/org/sonarqube/ws/Issues.java
  33. 2
    5
      sonar-ws/src/main/protobuf/ws-common.proto
  34. 46
    40
      sonar-ws/src/main/protobuf/ws-issues.proto

+ 1
- 2
server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java View File

@@ -54,7 +54,7 @@ public class AssignAction implements IssuesWsAction {
.setRequired(true)
.setExampleValue("5bccd6e8-f525-43a2-8d76-fcb13dde79ef");
action.createParam("assignee")
// TODO document absent value for unassign, or _me for assigning to me
// TODO document absent value for unassign, and "_me" for assigning to me
.setDescription("Login of the assignee")
.setExampleValue("admin");
action.createParam("me")
@@ -64,7 +64,6 @@ public class AssignAction implements IssuesWsAction {

@Override
public void handle(Request request, Response response) throws Exception {

String assignee = request.param("assignee");
if ("_me".equals(assignee) || BooleanUtils.isTrue(request.paramAsBoolean("me"))) {
// Permission is currently checked by IssueService. We still

+ 1
- 1
server/sonar-server/src/main/java/org/sonar/server/issue/ws/OperationResponseWriter.java View File

@@ -42,7 +42,7 @@ public class OperationResponseWriter {
ALL_ADDITIONAL_FIELDS, singletonList(issueKey));
SearchResponseData data = loader.load(collector, null);

Issues.Search responseBody = this.format.format(ALL_ADDITIONAL_FIELDS, data, null, null);
Issues.Operation responseBody = this.format.formatOperation(data);

WsUtils.writeProtobuf(responseBody, request, response);
}

+ 2
- 2
server/sonar-server/src/main/java/org/sonar/server/issue/ws/Search2Action.java View File

@@ -58,7 +58,7 @@ public class Search2Action implements IssuesWsAction {

private static final String INTERNAL_PARAMETER_DISCLAIMER = "This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. ";
public static final String ADDITIONAL_FIELDS = "additionalFields";
public static final String SEARCH_ACTION = "search2";
public static final String SEARCH_ACTION = "search";

private final UserSession userSession;
private final IssueService service;
@@ -256,7 +256,7 @@ public class Search2Action implements IssuesWsAction {

// FIXME allow long in Paging
Paging paging = Paging.create(options.getLimit(), options.getPage(), (int) result.getTotal());
Issues.Search responseBody = searchResponseFormat.format(additionalFields, data, paging, facets);
Issues.Search responseBody = searchResponseFormat.formatSearch(additionalFields, data, paging, facets);
WsUtils.writeProtobuf(responseBody, request, response);
}


+ 61
- 32
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java View File

@@ -19,6 +19,7 @@
*/
package org.sonar.server.issue.ws;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
@@ -60,34 +61,51 @@ public class SearchResponseFormat {
this.languages = languages;
}

public Issues.Search format(Set<SearchAdditionalField> fields, SearchResponseData data,
@Nullable Paging paging, @Nullable Facets facets) {
public Issues.Search formatSearch(Set<SearchAdditionalField> fields, SearchResponseData data,
Paging paging, @Nullable Facets facets) {
Issues.Search.Builder response = Issues.Search.newBuilder();

if (paging != null) {
formatPaging(paging, response);
}
formatPaging(paging, response);
formatDebtTotal(data, response);
formatIssues(fields, data, response);
formatComponents(data, response);
response.addAllIssues(formatIssues(fields, data));
response.addAllComponents(formatComponents(data));
if (facets != null) {
formatFacets(facets, response);
}
if (fields.contains(SearchAdditionalField.RULES)) {
formatRules(data, response);
response.setRulesPresentIfEmpty(true);
response.addAllRules(formatRules(data));
}
if (fields.contains(SearchAdditionalField.USERS)) {
formatUsers(data, response);
response.setUsersPresentIfEmpty(true);
response.addAllUsers(formatUsers(data));
}
if (fields.contains(SearchAdditionalField.ACTION_PLANS)) {
formatActionPlans(data, response);
response.setActionPlansPresentIfEmpty(true);
response.addAllActionPlans(formatActionPlans(data));
}
if (fields.contains(SearchAdditionalField.LANGUAGES)) {
formatLanguages(response);
response.setLanguagesPresentIfEmpty(true);
response.addAllLanguages(formatLanguages());
}
return response.build();
}

public Issues.Operation formatOperation(SearchResponseData data) {
Issues.Operation.Builder response = Issues.Operation.newBuilder();

if (data.getIssues().size() == 1) {
Issues.Issue.Builder issueBuilder = Issues.Issue.newBuilder();
formatIssue(issueBuilder, data.getIssues().get(0), data);
response.setIssue(issueBuilder.build());
}
response.addAllComponents(formatComponents(data));
response.addAllRules(formatRules(data));
response.addAllUsers(formatUsers(data));
response.addAllActionPlans(formatActionPlans(data));
return response.build();
}

private void formatDebtTotal(SearchResponseData data, Issues.Search.Builder response) {
Long debt = data.getDebtTotal();
if (debt != null) {
@@ -102,7 +120,8 @@ public class SearchResponseFormat {
response.setPaging(commonFormat.formatPaging(paging));
}

private void formatIssues(Set<SearchAdditionalField> fields, SearchResponseData data, Issues.Search.Builder response) {
private List<Issues.Issue> formatIssues(Set<SearchAdditionalField> fields, SearchResponseData data) {
List<Issues.Issue> result = new ArrayList<>();
Issues.Issue.Builder issueBuilder = Issues.Issue.newBuilder();
for (IssueDto dto : data.getIssues()) {
issueBuilder.clear();
@@ -117,20 +136,25 @@ public class SearchResponseFormat {
formatIssueComments(data, issueBuilder, dto);
}
// TODO attributes
response.addIssues(issueBuilder.build());
result.add(issueBuilder.build());
}
return result;
}

private void formatIssue(Issues.Issue.Builder issueBuilder, IssueDto dto, SearchResponseData data) {
issueBuilder.setKey(dto.getKey());
ComponentDto component = data.getComponentByUuid(dto.getComponentUuid());
issueBuilder.setComponent(dto.getComponentUuid());
// Only used for the compatibility with the Issues Java WS Client <= 4.4 used by Eclipse
issueBuilder.setComponent(dto.getComponentKey());
// Only used for the compatibility with the Java WS Client <= 4.4 used by Eclipse
issueBuilder.setComponentId(component.getId());

ComponentDto project = data.getComponentByUuid(dto.getProjectUuid());
if (project != null) {
issueBuilder.setProject(project.uuid());
issueBuilder.setProject(project.getKey());
}
ComponentDto subProject = data.getComponentByUuid(dto.getModuleUuid());
if (subProject != null) {
issueBuilder.setSubProject(subProject.getKey());
}
issueBuilder.setRule(dto.getRuleKey().toString());
issueBuilder.setSeverity(Common.Severity.valueOf(dto.getSeverity()));
@@ -205,38 +229,41 @@ public class SearchResponseFormat {
}
}

private void formatRules(SearchResponseData data, Issues.Search.Builder response) {
response.setRulesPresentIfEmpty(true);
private List<Common.Rule> formatRules(SearchResponseData data) {
List<Common.Rule> result = new ArrayList<>();
List<RuleDto> rules = data.getRules();
if (rules != null) {
for (RuleDto rule : rules) {
response.addRules(commonFormat.formatRule(rule));
result.add(commonFormat.formatRule(rule).build());
}
}
return result;
}

private void formatComponents(SearchResponseData data, Issues.Search.Builder response) {
response.setComponentsPresentIfEmpty(true);
private List<Common.Component> formatComponents(SearchResponseData data) {
List<Common.Component> result = new ArrayList<>();
Collection<ComponentDto> components = data.getComponents();
if (components != null) {
for (ComponentDto dto : components) {
response.addComponents(commonFormat.formatComponent(dto));
result.add(commonFormat.formatComponent(dto).build());
}
}
return result;
}

private void formatUsers(SearchResponseData data, Issues.Search.Builder response) {
response.setUsersPresentIfEmpty(true);
private List<Common.User> formatUsers(SearchResponseData data) {
List<Common.User> result = new ArrayList<>();
List<UserDto> users = data.getUsers();
if (users != null) {
for (UserDto user : users) {
response.addUsers(commonFormat.formatUser(user));
result.add(commonFormat.formatUser(user).build());
}
}
return result;
}

private void formatActionPlans(SearchResponseData data, Issues.Search.Builder response) {
response.setActionPlansPresentIfEmpty(true);
private List<Issues.ActionPlan> formatActionPlans(SearchResponseData data) {
List<Issues.ActionPlan> result = new ArrayList<>();
List<ActionPlanDto> actionPlans = data.getActionPlans();
if (actionPlans != null) {
Issues.ActionPlan.Builder planBuilder = Issues.ActionPlan.newBuilder();
@@ -246,26 +273,28 @@ public class SearchResponseFormat {
.setKey(actionPlan.getKey())
.setName(nullToEmpty(actionPlan.getName()))
.setStatus(nullToEmpty(actionPlan.getStatus()))
.setProject(nullToEmpty(actionPlan.getProjectUuid()));
.setProject(nullToEmpty(actionPlan.getProjectKey()));
Date deadLine = actionPlan.getDeadLine();
if (deadLine != null) {
planBuilder.setDeadLine(DateUtils.formatDateTime(deadLine));
}
response.addActionPlans(planBuilder.build());
result.add(planBuilder.build());
}
}
return result;
}

private void formatLanguages(Issues.Search.Builder response) {
response.setLanguagesPresentIfEmpty(true);
private List<Issues.Language> formatLanguages() {
List<Issues.Language> result = new ArrayList<>();
Issues.Language.Builder builder = Issues.Language.newBuilder();
for (Language lang : languages.all()) {
builder
.clear()
.setKey(lang.getKey())
.setName(lang.getName());
response.addLanguages(builder.build());
result.add(builder.build());
}
return result;
}

private void formatFacets(Facets facets, Issues.Search.Builder response) {

+ 1
- 17
server/sonar-server/src/main/java/org/sonar/server/ws/WsResponseCommonFormat.java View File

@@ -26,11 +26,9 @@ import org.sonar.api.utils.Paging;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.rule.RuleDto;
import org.sonar.db.user.UserDto;
import org.sonar.markdown.Markdown;
import org.sonarqube.ws.Common;

import static com.google.common.base.Strings.nullToEmpty;
import static java.lang.String.format;

public class WsResponseCommonFormat {

@@ -51,7 +49,7 @@ public class WsResponseCommonFormat {
public Common.Rule.Builder formatRule(RuleDto rule) {
Common.Rule.Builder builder = Common.Rule.newBuilder()
.setKey(rule.getKey().toString())
.setDesc(nullToEmpty(rule.getDescription()))
.setName(nullToEmpty(rule.getName()))
.setStatus(Common.RuleStatus.valueOf(rule.getStatus().name()));

builder.setLang(nullToEmpty(rule.getLanguage()));
@@ -59,20 +57,6 @@ public class WsResponseCommonFormat {
if (lang != null) {
builder.setLangName(lang.getName());
}

String desc = rule.getDescription();
if (desc != null) {
switch (rule.getDescriptionFormat()) {
case HTML:
builder.setDesc(desc);
break;
case MARKDOWN:
builder.setDesc(Markdown.convertToHtml(desc));
break;
default:
throw new IllegalArgumentException(format("Unknown description format '%s' on rule '%s'", rule.getDescriptionFormat(), rule.getKey()));
}
}
return builder;
}


+ 53
- 53
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java View File

@@ -83,9 +83,9 @@ public class SearchActionComponentsMediumTest {
@Test
public void issues_on_different_projects() throws Exception {
RuleDto rule = newRule();
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
IssueDto issue = IssueTesting.newDto(rule, file, project)
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
.setStatus("OPEN").setResolution("OPEN")
@@ -94,9 +94,9 @@ public class SearchActionComponentsMediumTest {
.setIssueUpdateDate(DateUtils.parseDateTime("2017-12-04T00:00:00+0100"));
db.issueDao().insert(session, issue);

ComponentDto project2 = insertComponent(ComponentTesting.newProjectDto("P2").setKey("MyProject2"));
ComponentDto project2 = insertComponent(ComponentTesting.newProjectDto("P2").setKey("PK2"));
setDefaultProjectPermission(project2);
ComponentDto file2 = insertComponent(ComponentTesting.newFileDto(project2, "F2").setKey("MyComponent2"));
ComponentDto file2 = insertComponent(ComponentTesting.newFileDto(project2, "F2").setKey("FK2"));
IssueDto issue2 = IssueTesting.newDto(rule, file2, project2)
.setKee("92fd47d4-b650-4037-80bc-7b112bd4eac2")
.setStatus("OPEN").setResolution("OPEN")
@@ -113,9 +113,9 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_project_uuid() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
db.issueDao().insert(session, issue);
session.commit();
@@ -144,15 +144,15 @@ public class SearchActionComponentsMediumTest {

@Test
public void project_facet_is_sticky() throws Exception {
ComponentDto project1 = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject1"));
ComponentDto project2 = insertComponent(ComponentTesting.newProjectDto("P2").setKey("MyProject2"));
ComponentDto project3 = insertComponent(ComponentTesting.newProjectDto("P3").setKey("MyProject3"));
ComponentDto project1 = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
ComponentDto project2 = insertComponent(ComponentTesting.newProjectDto("P2").setKey("PK2"));
ComponentDto project3 = insertComponent(ComponentTesting.newProjectDto("P3").setKey("PK3"));
setDefaultProjectPermission(project1);
setDefaultProjectPermission(project2);
setDefaultProjectPermission(project3);
ComponentDto file1 = insertComponent(ComponentTesting.newFileDto(project1, "F1").setKey("MyComponent1"));
ComponentDto file2 = insertComponent(ComponentTesting.newFileDto(project2, "F2").setKey("MyComponent2"));
ComponentDto file3 = insertComponent(ComponentTesting.newFileDto(project3, "F3").setKey("MyComponent3"));
ComponentDto file1 = insertComponent(ComponentTesting.newFileDto(project1, "F1").setKey("FK1"));
ComponentDto file2 = insertComponent(ComponentTesting.newFileDto(project2, "F2").setKey("FK2"));
ComponentDto file3 = insertComponent(ComponentTesting.newFileDto(project3, "F3").setKey("FK3"));
RuleDto rule = newRule();
IssueDto issue1 = IssueTesting.newDto(rule, file1, project1).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
IssueDto issue2 = IssueTesting.newDto(rule, file2, project2).setKee("2bd4eac2-b650-4037-80bc-7b1182fd47d4");
@@ -170,9 +170,9 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_file_uuid() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
db.issueDao().insert(session, issue);
session.commit();
@@ -201,10 +201,10 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_file_key() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto unitTest = insertComponent(ComponentTesting.newFileDto(project, "F2").setQualifier(Qualifiers.UNIT_TEST_FILE).setKey("MyComponentTest"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
ComponentDto unitTest = insertComponent(ComponentTesting.newFileDto(project, "F2").setQualifier(Qualifiers.UNIT_TEST_FILE).setKey("FK2"));
RuleDto rule = newRule();
IssueDto issueOnFile = IssueTesting.newDto(rule, file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
IssueDto issueOnTest = IssueTesting.newDto(rule, unitTest, project).setKee("2bd4eac2-b650-4037-80bc-7b1182fd47d4");
@@ -226,11 +226,11 @@ public class SearchActionComponentsMediumTest {

@Test
public void display_file_facet() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file1 = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent1"));
ComponentDto file2 = insertComponent(ComponentTesting.newFileDto(project, "F2").setKey("MyComponent2"));
ComponentDto file3 = insertComponent(ComponentTesting.newFileDto(project, "F3").setKey("MyComponent3"));
ComponentDto file1 = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
ComponentDto file2 = insertComponent(ComponentTesting.newFileDto(project, "F2").setKey("FK2"));
ComponentDto file3 = insertComponent(ComponentTesting.newFileDto(project, "F3").setKey("FK3"));
RuleDto newRule = newRule();
IssueDto issue1 = IssueTesting.newDto(newRule, file1, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
IssueDto issue2 = IssueTesting.newDto(newRule, file2, project).setKee("2bd4eac2-b650-4037-80bc-7b1182fd47d4");
@@ -248,10 +248,10 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_directory_path() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto directory = insertComponent(ComponentTesting.newDirectory(project, "D1", "src/main/java/dir"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent").setPath(directory.path() + "/MyComponent.java"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1").setPath(directory.path() + "/MyComponent.java"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
db.issueDao().insert(session, issue);
session.commit();
@@ -280,14 +280,14 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_directory_path_in_different_modules() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto module1 = insertComponent(ComponentTesting.newModuleDto("M1", project).setKey("module1"));
ComponentDto module2 = insertComponent(ComponentTesting.newModuleDto("M2", project).setKey("module2"));
ComponentDto module1 = insertComponent(ComponentTesting.newModuleDto("M1", project).setKey("MK1"));
ComponentDto module2 = insertComponent(ComponentTesting.newModuleDto("M2", project).setKey("MK2"));
ComponentDto directory1 = insertComponent(ComponentTesting.newDirectory(module1, "D1", "src/main/java/dir"));
ComponentDto directory2 = insertComponent(ComponentTesting.newDirectory(module2, "D2", "src/main/java/dir"));
ComponentDto file1 = insertComponent(ComponentTesting.newFileDto(module1, "F1").setKey("module1:MyComponent").setPath(directory1.path() + "/MyComponent.java"));
insertComponent(ComponentTesting.newFileDto(module2, "F2").setKey("module2:MyComponent").setPath(directory2.path() + "/MyComponent.java"));
ComponentDto file1 = insertComponent(ComponentTesting.newFileDto(module1, "F1").setKey("FK1").setPath(directory1.path() + "/MyComponent.java"));
insertComponent(ComponentTesting.newFileDto(module2, "F2").setKey("FK2").setPath(directory2.path() + "/MyComponent.java"));
RuleDto rule = newRule();
IssueDto issue1 = IssueTesting.newDto(rule, file1, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
db.issueDao().insert(session, issue1);
@@ -330,14 +330,14 @@ public class SearchActionComponentsMediumTest {

@Test
public void display_module_facet() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto module = insertComponent(ComponentTesting.newModuleDto("M1", project).setKey("MyModule"));
ComponentDto subModule1 = insertComponent(ComponentTesting.newModuleDto("SUBM1", module).setKey("MySubModule1"));
ComponentDto subModule2 = insertComponent(ComponentTesting.newModuleDto("SUBM2", module).setKey("MySubModule2"));
ComponentDto subModule3 = insertComponent(ComponentTesting.newModuleDto("SUBM3", module).setKey("MySubModule3"));
ComponentDto file1 = insertComponent(ComponentTesting.newFileDto(subModule1, "F1").setKey("MyComponent1"));
ComponentDto file2 = insertComponent(ComponentTesting.newFileDto(subModule2, "F2").setKey("MyComponent2"));
ComponentDto module = insertComponent(ComponentTesting.newModuleDto("M1", project).setKey("MK1"));
ComponentDto subModule1 = insertComponent(ComponentTesting.newModuleDto("SUBM1", module).setKey("SUBMK1"));
ComponentDto subModule2 = insertComponent(ComponentTesting.newModuleDto("SUBM2", module).setKey("SUBMK2"));
ComponentDto subModule3 = insertComponent(ComponentTesting.newModuleDto("SUBM3", module).setKey("SUBMK3"));
ComponentDto file1 = insertComponent(ComponentTesting.newFileDto(subModule1, "F1").setKey("FK1"));
ComponentDto file2 = insertComponent(ComponentTesting.newFileDto(subModule2, "F2").setKey("FK2"));
RuleDto newRule = newRule();
IssueDto issue1 = IssueTesting.newDto(newRule, file1, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
IssueDto issue2 = IssueTesting.newDto(newRule, file2, project).setKee("2bd4eac2-b650-4037-80bc-7b1182fd47d4");
@@ -355,10 +355,10 @@ public class SearchActionComponentsMediumTest {

@Test
public void display_directory_facet() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto directory = insertComponent(ComponentTesting.newDirectory(project, "D1", "src/main/java/dir"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent").setPath(directory.path() + "/MyComponent.java"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1").setPath(directory.path() + "/MyComponent.java"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
db.issueDao().insert(session, issue);
session.commit();
@@ -374,9 +374,9 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_view_uuid() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
insertIssue(IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2"));

ComponentDto view = insertComponent(ComponentTesting.newProjectDto("V1").setQualifier(Qualifiers.VIEW).setKey("MyView"));
@@ -393,9 +393,9 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_view_uuid_return_only_authorized_view() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
insertIssue(IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2"));

ComponentDto view = insertComponent(ComponentTesting.newProjectDto("V1").setQualifier(Qualifiers.VIEW).setKey("MyView"));
@@ -413,9 +413,9 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_sub_view_uuid() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
insertIssue(IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2"));

ComponentDto view = insertComponent(ComponentTesting.newProjectDto("V1").setQualifier(Qualifiers.VIEW).setKey("MyView"));
@@ -434,9 +434,9 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_sub_view_uuid_return_only_authorized_view() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
insertIssue(IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2"));

ComponentDto view = insertComponent(ComponentTesting.newProjectDto("V1").setQualifier(Qualifiers.VIEW).setKey("MyView"));
@@ -456,9 +456,9 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_author() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
RuleDto newRule = newRule();
IssueDto issue1 = IssueTesting.newDto(newRule, file, project).setAuthorLogin("leia").setKee("2bd4eac2-b650-4037-80bc-7b112bd4eac2");
IssueDto issue2 = IssueTesting.newDto(newRule, file, project).setAuthorLogin("luke@skywalker.name").setKee("82fd47d4-b650-4037-80bc-7b1182fd47d4");
@@ -482,9 +482,9 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_developer() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
ComponentDto developer = insertComponent(ComponentTesting.newDeveloper("Anakin Skywalker"));
db.authorDao().insertAuthor("vader", developer.getId());
db.authorDao().insertAuthor("anakin@skywalker.name", developer.getId());
@@ -504,13 +504,13 @@ public class SearchActionComponentsMediumTest {

@Test
public void search_by_developer_technical_project() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));

ComponentDto otherProject = insertComponent(ComponentTesting.newProjectDto("P2").setKey("OtherProject"));
ComponentDto otherProject = insertComponent(ComponentTesting.newProjectDto("P2").setKey("PK2"));
setDefaultProjectPermission(otherProject);
ComponentDto otherFile = insertComponent(ComponentTesting.newFileDto(otherProject, "F2").setKey("OtherComponent"));
ComponentDto otherFile = insertComponent(ComponentTesting.newFileDto(otherProject, "F2").setKey("FK2"));

ComponentDto developer = insertComponent(ComponentTesting.newDeveloper("Anakin Skywalker"));
ComponentDto technicalProject = insertComponent(ComponentTesting.newDevProjectCopy("COPY_P1", project, developer));

+ 39
- 39
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java View File

@@ -116,9 +116,9 @@ public class SearchActionMediumTest {
db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));
db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));

ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project)
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
.setDebt(10L)
@@ -146,9 +146,9 @@ public class SearchActionMediumTest {
db.userDao().insert(session, new UserDto().setLogin("john").setName("John"));
db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));

ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project)
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
db.issueDao().insert(session, issue);
@@ -182,9 +182,9 @@ public class SearchActionMediumTest {
db.userDao().insert(session, new UserDto().setLogin("john").setName("John").setEmail("john@email.com"));
db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));

ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project)
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
db.issueDao().insert(session, issue);
@@ -214,9 +214,9 @@ public class SearchActionMediumTest {

@Test
public void issue_with_action_plan() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));

tester.get(ActionPlanDao.class).save(new ActionPlanDto()
.setKey("AP-ABCD")
@@ -244,9 +244,9 @@ public class SearchActionMediumTest {
@Ignore("temporarily disabled")
@Test
public void issue_with_attributes() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project)
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
.setIssueAttributes(KeyValueFormat.format(ImmutableMap.of("jira-issue-key", "SONAR-1234")));
@@ -263,9 +263,9 @@ public class SearchActionMediumTest {
public void load_additional_fields() throws Exception {
db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));
db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));

tester.get(ActionPlanDao.class).save(new ActionPlanDto()
.setKey("AP-ABCD")
@@ -293,11 +293,11 @@ public class SearchActionMediumTest {
@Test
public void issue_on_removed_file() throws Exception {
RuleDto rule = newRule();
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto removedFile = insertComponent(ComponentTesting.newFileDto(project).setUuid("REMOVED_FILE_ID")
.setEnabled(false)
.setKey("RemovedComponent"));
.setKey("REMOVED_FILE_KEY")
.setEnabled(false));

IssueDto issue = IssueTesting.newDto(rule, removedFile, project)
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
@@ -317,9 +317,9 @@ public class SearchActionMediumTest {

@Test
public void issue_contains_component_id_for_eclipse() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project);
db.issueDao().insert(session, issue);
session.commit();
@@ -332,9 +332,9 @@ public class SearchActionMediumTest {
@Test
public void apply_paging_with_one_component() throws Exception {
RuleDto rule = newRule();
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
for (int i = 0; i < QueryContext.MAX_LIMIT + 1; i++) {
IssueDto issue = IssueTesting.newDto(rule, file, project);
tester.get(IssueDao.class).insert(session, issue);
@@ -363,9 +363,9 @@ public class SearchActionMediumTest {

@Test
public void display_facets() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project)
.setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
.setIssueUpdateDate(DateUtils.parseDate("2017-12-04"))
@@ -387,9 +387,9 @@ public class SearchActionMediumTest {

@Test
public void display_facets_in_debt_mode() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project)
.setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
.setIssueUpdateDate(DateUtils.parseDate("2017-12-04"))
@@ -412,9 +412,9 @@ public class SearchActionMediumTest {

@Test
public void display_zero_valued_facets_for_selected_items() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project)
.setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
.setIssueUpdateDate(DateUtils.parseDate("2017-12-04"))
@@ -440,9 +440,9 @@ public class SearchActionMediumTest {
public void filter_by_assigned_to_me() throws Exception {
db.userDao().insert(session, new UserDto().setLogin("john").setName("John").setEmail("john@email.com"));

ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
RuleDto rule = newRule();
IssueDto issue1 = IssueTesting.newDto(rule, file, project)
.setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
@@ -484,9 +484,9 @@ public class SearchActionMediumTest {
public void filter_by_assigned_to_me_unauthenticated() throws Exception {
userSessionRule.login();

ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
RuleDto rule = newRule();
IssueDto issue1 = IssueTesting.newDto(rule, file, project)
.setStatus("OPEN")
@@ -514,9 +514,9 @@ public class SearchActionMediumTest {
public void assigned_to_me_facet_is_sticky_relative_to_assignees() throws Exception {
db.userDao().insert(session, new UserDto().setLogin("alice").setName("Alice").setEmail("alice@email.com"));

ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyFile"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
RuleDto rule = newRule();
IssueDto issue1 = IssueTesting.newDto(rule, file, project)
.setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
@@ -557,9 +557,9 @@ public class SearchActionMediumTest {
@Test
public void sort_by_updated_at() throws Exception {
RuleDto rule = newRule();
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
db.issueDao().insert(session, IssueTesting.newDto(rule, file, project)
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac1")
.setIssueUpdateDate(DateUtils.parseDateTime("2014-11-02T00:00:00+0100")));
@@ -582,9 +582,9 @@ public class SearchActionMediumTest {
@Test
public void paging() throws Exception {
RuleDto rule = newRule();
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
for (int i = 0; i < 12; i++) {
IssueDto issue = IssueTesting.newDto(rule, file, project);
tester.get(IssueDao.class).insert(session, issue);
@@ -603,9 +603,9 @@ public class SearchActionMediumTest {
@Test
public void paging_with_page_size_to_minus_one() throws Exception {
RuleDto rule = newRule();
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
for (int i = 0; i < 12; i++) {
IssueDto issue = IssueTesting.newDto(rule, file, project);
tester.get(IssueDao.class).insert(session, issue);
@@ -624,9 +624,9 @@ public class SearchActionMediumTest {
@Test
public void deprecated_paging() throws Exception {
RuleDto rule = newRule();
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("MyProject"));
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("MyComponent"));
ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
for (int i = 0; i < 12; i++) {
IssueDto issue = IssueTesting.newDto(rule, file, project);
tester.get(IssueDao.class).insert(session, issue);

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/display_file_facet.json View File

@@ -4,8 +4,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1"
}
],

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/display_module_facet.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1"
}
],

+ 4
- 4
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/display_non_sticky_project_facet.json View File

@@ -4,14 +4,14 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "MyComponent1",
"project": "MyProject1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1"
}
],
"components": [
{ "key": "MyProject1" },
{ "key": "MyComponent1" }
{ "key": "PK1" },
{ "key": "FK1" }
],
"facets": [
{

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/display_sticky_project_facet.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1"
}
],

+ 8
- 8
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/issues_on_different_projects.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1",
"status": "OPEN",
"resolution": "OPEN",
@@ -12,8 +12,8 @@
},
{
"key": "92fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F2",
"project": "P2",
"component": "FK2",
"project": "PK2",
"rule": "xoo:x1",
"status": "OPEN",
"resolution": "OPEN",
@@ -24,22 +24,22 @@
"components": [
{
"id": "F1",
"key": "MyComponent",
"key": "FK1",
"enabled" : true
},
{
"id": "P1",
"key": "MyProject",
"key": "PK1",
"enabled" : true
},
{
"id": "F2",
"key": "MyComponent2",
"key": "FK2",
"enabled" : true
},
{
"id": "P2",
"key": "MyProject2",
"key": "PK2",
"enabled" : true
}
]

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_authors.json View File

@@ -4,8 +4,8 @@
"issues": [
{
"key": "2bd4eac2-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1",
"author": "leia"
}

+ 4
- 4
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_developer.json View File

@@ -2,15 +2,15 @@
"issues": [
{
"key": "2bd4eac2-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1",
"author": "vader"
},
{
"key": "82fd47d4-b650-4037-80bc-7b1182fd47d4",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1",
"author": "anakin@skywalker.name"
}

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_directory_uuid.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1"
}
]

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_file_key.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1"
}
]

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_file_uuid.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1"
}
]

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_project_uuid.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1"
}
]

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_test_key.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "2bd4eac2-b650-4037-80bc-7b1182fd47d4",
"component": "F2",
"project": "P1",
"component": "FK2",
"project": "PK1",
"rule": "xoo:x1"
}
]

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionComponentsMediumTest/search_by_view_uuid.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "F1",
"project": "P1",
"component": "FK1",
"project": "PK1",
"rule": "xoo:x1"
}
]

+ 1
- 1
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/assigned_to_me_facet_sticky.json View File

@@ -2,7 +2,7 @@
"issues": [
{
"key": "7b112bd4-b650-4037-80bc-82fd47d4eac2",
"component": "FILE_ID",
"component": "FILE_KEY",
"rule": "xoo:x1",
"status": "OPEN",
"severity": "MAJOR",

+ 1
- 1
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json View File

@@ -2,7 +2,7 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "FILE_ID",
"component": "FILE_KEY",
"rule": "xoo:x1",
"status": "OPEN",
"severity": "MAJOR",

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets_debt.json View File

@@ -3,8 +3,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "FILE_ID",
"project": "PROJECT_ID",
"component": "FILE_KEY",
"project": "PROJECT_KEY",
"rule": "xoo:x1",
"status": "OPEN",
"severity": "MAJOR",

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_zero_facets.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "FILE_ID",
"project": "PROJECT_ID",
"component": "FILE_KEY",
"project": "PROJECT_KEY",
"rule": "xoo:x1",
"status": "OPEN",
"severity": "MAJOR",

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/filter_by_assigned_to_me.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "FILE_ID",
"project": "PROJECT_ID",
"component": "FILE_KEY",
"project": "PROJECT_KEY",
"rule": "xoo:x1",
"status": "OPEN",
"severity": "MAJOR",

+ 2
- 2
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/hide_rules.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "FILE_ID",
"project": "PROJECT_ID",
"component": "FILE_KEY",
"project": "PROJECT_KEY",
"rule": "xoo:x1",
"status": "OPEN",
"severity": "MAJOR",

+ 4
- 4
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/issue_on_removed_file.json View File

@@ -2,8 +2,8 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "REMOVED_FILE_ID",
"project": "PROJECT_ID",
"component": "REMOVED_FILE_KEY",
"project": "PROJECT_KEY",
"rule": "xoo:x1",
"status": "OPEN",
"resolution": "OPEN",
@@ -14,12 +14,12 @@
"components": [
{
"id": "REMOVED_FILE_ID",
"key": "RemovedComponent",
"key": "REMOVED_FILE_KEY",
"enabled" : false
},
{
"id": "PROJECT_ID",
"key": "MyProject",
"key": "PROJECT_KEY",
"enabled" : true
}
]

+ 1
- 1
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/issue_with_action_plan.json View File

@@ -11,7 +11,7 @@
"name": "1.0",
"status": "OPEN",
"deadLine": "2014-01-24T19:10:03+0000",
"project": "PROJECT_ID"
"project": "PROJECT_KEY"
}
]
}

+ 1
- 1
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/response_contains_all_fields_except_additional_fields.json View File

@@ -4,7 +4,7 @@
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"rule": "xoo:x1",
"severity": "MAJOR",
"component": "FILE_ID",
"component": "FILE_KEY",
"resolution": "FIXED",
"status": "RESOLVED",
"message": "the message",

+ 6
- 6
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/sort_by_updated_at.json View File

@@ -2,22 +2,22 @@
"issues": [
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"component": "FILE_ID",
"project": "PROJECT_ID",
"component": "FILE_KEY",
"project": "PROJECT_KEY",
"rule": "xoo:x1",
"updateDate": "2014-11-01T00:00:00+0100"
},
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac1",
"component": "FILE_ID",
"project": "PROJECT_ID",
"component": "FILE_KEY",
"project": "PROJECT_KEY",
"rule": "xoo:x1",
"updateDate": "2014-11-02T00:00:00+0100"
},
{
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac3",
"component": "FILE_ID",
"project": "PROJECT_ID",
"component": "FILE_KEY",
"project": "PROJECT_KEY",
"rule": "xoo:x1",
"updateDate": "2014-11-03T00:00:00+0100"
}

+ 54
- 308
sonar-ws/src/main/gen-java/org/sonarqube/ws/Common.java View File

@@ -3986,62 +3986,24 @@ public final class Common {
getLangBytes();

/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
boolean hasDesc();
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
java.lang.String getDesc();
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
com.google.protobuf.ByteString
getDescBytes();

/**
* <code>optional .sonarqube.ws.RuleStatus status = 5;</code>
* <code>optional .sonarqube.ws.RuleStatus status = 4;</code>
*/
boolean hasStatus();
/**
* <code>optional .sonarqube.ws.RuleStatus status = 5;</code>
* <code>optional .sonarqube.ws.RuleStatus status = 4;</code>
*/
org.sonarqube.ws.Common.RuleStatus getStatus();

/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
boolean hasLangName();
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
java.lang.String getLangName();
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
com.google.protobuf.ByteString
getLangNameBytes();
@@ -4116,26 +4078,20 @@ public final class Common {
lang_ = bs;
break;
}
case 34: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000008;
desc_ = bs;
break;
}
case 40: {
case 32: {
int rawValue = input.readEnum();
org.sonarqube.ws.Common.RuleStatus value = org.sonarqube.ws.Common.RuleStatus.valueOf(rawValue);
if (value == null) {
unknownFields.mergeVarintField(5, rawValue);
unknownFields.mergeVarintField(4, rawValue);
} else {
bitField0_ |= 0x00000010;
bitField0_ |= 0x00000008;
status_ = value;
}
break;
}
case 50: {
case 42: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000020;
bitField0_ |= 0x00000010;
langName_ = bs;
break;
}
@@ -4305,93 +4261,31 @@ public final class Common {
}
}

public static final int DESC_FIELD_NUMBER = 4;
private java.lang.Object desc_;
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
public boolean hasDesc() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
public java.lang.String getDesc() {
java.lang.Object ref = desc_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
desc_ = s;
}
return s;
}
}
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
public com.google.protobuf.ByteString
getDescBytes() {
java.lang.Object ref = desc_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
desc_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}

public static final int STATUS_FIELD_NUMBER = 5;
public static final int STATUS_FIELD_NUMBER = 4;
private org.sonarqube.ws.Common.RuleStatus status_;
/**
* <code>optional .sonarqube.ws.RuleStatus status = 5;</code>
* <code>optional .sonarqube.ws.RuleStatus status = 4;</code>
*/
public boolean hasStatus() {
return ((bitField0_ & 0x00000010) == 0x00000010);
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .sonarqube.ws.RuleStatus status = 5;</code>
* <code>optional .sonarqube.ws.RuleStatus status = 4;</code>
*/
public org.sonarqube.ws.Common.RuleStatus getStatus() {
return status_;
}

public static final int LANGNAME_FIELD_NUMBER = 6;
public static final int LANGNAME_FIELD_NUMBER = 5;
private java.lang.Object langName_;
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
public boolean hasLangName() {
return ((bitField0_ & 0x00000020) == 0x00000020);
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
public java.lang.String getLangName() {
java.lang.Object ref = langName_;
@@ -4408,11 +4302,7 @@ public final class Common {
}
}
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
public com.google.protobuf.ByteString
getLangNameBytes() {
@@ -4432,7 +4322,6 @@ public final class Common {
key_ = "";
name_ = "";
lang_ = "";
desc_ = "";
status_ = org.sonarqube.ws.Common.RuleStatus.BETA;
langName_ = "";
}
@@ -4459,13 +4348,10 @@ public final class Common {
output.writeBytes(3, getLangBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeBytes(4, getDescBytes());
output.writeEnum(4, status_.getNumber());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeEnum(5, status_.getNumber());
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeBytes(6, getLangNameBytes());
output.writeBytes(5, getLangNameBytes());
}
getUnknownFields().writeTo(output);
}
@@ -4490,15 +4376,11 @@ public final class Common {
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(4, getDescBytes());
.computeEnumSize(4, status_.getNumber());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(5, status_.getNumber());
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(6, getLangNameBytes());
.computeBytesSize(5, getLangNameBytes());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
@@ -4623,12 +4505,10 @@ public final class Common {
bitField0_ = (bitField0_ & ~0x00000002);
lang_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
desc_ = "";
bitField0_ = (bitField0_ & ~0x00000008);
status_ = org.sonarqube.ws.Common.RuleStatus.BETA;
bitField0_ = (bitField0_ & ~0x00000010);
bitField0_ = (bitField0_ & ~0x00000008);
langName_ = "";
bitField0_ = (bitField0_ & ~0x00000020);
bitField0_ = (bitField0_ & ~0x00000010);
return this;
}

@@ -4672,14 +4552,10 @@ public final class Common {
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.desc_ = desc_;
result.status_ = status_;
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
to_bitField0_ |= 0x00000010;
}
result.status_ = status_;
if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
to_bitField0_ |= 0x00000020;
}
result.langName_ = langName_;
result.bitField0_ = to_bitField0_;
onBuilt();
@@ -4712,16 +4588,11 @@ public final class Common {
lang_ = other.lang_;
onChanged();
}
if (other.hasDesc()) {
bitField0_ |= 0x00000008;
desc_ = other.desc_;
onChanged();
}
if (other.hasStatus()) {
setStatus(other.getStatus());
}
if (other.hasLangName()) {
bitField0_ |= 0x00000020;
bitField0_ |= 0x00000010;
langName_ = other.langName_;
onChanged();
}
@@ -4980,136 +4851,36 @@ public final class Common {
return this;
}

private java.lang.Object desc_ = "";
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
public boolean hasDesc() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
public java.lang.String getDesc() {
java.lang.Object ref = desc_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
desc_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
public com.google.protobuf.ByteString
getDescBytes() {
java.lang.Object ref = desc_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
desc_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
public Builder setDesc(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
desc_ = value;
onChanged();
return this;
}
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
public Builder clearDesc() {
bitField0_ = (bitField0_ & ~0x00000008);
desc_ = getDefaultInstance().getDesc();
onChanged();
return this;
}
/**
* <code>optional string desc = 4;</code>
*
* <pre>
* TODO what's the format ?
* </pre>
*/
public Builder setDescBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
desc_ = value;
onChanged();
return this;
}

private org.sonarqube.ws.Common.RuleStatus status_ = org.sonarqube.ws.Common.RuleStatus.BETA;
/**
* <code>optional .sonarqube.ws.RuleStatus status = 5;</code>
* <code>optional .sonarqube.ws.RuleStatus status = 4;</code>
*/
public boolean hasStatus() {
return ((bitField0_ & 0x00000010) == 0x00000010);
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .sonarqube.ws.RuleStatus status = 5;</code>
* <code>optional .sonarqube.ws.RuleStatus status = 4;</code>
*/
public org.sonarqube.ws.Common.RuleStatus getStatus() {
return status_;
}
/**
* <code>optional .sonarqube.ws.RuleStatus status = 5;</code>
* <code>optional .sonarqube.ws.RuleStatus status = 4;</code>
*/
public Builder setStatus(org.sonarqube.ws.Common.RuleStatus value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000010;
bitField0_ |= 0x00000008;
status_ = value;
onChanged();
return this;
}
/**
* <code>optional .sonarqube.ws.RuleStatus status = 5;</code>
* <code>optional .sonarqube.ws.RuleStatus status = 4;</code>
*/
public Builder clearStatus() {
bitField0_ = (bitField0_ & ~0x00000010);
bitField0_ = (bitField0_ & ~0x00000008);
status_ = org.sonarqube.ws.Common.RuleStatus.BETA;
onChanged();
return this;
@@ -5117,21 +4888,13 @@ public final class Common {

private java.lang.Object langName_ = "";
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
public boolean hasLangName() {
return ((bitField0_ & 0x00000020) == 0x00000020);
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
public java.lang.String getLangName() {
java.lang.Object ref = langName_;
@@ -5148,11 +4911,7 @@ public final class Common {
}
}
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
public com.google.protobuf.ByteString
getLangNameBytes() {
@@ -5168,48 +4927,36 @@ public final class Common {
}
}
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
public Builder setLangName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000020;
bitField0_ |= 0x00000010;
langName_ = value;
onChanged();
return this;
}
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
public Builder clearLangName() {
bitField0_ = (bitField0_ & ~0x00000020);
bitField0_ = (bitField0_ & ~0x00000010);
langName_ = getDefaultInstance().getLangName();
onChanged();
return this;
}
/**
* <code>optional string langName = 6;</code>
*
* <pre>
* TODO missing 'lang'
* </pre>
* <code>optional string langName = 5;</code>
*/
public Builder setLangNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000020;
bitField0_ |= 0x00000010;
langName_ = value;
onChanged();
return this;
@@ -6142,16 +5889,15 @@ public final class Common {
"\001 \001(\t\022\013\n\003key\030\002 \001(\t\022\017\n\007enabled\030\003 \001(\010\022\021\n\tq" +
"ualifier\030\004 \001(\t\022\014\n\004name\030\005 \001(\t\022\020\n\010longName" +
"\030\006 \001(\t\022\014\n\004path\030\007 \001(\t\022\017\n\007project\030\010 \001(\t\022\022\n" +
"\nsubProject\030\t \001(\t\"y\n\004Rule\022\013\n\003key\030\001 \001(\t\022\014",
"\n\004name\030\002 \001(\t\022\014\n\004lang\030\003 \001(\t\022\014\n\004desc\030\004 \001(\t" +
"\022(\n\006status\030\005 \001(\0162\030.sonarqube.ws.RuleStat" +
"us\022\020\n\010langName\030\006 \001(\t\"B\n\004User\022\r\n\005login\030\001 " +
"\001(\t\022\014\n\004name\030\002 \001(\t\022\r\n\005email\030\003 \001(\t\022\016\n\006acti" +
"ve\030\004 \001(\010*E\n\010Severity\022\010\n\004INFO\020\000\022\t\n\005MINOR\020" +
"\001\022\t\n\005MAJOR\020\002\022\014\n\010CRITICAL\020\003\022\013\n\007BLOCKER\020\004*" +
">\n\nRuleStatus\022\010\n\004BETA\020\000\022\016\n\nDEPRECATED\020\001\022" +
"\t\n\005READY\020\002\022\013\n\007REMOVED\020\003B\034\n\020org.sonarqube" +
".wsB\006CommonH\001"
"\nsubProject\030\t \001(\t\"k\n\004Rule\022\013\n\003key\030\001 \001(\t\022\014",
"\n\004name\030\002 \001(\t\022\014\n\004lang\030\003 \001(\t\022(\n\006status\030\004 \001" +
"(\0162\030.sonarqube.ws.RuleStatus\022\020\n\010langName" +
"\030\005 \001(\t\"B\n\004User\022\r\n\005login\030\001 \001(\t\022\014\n\004name\030\002 " +
"\001(\t\022\r\n\005email\030\003 \001(\t\022\016\n\006active\030\004 \001(\010*E\n\010Se" +
"verity\022\010\n\004INFO\020\000\022\t\n\005MINOR\020\001\022\t\n\005MAJOR\020\002\022\014" +
"\n\010CRITICAL\020\003\022\013\n\007BLOCKER\020\004*>\n\nRuleStatus\022" +
"\010\n\004BETA\020\000\022\016\n\nDEPRECATED\020\001\022\t\n\005READY\020\002\022\013\n\007" +
"REMOVED\020\003B\034\n\020org.sonarqube.wsB\006CommonH\001"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -6194,7 +5940,7 @@ public final class Common {
internal_static_sonarqube_ws_Rule_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_sonarqube_ws_Rule_descriptor,
new java.lang.String[] { "Key", "Name", "Lang", "Desc", "Status", "LangName", });
new java.lang.String[] { "Key", "Name", "Lang", "Status", "LangName", });
internal_static_sonarqube_ws_User_descriptor =
getDescriptor().getMessageTypes().get(5);
internal_static_sonarqube_ws_User_fieldAccessorTable = new

+ 3160
- 1548
sonar-ws/src/main/gen-java/org/sonarqube/ws/Issues.java
File diff suppressed because it is too large
View File


+ 2
- 5
sonar-ws/src/main/protobuf/ws-common.proto View File

@@ -66,11 +66,8 @@ message Rule {
optional string key = 1;
optional string name = 2;
optional string lang = 3;
// TODO what's the format ?
optional string desc = 4;
optional RuleStatus status = 5;
// TODO missing 'lang'
optional string langName = 6;
optional RuleStatus status = 4;
optional string langName = 5;
}

enum RuleStatus {

+ 46
- 40
sonar-ws/src/main/protobuf/ws-issues.proto View File

@@ -26,10 +26,8 @@ option java_package = "org.sonarqube.ws";
option java_outer_classname = "Issues";
option optimize_for = SPEED;

// Response of URL api/issues/search
// Response of GET api/issues/search
message Search {
// TODO errors

optional int64 total = 1;
optional int64 p = 2;
optional int32 ps = 3;
@@ -39,22 +37,29 @@ message Search {
optional int64 debtTotal = 5;

repeated Issue issues = 6;
optional bool projectsPresentIfEmpty = 8;
repeated Component projects = 9;
optional bool componentsPresentIfEmpty = 10;
repeated Component components = 11;
optional bool rulesPresentIfEmpty = 12;
repeated Rule rules = 13;
optional bool usersPresentIfEmpty = 14;
repeated User users = 15;
optional bool actionPlansPresentIfEmpty = 16;
repeated ActionPlan actionPlans = 17;
optional bool languagesPresentIfEmpty = 18;
repeated Language languages = 19;
repeated Facet facets = 20;
optional bool facetsPresentIfEmpty = 21;
repeated Component components = 7;
optional bool rulesPresentIfEmpty = 8;
repeated Rule rules = 9;
optional bool usersPresentIfEmpty = 10;
repeated User users = 11;
optional bool actionPlansPresentIfEmpty = 12;
repeated ActionPlan actionPlans = 13;
optional bool languagesPresentIfEmpty = 14;
repeated Language languages = 15;
optional bool facetsPresentIfEmpty = 16;
repeated Facet facets = 17;
}

// Response of most of POST/issues/{operation}, for instance assign, add_comment and set_severity
message Operation {
optional Issue issue = 1;
repeated Component components = 2;
repeated Rule rules = 3;
repeated User users = 4;
repeated ActionPlan actionPlans = 5;
}


message Issue {
optional string key = 1;
optional string rule = 2;
@@ -62,36 +67,37 @@ message Issue {
optional string component = 4;
optional int64 componentId = 5;
optional string project = 6;
optional int32 line = 7;
optional string resolution = 8;
optional string status = 9;
optional string message = 10;
optional string debt = 11;
optional string assignee = 12;
optional string reporter = 13;
optional string subProject = 7;
optional int32 line = 8;
optional string resolution = 9;
optional string status = 10;
optional string message = 11;
optional string debt = 12;
optional string assignee = 13;
optional string reporter = 14;

// SCM login of the committer who introduced the issue
optional string author = 14;
optional string author = 15;

optional string actionPlan = 15;
optional string actionPlanName = 16;
optional string attr = 17;
repeated string tags = 18;
optional string actionPlan = 16;
optional string actionPlanName = 17;
optional string attr = 18;
repeated string tags = 19;

// the transitions allowed for the requesting user.
optional bool transitionsPresentIfEmpty=19;
repeated string transitions = 20;
optional bool transitionsPresentIfEmpty = 20;
repeated string transitions = 21;

// the actions allowed for the requesting user.
optional bool actionsPresentIfEmpty=21;
repeated string actions = 22;
optional bool commentsPresentIfEmpty = 23;
repeated Comment comments = 24;
optional string creationDate= 25;
optional string updateDate= 26;
optional string fUpdateAge= 27;
optional string closeDate= 28;
optional bool actionsPresentIfEmpty = 22;
repeated string actions = 23;
optional bool commentsPresentIfEmpty = 24;
repeated Comment comments = 25;
optional string creationDate = 26;
optional string updateDate = 27;
optional string fUpdateAge = 28;
optional string closeDate = 29;
}

message Comment {

Loading…
Cancel
Save