]> source.dussan.org Git - sonarqube.git/commitdiff
Fix empty component.path in issues WS
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 17 Mar 2014 16:40:29 +0000 (17:40 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 17 Mar 2014 16:41:37 +0000 (17:41 +0100)
sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java
sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml
sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java

index 20f893145d60ad4a9325bd0f4211f947c8d84144..6b74cf761eb598d7fcae539b3a53baa4e7a09363 100644 (file)
@@ -54,12 +54,13 @@ public class ComponentDto implements Component {
     return this;
   }
 
+  @CheckForNull
   @Override
   public String path() {
     return path;
   }
 
-  public ComponentDto setPath(String path) {
+  public ComponentDto setPath(@Nullable String path) {
     this.path = path;
     return this;
   }
index 73ea46711a8c3346e85ae5546281d7b5ee1520ed..6488c247480225cf7185b05f75610d308b1bdf7c 100644 (file)
@@ -28,7 +28,8 @@
     p.long_name as longName,
     p.qualifier as qualifier,
     s.root_project_id as projectId,
-    p.root_id as subProjectId
+    p.root_id as subProjectId,
+    p.path as path
   </sql>
 
   <resultMap id="snapshotResultMap" type="Snapshot">
index 4de4f06202476a1474287afa153a1bca915393e3..013e9b220740bf6dd38b15ff4ec2a3e089d5f891 100644 (file)
@@ -180,6 +180,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
     assertThat(component.qualifier()).isEqualTo("FIL");
     assertThat(component.projectId()).isEqualTo(1);
     assertThat(component.subProjectId()).isEqualTo(2);
+    assertThat(component.path()).isEqualTo("src/org/struts/RequestContext.java");
 
     // Module
     results = dao.selectComponentsByIds(newArrayList(2L));
@@ -192,6 +193,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
     assertThat(component.qualifier()).isEqualTo("BRC");
     assertThat(component.subProjectId()).isEqualTo(1);
     assertThat(component.projectId()).isEqualTo(1);
+    assertThat(component.path()).isNull();
 
     // Project
     results = dao.selectComponentsByIds(newArrayList(1L));
@@ -204,6 +206,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
     assertThat(component.qualifier()).isEqualTo("TRK");
     assertThat(component.subProjectId()).isNull();
     assertThat(component.projectId()).isEqualTo(1);
+    assertThat(component.path()).isNull();
   }
 
   @Test