]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7027 add developerId to ComponentDto
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 23 Nov 2015 09:54:13 +0000 (10:54 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 25 Nov 2015 14:33:06 +0000 (15:33 +0100)
sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java
sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml
sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java
sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml
sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml

index 4e034e4a19bf4ea2acee41038026569114982426..8842eaa178104adc90ea0e98b1f4a41be4724955 100644 (file)
@@ -41,6 +41,7 @@ public class ComponentDto implements Component {
   private String moduleUuidPath;
   private Long parentProjectId;
   private Long copyResourceId;
+  private Long developerId;
 
   private String path;
   private String deprecatedKey;
@@ -221,6 +222,15 @@ public class ComponentDto implements Component {
     return this;
   }
 
+  public Long getDeveloperId() {
+    return developerId;
+  }
+
+  public ComponentDto setDeveloperId(Long developerId) {
+    this.developerId = developerId;
+    return this;
+  }
+
   public Date getCreatedAt() {
     return createdAt;
   }
@@ -291,6 +301,7 @@ public class ComponentDto implements Component {
       .append("moduleUuidPath", moduleUuidPath)
       .append("parentProjectId", parentProjectId)
       .append("copyResourceId", copyResourceId)
+      .append("developerId", developerId)
       .append("path", path)
       .append("deprecatedKey", deprecatedKey)
       .append("name", name)
index a47afccf978e5cc6703d7fbe57259335e1f57f46..c9c9205ec8e09fd0af06b666f745ab0fb336ee42 100644 (file)
@@ -20,6 +20,7 @@
     p.path as path,
     p.enabled as enabled,
     p.copy_resource_id as copyResourceId,
+    p.person_id as developerId,
     p.authorization_updated_at as authorizationUpdatedAt,
     p.created_at as createdAt
   </sql>
 
   <insert id="insert" parameterType="Component" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
     INSERT INTO projects (kee, deprecated_kee, uuid, project_uuid, module_uuid, module_uuid_path, name, long_name,
-    qualifier, scope, language, description, root_id, path, copy_resource_id, enabled,
+    qualifier, scope, language, description, root_id, path, copy_resource_id, person_id, enabled,
     created_at, authorization_updated_at)
     VALUES (#{kee,jdbcType=VARCHAR}, #{deprecatedKey,jdbcType=VARCHAR}, #{uuid,jdbcType=VARCHAR},
     #{projectUuid,jdbcType=VARCHAR}, #{moduleUuid,jdbcType=VARCHAR}, #{moduleUuidPath,jdbcType=VARCHAR},
     #{name,jdbcType=VARCHAR}, #{longName,jdbcType=VARCHAR}, #{qualifier,jdbcType=VARCHAR}, #{scope,jdbcType=VARCHAR},
     #{language,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
     #{parentProjectId,jdbcType=BIGINT}, #{path,jdbcType=VARCHAR}, #{copyResourceId,jdbcType=BIGINT},
+    #{developerId,jdbcType=BIGINT},
     #{enabled,jdbcType=BOOLEAN},
     #{createdAt,jdbcType=TIMESTAMP}, #{authorizationUpdatedAt,jdbcType=BIGINT})
   </insert>
     root_id=#{parentProjectId,jdbcType=BIGINT},
     path=#{path,jdbcType=VARCHAR},
     copy_resource_id=#{copyResourceId,jdbcType=BIGINT},
+    person_id=#{developerId,jdbcType=BIGINT},
     enabled=#{enabled,jdbcType=BOOLEAN},
     authorization_updated_at=#{authorizationUpdatedAt,jdbcType=BIGINT}
     WHERE uuid=#{uuid}
index 8c52572027b3573c7cd616bdfbb9afcbfd256946..129a2c4f117d26acce013afad1462ac5e2f9232f 100644 (file)
@@ -103,6 +103,14 @@ public class ComponentDaoTest {
     assertThat(result.getCopyResourceId()).isEqualTo(1L);
   }
 
+  @Test
+  public void get_by_uuid_on_developer_project_copy() {
+    db.prepareDbUnit(getClass(), "shared.xml");
+
+    ComponentDto result = underTest.selectByUuid(dbSession, "STUV").get();
+    assertThat(result.getDeveloperId()).isEqualTo(11L);
+  }
+
   @Test
   public void get_by_uuid_on_disabled_component() {
     db.prepareDbUnit(getClass(), "shared.xml");
@@ -564,6 +572,7 @@ public class ComponentDaoTest {
       .setPath("src/org/struts/RequestContext.java")
       .setParentProjectId(3L)
       .setCopyResourceId(5L)
+      .setDeveloperId(7L)
       .setEnabled(true)
       .setCreatedAt(DateUtils.parseDate("2014-06-18"))
       .setAuthorizationUpdatedAt(123456789L);
@@ -624,6 +633,7 @@ public class ComponentDaoTest {
       .setPath("src/org/struts/RequestContext2.java")
       .setParentProjectId(4L)
       .setCopyResourceId(6L)
+      .setDeveloperId(9L)
       .setEnabled(false)
       .setAuthorizationUpdatedAt(12345678910L);
 
index fe171ca444179bd864f2ca430c9bf74a956aff26..3097967ba2b7dcadb1bbf3d5af13c63faf6e3614 100644 (file)
@@ -4,7 +4,7 @@
             name="RequestContext.java" long_name="org.struts.RequestContext"
             uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH."
             qualifier="FIL" scope="FIL" language="java" path="src/org/struts/RequestContext.java" root_id="3"
-            description="description" enabled="[true]" copy_resource_id="5" person_id="[null]"
+            description="description" enabled="[true]" copy_resource_id="5" person_id="7"
             authorization_updated_at="123456789" created_at="2014-06-18"
       />
 
index 8b0e8390a616d8db8dda27c826de6f7ae591daf9..62196600389a60e6dbf55ed18808d3c2fe1961ef 100644 (file)
@@ -4,7 +4,7 @@
             name="RequestContext2.java" long_name="org.struts.RequestContext2"
             uuid="GHIJ" project_uuid="DCBA" module_uuid="HGFE" module_uuid_path=".DCBA.HGFE."
             qualifier="LIF" scope="LIF" language="java2" path="src/org/struts/RequestContext2.java" root_id="4"
-            description="description2" enabled="[false]" copy_resource_id="6" person_id="[null]"
+            description="description2" enabled="[false]" copy_resource_id="6" person_id="9"
             authorization_updated_at="12345678910" created_at="2014-06-18"
       />