aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-08-09 14:54:09 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-08-10 18:17:07 +0200
commit6322127612a3430304f6073a8d430d2bcbea0e66 (patch)
tree0d72b9266c91b92cf74b8c82d905ef15b930141f /sonar-db
parentfd96c6fd9bbaca53c0e8cb914525f3e043bc23ee (diff)
downloadsonarqube-6322127612a3430304f6073a8d430d2bcbea0e66.tar.gz
sonarqube-6322127612a3430304f6073a8d430d2bcbea0e66.zip
SONAR-7958 populate PROJECTS.B_UUID_PATH in PersistComponentsStep
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/java/org/sonar/db/component/ComponentUpdateDto.java11
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml3
-rw-r--r--sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java30
3 files changed, 31 insertions, 13 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentUpdateDto.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentUpdateDto.java
index 7f9af5ab723..54f2b9bd6b6 100644
--- a/sonar-db/src/main/java/org/sonar/db/component/ComponentUpdateDto.java
+++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentUpdateDto.java
@@ -33,6 +33,7 @@ public class ComponentUpdateDto {
private String bCopyComponentUuid;
private String bDescription;
private boolean bEnabled;
+ private String bUuidPath;
private String bLanguage;
private String bLongName;
private String bModuleUuid;
@@ -68,6 +69,10 @@ public class ComponentUpdateDto {
return bEnabled;
}
+ public String getBUuidPath() {
+ return bUuidPath;
+ }
+
@CheckForNull
public String getBLanguage() {
return bLanguage;
@@ -118,6 +123,11 @@ public class ComponentUpdateDto {
return this;
}
+ public ComponentUpdateDto setBUuidPath(String bUuidPath) {
+ this.bUuidPath = bUuidPath;
+ return this;
+ }
+
public ComponentUpdateDto setBName(@Nullable String s) {
this.bName = s;
return this;
@@ -168,6 +178,7 @@ public class ComponentUpdateDto {
.setBCopyComponentUuid(from.getCopyResourceUuid())
.setBDescription(from.description())
.setBEnabled(from.isEnabled())
+ .setBUuidPath(from.getUuidPath())
.setBLanguage(from.language())
.setBLongName(from.longName())
.setBModuleUuid(from.moduleUuid())
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 c1dece9ad81..383175c492e 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
@@ -597,6 +597,7 @@
b_copy_component_uuid = #{bCopyComponentUuid,jdbcType=VARCHAR},
b_description = #{bDescription,jdbcType=VARCHAR},
b_enabled = #{bEnabled,jdbcType=BOOLEAN},
+ b_uuid_path = #{bUuidPath,jdbcType=VARCHAR},
b_language = #{bLanguage,jdbcType=VARCHAR},
b_long_name = #{bLongName,jdbcType=VARCHAR},
b_module_uuid = #{bModuleUuid,jdbcType=VARCHAR},
@@ -614,6 +615,7 @@
b_copy_component_uuid = copy_component_uuid,
b_description = description,
b_enabled = ${_false},
+ b_uuid_path = uuid_path,
b_language = language,
b_long_name = long_name,
b_module_uuid = module_uuid,
@@ -631,6 +633,7 @@
copy_component_uuid = b_copy_component_uuid,
description = b_description,
enabled = b_enabled,
+ uuid_path = b_uuid_path,
language = b_language,
long_name = b_long_name,
module_uuid = b_module_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 f54b6165162..70a3f9f2ddf 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
@@ -670,6 +670,7 @@ public class ComponentDaoTest {
.setBChanged(true)
.setBDescription("desc")
.setBEnabled(true)
+ .setBUuidPath("uuid_path")
.setBLanguage("lang")
.setBLongName("longName")
.setBModuleUuid("moduleUuid")
@@ -677,14 +678,15 @@ public class ComponentDaoTest {
.setBName("name")
.setBPath("path")
.setBQualifier("qualifier")
- );
+ );
dbSession.commit();
Map<String, Object> row = selectBColumnsForUuid("U1");
- assertThat(row.get("bChanged")).isIn(true, /* for Oracle */ 1L, 1);
+ assertThat(row.get("bChanged")).isIn(true, /* for Oracle */1L, 1);
assertThat(row.get("bCopyComponentUuid")).isEqualTo("copy");
assertThat(row.get("bDescription")).isEqualTo("desc");
- assertThat(row.get("bEnabled")).isIn(true, /* for Oracle */ 1L, 1);
+ assertThat(row.get("bEnabled")).isIn(true, /* for Oracle */1L, 1);
+ assertThat(row.get("bUuidPath")).isEqualTo("uuid_path");
assertThat(row.get("bLanguage")).isEqualTo("lang");
assertThat(row.get("bLongName")).isEqualTo("longName");
assertThat(row.get("bModuleUuid")).isEqualTo("moduleUuid");
@@ -705,10 +707,11 @@ public class ComponentDaoTest {
dbSession.commit();
Map<String, Object> row1 = selectBColumnsForUuid("U1");
- assertThat(row1.get("bChanged")).isIn(true, /* for Oracle */ 1L, 1);
+ assertThat(row1.get("bChanged")).isIn(true, /* for Oracle */1L, 1);
assertThat(row1.get("bCopyComponentUuid")).isEqualTo(dto1.getCopyResourceUuid());
assertThat(row1.get("bDescription")).isEqualTo(dto1.description());
- assertThat(row1.get("bEnabled")).isIn(false, /* for Oracle */ 0L, 0);
+ assertThat(row1.get("bEnabled")).isIn(false, /* for Oracle */0L, 0);
+ assertThat(row1.get("bUuidPath")).isEqualTo(dto1.getUuidPath());
assertThat(row1.get("bLanguage")).isEqualTo(dto1.language());
assertThat(row1.get("bLongName")).isEqualTo(dto1.longName());
assertThat(row1.get("bModuleUuid")).isEqualTo(dto1.moduleUuid());
@@ -718,10 +721,11 @@ public class ComponentDaoTest {
assertThat(row1.get("bQualifier")).isEqualTo(dto1.qualifier());
Map<String, Object> row2 = selectBColumnsForUuid("U2");
- assertThat(row2.get("bChanged")).isIn(true, /* for Oracle */ 1L, 1);
+ assertThat(row2.get("bChanged")).isIn(true, /* for Oracle */1L, 1);
assertThat(row2.get("bCopyComponentUuid")).isEqualTo(dto2.getCopyResourceUuid());
assertThat(row2.get("bDescription")).isEqualTo(dto2.description());
- assertThat(row2.get("bEnabled")).isIn(false, /* for Oracle */ 0L, 0);
+ assertThat(row2.get("bEnabled")).isIn(false, /* for Oracle */0L, 0);
+ assertThat(row2.get("bUuidPath")).isEqualTo(dto2.getUuidPath());
assertThat(row2.get("bLanguage")).isEqualTo(dto2.language());
assertThat(row2.get("bLongName")).isEqualTo(dto2.longName());
assertThat(row2.get("bModuleUuid")).isEqualTo(dto2.moduleUuid());
@@ -731,16 +735,16 @@ public class ComponentDaoTest {
assertThat(row2.get("bQualifier")).isEqualTo(dto2.qualifier());
Map<String, Object> row3 = selectBColumnsForUuid("U3");
- assertThat(row3.get("bChanged")).isIn(false, /* for Oracle */ 0L, 0);
+ assertThat(row3.get("bChanged")).isIn(false, /* for Oracle */0L, 0);
}
private Map<String, Object> selectBColumnsForUuid(String uuid) {
return db.selectFirst(
- "select b_changed as \"bChanged\", b_copy_component_uuid as \"bCopyComponentUuid\", b_description as \"bDescription\", " +
- "b_enabled as \"bEnabled\", b_language as \"bLanguage\", b_long_name as \"bLongName\"," +
- "b_module_uuid as \"bModuleUuid\", b_module_uuid_path as \"bModuleUuidPath\", b_name as \"bName\", " +
- "b_path as \"bPath\", b_qualifier as \"bQualifier\" " +
- "from projects where uuid='" + uuid + "'");
+ "select b_changed as \"bChanged\", b_copy_component_uuid as \"bCopyComponentUuid\", b_description as \"bDescription\", " +
+ "b_enabled as \"bEnabled\", b_uuid_path as \"bUuidPath\", b_language as \"bLanguage\", b_long_name as \"bLongName\"," +
+ "b_module_uuid as \"bModuleUuid\", b_module_uuid_path as \"bModuleUuidPath\", b_name as \"bName\", " +
+ "b_path as \"bPath\", b_qualifier as \"bQualifier\" " +
+ "from projects where uuid='" + uuid + "'");
}
@Test