Browse Source

SONAR-10587 Don't return external issues in batch/issues

tags/7.5
Duarte Meneses 6 years ago
parent
commit
bc5f256338

+ 2
- 2
server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml View File

@@ -206,7 +206,7 @@
inner join projects p on p.uuid=i.component_uuid
inner join projects root on root.uuid=i.project_uuid
where
r.is_external = ${_false} and
(r.is_external is NULL or r.is_external = ${_false}) and
i.component_uuid = #{componentUuid,jdbcType=VARCHAR} and
i.status <> 'CLOSED'
</select>
@@ -259,7 +259,7 @@
inner join projects p on p.uuid = i.component_uuid
inner join projects root on root.uuid = i.project_uuid
where
r.is_external = ${_false} and
(r.is_external is NULL or r.is_external = ${_false}) and
i.project_uuid = #{projectUuid, jdbcType=VARCHAR} and
p.module_uuid_path like #{likeModuleUuidPath, jdbcType=VARCHAR} escape '/' and
i.status &lt;&gt; 'CLOSED'

+ 6
- 1
server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java View File

@@ -173,6 +173,10 @@ public class IssuesActionTest {

RuleDefinitionDto external = db.rules().insert(ruleDefinitionDto -> ruleDefinitionDto.setIsExternal(true));
IssueDto issueFromExteralruleOnFile = db.issues().insert(external, project, file, i -> i.setKee("ON_FILE_FROM_EXTERNAL"));
RuleDefinitionDto migrated = db.rules().insert();
db.executeUpdateSql("update rules set is_external = NULL where rules.id = ?", migrated.getId());
IssueDto issueFromMigratedRule = db.issues().insert(migrated, project, file, i -> i.setKee("MIGRATED"));

addPermissionTo(project);
try (CloseableIterator<ServerIssue> result = callStream(project.getKey(), null)) {
@@ -181,7 +185,8 @@ public class IssuesActionTest {
.containsExactlyInAnyOrder(
tuple(issueOnFile.getKey(), module.getKey()),
tuple(issueOnModule.getKey(), module.getKey()),
tuple(issueOnProject.getKey(), project.getKey()));
tuple(issueOnProject.getKey(), project.getKey()),
tuple(issueFromMigratedRule.getKey(), module.getKey()));
}
}


Loading…
Cancel
Save