import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.Collections2;
import com.google.common.collect.Sets;
import java.util.Collection;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.sonar.api.utils.SonarException;
import org.sonar.api.utils.System2;
import org.sonar.api.web.UserRole;
-import org.sonar.server.rule.RuleKeyFunctions;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDto;
+import org.sonar.db.component.SnapshotDto;
import org.sonar.server.component.ComponentService;
+import org.sonar.server.rule.RuleKeyFunctions;
import org.sonar.server.user.UserSession;
import org.sonar.server.util.RubyUtils;
import org.sonarqube.ws.client.issue.IssueFilterParameters;
import org.sonarqube.ws.client.issue.SearchWsRequest;
+import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.Lists.newArrayList;
+import static java.lang.String.format;
+import static org.sonar.api.utils.DateUtils.longToDate;
import static org.sonar.db.component.ComponentDtoFunctions.toCopyResourceId;
import static org.sonar.db.component.ComponentDtoFunctions.toProjectUuid;
import static org.sonar.db.component.ComponentDtoFunctions.toUuid;
+import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
+import static org.sonar.server.ws.WsUtils.checkRequest;
+import static org.sonarqube.ws.client.issue.IssueFilterParameters.CREATED_AFTER;
+import static org.sonarqube.ws.client.issue.IssueFilterParameters.CREATED_IN_LAST;
+import static org.sonarqube.ws.client.issue.IssueFilterParameters.SINCE_LEAK_PERIOD;
/**
* This component is used to create an IssueQuery, in order to transform the component and component roots keys into uuid.
.planned(RubyUtils.toBoolean(params.get(IssueFilterParameters.PLANNED)))
.hideRules(RubyUtils.toBoolean(params.get(IssueFilterParameters.HIDE_RULES)))
.createdAt(RubyUtils.toDate(params.get(IssueFilterParameters.CREATED_AT)))
- .createdAfter(buildCreatedAfter(RubyUtils.toDate(params.get(IssueFilterParameters.CREATED_AFTER)), (String) params.get(IssueFilterParameters.CREATED_IN_LAST)))
+ .createdAfter(buildCreatedAfterFromDates(RubyUtils.toDate(params.get(CREATED_AFTER)), (String) params.get(CREATED_IN_LAST)))
.createdBefore(RubyUtils.toDate(params.get(IssueFilterParameters.CREATED_BEFORE)));
Set<String> allComponentUuids = Sets.newHashSet();
}
}
- private Date buildCreatedAfter(@Nullable Date createdAfter, @Nullable String createdSince) {
- Preconditions.checkArgument(createdAfter == null || createdSince == null, "createdAfter and createdSince cannot be set simultaneously");
+ private Date buildCreatedAfterFromDates(@Nullable Date createdAfter, @Nullable String createdInLast) {
+ checkArgument(createdAfter == null || createdInLast == null, format("%s and %s cannot be set simultaneously", CREATED_AFTER, CREATED_IN_LAST));
Date actualCreatedAfter = createdAfter;
- if (createdSince != null) {
- actualCreatedAfter = new DateTime(system.now()).minus(ISOPeriodFormat.standard().parsePeriod("P" + createdSince.toUpperCase())).toDate();
+ if (createdInLast != null) {
+ actualCreatedAfter = new DateTime(system.now()).minus(ISOPeriodFormat.standard().parsePeriod("P" + createdInLast.toUpperCase())).toDate();
}
return actualCreatedAfter;
}
.assigned(request.getAssigned())
.planned(request.getPlanned())
.createdAt(parseAsDateTime(request.getCreatedAt()))
- .createdAfter(buildCreatedAfter(parseAsDateTime(request.getCreatedAfter()), request.getCreatedInLast()))
.createdBefore(parseAsDateTime(request.getCreatedBefore()))
.facetMode(request.getFacetMode());
request.getFileUuids(),
request.getAuthors());
+ builder.createdAfter(buildCreatedAfterFromRequest(session, request, allComponentUuids, effectiveOnComponentOnly));
+
String sort = request.getSort();
if (!Strings.isNullOrEmpty(sort)) {
builder.sort(sort);
}
}
+ private Date buildCreatedAfterFromRequest(DbSession dbSession, SearchWsRequest request, Set<String> componentUuids, boolean effectiveOnComponentOnly) {
+ Date createdAfter = parseAsDateTime(request.getCreatedAfter());
+ String createdInLast = request.getCreatedInLast();
+
+ if (request.getSinceLeakPeriod() == null || !request.getSinceLeakPeriod()) {
+ return buildCreatedAfterFromDates(createdAfter, createdInLast);
+ }
+
+ checkRequest(createdAfter == null, "'%s' and '%s' cannot be set simultaneously", CREATED_AFTER, SINCE_LEAK_PERIOD);
+ Set<String> allComponentUuids = new HashSet<>(componentUuids);
+ if (!effectiveOnComponentOnly) {
+ if (request.getProjectKeys() != null) {
+ allComponentUuids.addAll(componentUuids(dbSession, request.getProjectKeys()));
+ }
+ if (request.getProjectUuids() != null) {
+ allComponentUuids.addAll(request.getProjectUuids());
+ }
+ if (request.getModuleUuids() != null) {
+ allComponentUuids.addAll(request.getModuleUuids());
+ }
+ if (request.getFileUuids() != null) {
+ allComponentUuids.addAll(request.getFileUuids());
+ }
+ }
+
+ checkArgument(allComponentUuids.size() == 1, "One and only one component must be provided when searching since leak period");
+ String uuid = allComponentUuids.iterator().next();
+ // TODO use ComponentFinder instead
+ ComponentDto component = checkFoundWithOptional(componentService.getByUuid(uuid), "Component with id '%s' not found", uuid);
+ SnapshotDto snapshot = dbClient.snapshotDao().selectLastSnapshotByComponentId(dbSession, component.getId());
+ Long projectSnapshotId = snapshot == null ? null : snapshot.getRootId();
+ SnapshotDto projectSnapshot = projectSnapshotId == null ? snapshot : dbClient.snapshotDao().selectById(dbSession, projectSnapshotId);
+ Date createdAfterFromSnapshot = projectSnapshot == null ? null : longToDate(projectSnapshot.getPeriodDate(1));
+ return buildCreatedAfterFromDates(createdAfterFromSnapshot, createdInLast);
+ }
+
private List<String> buildAssignees(@Nullable List<String> assigneesFromParams) {
List<String> assignees = Lists.newArrayList();
if (assigneesFromParams != null) {
import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentTesting;
+import org.sonar.db.component.SnapshotDto;
+import org.sonar.db.component.SnapshotTesting;
import org.sonar.db.issue.IssueDto;
import org.sonar.db.rule.RuleDao;
import org.sonar.db.rule.RuleDto;
import org.sonar.server.ws.WsTester;
import org.sonar.server.ws.WsTester.Result;
import org.sonarqube.ws.Issues;
+import org.sonarqube.ws.Issues.SearchWsResponse;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.issue.IssueFilterParameters;
import static com.google.common.collect.Lists.newArrayList;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.sonar.api.utils.DateUtils.parseDateTime;
+import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
+import static org.sonar.core.util.Uuids.UUID_EXAMPLE_02;
+import static org.sonar.db.component.ComponentTesting.newFileDto;
+import static org.sonar.db.component.ComponentTesting.newModuleDto;
+import static org.sonar.db.component.SnapshotTesting.newSnapshotForProject;
public class SearchActionComponentsMediumTest {
RuleDto rule = newRule();
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(newFileDto(project, "F1").setKey("FK1"));
IssueDto issue = IssueTesting.newDto(rule, file, project)
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
.setStatus("OPEN").setResolution("OPEN")
ComponentDto project2 = insertComponent(ComponentTesting.newProjectDto("P2").setKey("PK2"));
setDefaultProjectPermission(project2);
- ComponentDto file2 = insertComponent(ComponentTesting.newFileDto(project2, "F2").setKey("FK2"));
+ ComponentDto file2 = insertComponent(newFileDto(project2, "F2").setKey("FK2"));
IssueDto issue2 = IssueTesting.newDto(rule, file2, project2)
.setKee("92fd47d4-b650-4037-80bc-7b112bd4eac2")
.setStatus("OPEN").setResolution("OPEN")
public void do_not_return_module_key_on_single_module_projects() throws IOException {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto module = insertComponent(ComponentTesting.newModuleDto("M1", project).setKey("MK1"));
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(module, "F1").setKey("FK1"));
+ ComponentDto module = insertComponent(newModuleDto("M1", project).setKey("MK1"));
+ ComponentDto file = insertComponent(newFileDto(module, "F1").setKey("FK1"));
RuleDto newRule = newRule();
IssueDto issueInModule = IssueTesting.newDto(newRule, file, project).setKee("ISSUE_IN_MODULE");
IssueDto issueInRootModule = IssueTesting.newDto(newRule, project, project).setKee("ISSUE_IN_ROOT_MODULE");
TestResponse response = actionTester.newRequest()
.setMediaType(MediaTypes.PROTOBUF)
.execute();
- Issues.SearchWsResponse searchResponse = Issues.SearchWsResponse.parseFrom(response.getInputStream());
+ SearchWsResponse searchResponse = SearchWsResponse.parseFrom(response.getInputStream());
assertThat(searchResponse.getIssuesCount()).isEqualTo(2);
for (Issues.Issue issue : searchResponse.getIssuesList()) {
public void search_by_project_uuid() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(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();
.assertJson(this.getClass(), "no_issue.json");
}
+ @Test
+ public void search_since_leak_period_on_project() throws Exception {
+ ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
+ setDefaultProjectPermission(project);
+ ComponentDto file = insertComponent(newFileDto(project, "F1").setKey("FK1"));
+ SnapshotDto projectSnapshot = db.snapshotDao().insert(session,
+ newSnapshotForProject(project)
+ .setPeriodDate(1, parseDateTime("2015-09-03T00:00:00+0100").getTime()));
+ db.snapshotDao().insert(session, SnapshotTesting.createForComponent(file, projectSnapshot));
+ 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();
+ tester.get(IssueIndexer.class).indexAll();
+
+ wsTester.newGetRequest(IssuesWs.API_ENDPOINT, SearchAction.SEARCH_ACTION)
+ .setParam(IssueFilterParameters.COMPONENT_UUIDS, project.uuid())
+ .setParam(IssueFilterParameters.SINCE_LEAK_PERIOD, "true")
+ .execute()
+ .assertJson(this.getClass(), "search_since_leak_period.json");
+ }
+
+ @Test
+ public void search_since_leak_period_on_file_in_module_project() throws Exception {
+ ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
+ setDefaultProjectPermission(project);
+ ComponentDto module = insertComponent(newModuleDto(project));
+ ComponentDto file = insertComponent(newFileDto(module, "F1").setKey("FK1"));
+ SnapshotDto projectSnapshot = db.snapshotDao().insert(session,
+ newSnapshotForProject(project)
+ .setPeriodDate(1, parseDateTime("2015-09-03T00:00:00+0100").getTime()));
+ SnapshotDto moduleSnapshot = db.snapshotDao().insert(session, SnapshotTesting.createForComponent(module, projectSnapshot));
+ db.snapshotDao().insert(session, SnapshotTesting.createForComponent(file, moduleSnapshot));
+ 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();
+ tester.get(IssueIndexer.class).indexAll();
+
+ wsTester.newGetRequest(IssuesWs.API_ENDPOINT, SearchAction.SEARCH_ACTION)
+ .setParam(IssueFilterParameters.FILE_UUIDS, file.uuid())
+ .setParam(IssueFilterParameters.SINCE_LEAK_PERIOD, "true")
+ .execute()
+ .assertJson(this.getClass(), "search_since_leak_period.json");
+ }
+
@Test
public void project_facet_is_sticky() throws Exception {
ComponentDto project1 = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project1);
setDefaultProjectPermission(project2);
setDefaultProjectPermission(project3);
- 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"));
+ ComponentDto file1 = insertComponent(newFileDto(project1, "F1").setKey("FK1"));
+ ComponentDto file2 = insertComponent(newFileDto(project2, "F2").setKey("FK2"));
+ ComponentDto file3 = insertComponent(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");
public void search_by_file_uuid() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(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();
public void search_by_file_key() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
- ComponentDto unitTest = insertComponent(ComponentTesting.newFileDto(project, "F2").setQualifier(Qualifiers.UNIT_TEST_FILE).setKey("FK2"));
+ ComponentDto file = insertComponent(newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto unitTest = insertComponent(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");
.setParam(IssueFilterParameters.COMPONENTS, unitTest.key())
.execute()
.assertJson(this.getClass(), "search_by_test_key.json");
-
}
@Test
public void display_file_facet() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- 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"));
+ ComponentDto file1 = insertComponent(newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file2 = insertComponent(newFileDto(project, "F2").setKey("FK2"));
+ ComponentDto file3 = insertComponent(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");
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("FK1").setPath(directory.path() + "/MyComponent.java"));
+ ComponentDto file = insertComponent(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();
public void search_by_directory_path_in_different_modules() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto module1 = insertComponent(ComponentTesting.newModuleDto("M1", project).setKey("MK1"));
- ComponentDto module2 = insertComponent(ComponentTesting.newModuleDto("M2", project).setKey("MK2"));
+ ComponentDto module1 = insertComponent(newModuleDto("M1", project).setKey("MK1"));
+ ComponentDto module2 = insertComponent(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("FK1").setPath(directory1.path() + "/MyComponent.java"));
- insertComponent(ComponentTesting.newFileDto(module2, "F2").setKey("FK2").setPath(directory2.path() + "/MyComponent.java"));
+ ComponentDto file1 = insertComponent(newFileDto(module1, "F1").setKey("FK1").setPath(directory1.path() + "/MyComponent.java"));
+ insertComponent(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);
public void display_module_facet() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- 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"));
+ ComponentDto module = insertComponent(newModuleDto("M1", project).setKey("MK1"));
+ ComponentDto subModule1 = insertComponent(newModuleDto("SUBM1", module).setKey("SUBMK1"));
+ ComponentDto subModule2 = insertComponent(newModuleDto("SUBM2", module).setKey("SUBMK2"));
+ ComponentDto subModule3 = insertComponent(newModuleDto("SUBM3", module).setKey("SUBMK3"));
+ ComponentDto file1 = insertComponent(newFileDto(subModule1, "F1").setKey("FK1"));
+ ComponentDto file2 = insertComponent(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");
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("FK1").setPath(directory.path() + "/MyComponent.java"));
+ ComponentDto file = insertComponent(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();
public void search_by_view_uuid() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(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"));
public void search_by_view_uuid_return_only_authorized_view() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(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"));
public void search_by_sub_view_uuid() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(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"));
public void search_by_sub_view_uuid_return_only_authorized_view() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(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"));
public void search_by_author() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(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");
public void search_by_developer() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(newFileDto(project, "F1").setKey("FK1"));
ComponentDto developer = insertComponent(ComponentTesting.newDeveloper("Anakin Skywalker"));
db.authorDao().insertAuthor(session, "vader", developer.getId());
db.authorDao().insertAuthor(session, "anakin@skywalker.name", developer.getId());
public void search_by_developer_technical_project() throws Exception {
ComponentDto project = insertComponent(ComponentTesting.newProjectDto("P1").setKey("PK1"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "F1").setKey("FK1"));
+ ComponentDto file = insertComponent(newFileDto(project, "F1").setKey("FK1"));
ComponentDto otherProject = insertComponent(ComponentTesting.newProjectDto("P2").setKey("PK2"));
setDefaultProjectPermission(otherProject);
- ComponentDto otherFile = insertComponent(ComponentTesting.newFileDto(otherProject, "F2").setKey("FK2"));
+ ComponentDto otherFile = insertComponent(newFileDto(otherProject, "F2").setKey("FK2"));
ComponentDto developer = insertComponent(ComponentTesting.newDeveloper("Anakin Skywalker"));
ComponentDto technicalProject = insertComponent(ComponentTesting.newDevProjectCopy("COPY_P1", project, developer));