From: Sébastien Lesaint Date: Mon, 23 Nov 2015 09:54:13 +0000 (+0100) Subject: SONAR-7027 add developerId to ComponentDto X-Git-Tag: 5.3-RC1~177 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fb71ab63c9adb2f4c113233c536da602096ec258;p=sonarqube.git SONAR-7027 add developerId to ComponentDto --- diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java index 4e034e4a19b..8842eaa1781 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java @@ -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) diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml index a47afccf978..c9c9205ec8e 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml @@ -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 @@ -408,13 +409,14 @@ 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}) @@ -435,6 +437,7 @@ 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} diff --git a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java index 8c52572027b..129a2c4f117 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java @@ -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); diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml index fe171ca4441..3097967ba2b 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml @@ -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" /> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml index 8b0e8390a61..62196600389 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml @@ -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" />