diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-11-23 10:54:13 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-11-25 15:33:06 +0100 |
commit | fb71ab63c9adb2f4c113233c536da602096ec258 (patch) | |
tree | 3b6d74813737a376290fa51f4c2479aee9979bd3 /sonar-db | |
parent | 7a042dc00d1bf992920253755f6a6efb27793870 (diff) | |
download | sonarqube-fb71ab63c9adb2f4c113233c536da602096ec258.tar.gz sonarqube-fb71ab63c9adb2f4c113233c536da602096ec258.zip |
SONAR-7027 add developerId to ComponentDto
Diffstat (limited to 'sonar-db')
5 files changed, 27 insertions, 3 deletions
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 </sql> @@ -408,13 +409,14 @@ <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> @@ -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 @@ -104,6 +104,14 @@ public class ComponentDaoTest { } @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" /> |