use of org.sonar.db.rule.RuleDto in project sonarqube by SonarSource.
the class IssueServiceMediumTest method list_tags.
@Test
public void list_tags() {
RuleDto rule = newRule();
ComponentDto project = newProject();
ComponentDto file = newFile(project);
saveIssue(IssueTesting.newDto(rule, file, project).setTags(ImmutableSet.of("convention", "java8", "bug")));
saveIssue(IssueTesting.newDto(rule, file, project).setTags(ImmutableSet.of("convention", "bug")));
saveIssue(IssueTesting.newDto(rule, file, project));
saveIssue(IssueTesting.newDto(rule, file, project).setTags(ImmutableSet.of("convention")));
assertThat(service.listTags(null, 5)).containsOnly("convention", "java8", "bug", /* from issues */
"systag1", "systag2");
assertThat(service.listTags(null, 2)).containsOnly("bug", "convention");
assertThat(service.listTags("vent", 5)).containsOnly("convention");
assertThat(service.listTags("sys", 5)).containsOnly("systag1", "systag2");
assertThat(service.listTags(null, 1)).containsOnly("bug");
assertThat(service.listTags(null, Integer.MAX_VALUE)).containsOnly("convention", "java8", "bug", "systag1", "systag2", "tag1", "tag2");
assertThat(service.listTags("invalidRegexp[", 5)).isEmpty();
}
use of org.sonar.db.rule.RuleDto in project sonarqube by SonarSource.
the class TransitionServiceTest method newIssue.
private IssueDto newIssue() {
RuleDto rule = newRuleDto().setId(10);
ComponentDto project = ComponentTesting.newProjectDto(OrganizationTesting.newOrganizationDto());
ComponentDto file = (newFileDto(project));
return newDto(rule, file, project);
}
use of org.sonar.db.rule.RuleDto in project sonarqube by SonarSource.
the class SearchActionComponentsMediumTest method search_by_developer.
@Test
public void search_by_developer() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto(defaultOrganization, "P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
ComponentDto developer = insertComponent(ComponentTesting.newDeveloper(otherOrganization1, "Anakin Skywalker"));
db.authorDao().insertAuthor(session, "vader", developer.getId());
db.authorDao().insertAuthor(session, "anakin@skywalker.name", developer.getId());
RuleDto newRule = newRule();
IssueDto issue1 = IssueTesting.newDto(newRule, file, project).setAuthorLogin("vader").setKee("2bd4eac2-b650-4037-80bc-7b112bd4eac2");
IssueDto issue2 = IssueTesting.newDto(newRule, file, project).setAuthorLogin("anakin@skywalker.name").setKee("82fd47d4-b650-4037-80bc-7b1182fd47d4");
db.issueDao().insert(session, issue1, issue2);
session.commit();
indexIssues();
wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH).setParam(IssuesWsParameters.PARAM_COMPONENT_UUIDS, developer.uuid()).execute().assertJson(this.getClass(), "search_by_developer.json");
}
use of org.sonar.db.rule.RuleDto in project sonarqube by SonarSource.
the class SearchActionComponentsMediumTest method display_file_facet.
@Test
public void display_file_facet() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto(otherOrganization2, "P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file1 = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
ComponentDto file2 = insertComponent(newFileDto(project, null, "F2").setKey("FK2"));
ComponentDto file3 = insertComponent(newFileDto(project, null, "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");
db.issueDao().insert(session, issue1, issue2);
session.commit();
indexIssues();
wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH).setParam(IssuesWsParameters.PARAM_COMPONENT_UUIDS, project.uuid()).setParam(IssuesWsParameters.PARAM_FILE_UUIDS, file1.uuid() + "," + file3.uuid()).setParam(WebService.Param.FACETS, "fileUuids").execute().assertJson(this.getClass(), "display_file_facet.json");
}
use of org.sonar.db.rule.RuleDto in project sonarqube by SonarSource.
the class SearchActionComponentsMediumTest method search_since_leak_period_on_project.
@Test
public void search_since_leak_period_on_project() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto(otherOrganization2, "P1").setKey("PK1"));
setDefaultProjectPermission(project);
ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
db.snapshotDao().insert(session, newAnalysis(project).setPeriodDate(parseDateTime("2015-09-03T00:00:00+0100").getTime()));
RuleDto rule = newRule();
IssueDto issueAfterLeak = IssueTesting.newDto(rule, file, project).setKee(UUID_EXAMPLE_01).setIssueCreationDate(parseDateTime("2015-09-04T00:00:00+0100")).setIssueUpdateDate(parseDateTime("2015-10-04T00:00:00+0100"));
IssueDto issueBeforeLeak = IssueTesting.newDto(rule, file, project).setKee(UUID_EXAMPLE_02).setIssueCreationDate(parseDateTime("2014-09-04T00:00:00+0100")).setIssueUpdateDate(parseDateTime("2015-10-04T00:00:00+0100"));
db.issueDao().insert(session, issueAfterLeak, issueBeforeLeak);
session.commit();
indexIssues();
wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH).setParam(IssuesWsParameters.PARAM_COMPONENT_UUIDS, project.uuid()).setParam(IssuesWsParameters.PARAM_SINCE_LEAK_PERIOD, "true").execute().assertJson(this.getClass(), "search_since_leak_period.json");
}
Aggregations