]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4724 Fix duplicate entries in ghost detection query
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 9 Oct 2013 12:35:17 +0000 (14:35 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 9 Oct 2013 12:35:17 +0000 (14:35 +0200)
sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml
sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java

index cc0fbcfe1bdfe0175492adf11fa7101c9ed89b67..0599168ed89e256544c7f10130a878c9be52cc8c 100644 (file)
   </sql>
 
   <select id="selectGhostsProjects" parameterType="map" resultMap="resourceResultMap">
-    select p.* from projects p
+    select distinct p.* from projects p
     inner join snapshots s1 on s1.project_id = p.id and s1.status='U'
     left join snapshots s2 on s2.project_id = p.id and s2.status='P'
     <where>
index 57a728b7c29198dac58ca246b0742f5de9288ce4..25544ca8c95a540f2da75fe65887f0f3d9c68ed2 100644 (file)
@@ -343,6 +343,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
     setupData("fixture-including-ghost-projects-and-technical-project");
 
     List<Component> components = dao.selectGhostsProjects(newArrayList("TRK"));
+    assertThat(components).hasSize(1);
     assertThat(getKeys(components)).containsOnly("org.apache.shindig");
 
     assertThat(dao.selectGhostsProjects(newArrayList("unknown"))).isEmpty();