]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5753 moduleUuidPath of foot projects should be empty instead of NULL
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 5 Jan 2015 11:33:31 +0000 (12:33 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 5 Jan 2015 11:33:31 +0000 (12:33 +0100)
15 files changed:
server/sonar-server/src/main/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigration.java
server/sonar-server/src/test/java/org/sonar/server/component/ComponentTesting.java
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest.java
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest/migrate_components.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest/migrate_components_without_uuid.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest/migrate_developer.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest/migrate_disable_components.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest/migrate_library.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest/migrate_provisioned_project.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest/migrate_view.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest/not_migrate_already_migrated_components.xml
sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java
sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml
sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java
sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insert-result.xml

index f1b414359a5e9a66eb2c617eef16f0e0f3df7647..c1ce39f0b36740f5253ec8995f90e4e59009148e 100644 (file)
@@ -99,6 +99,7 @@ public class PopulateProjectsUuidColumnsMigration implements DatabaseMigration {
       if (component.getUuid() == null) {
         component.setUuid(getOrCreateUuid(component, uuidByComponentId));
         component.setProjectUuid(getOrCreateUuid(project, uuidByComponentId));
+        component.setModuleUuidPath("");
         componentsToMigrate.add(component);
       }
     }
@@ -115,6 +116,7 @@ public class PopulateProjectsUuidColumnsMigration implements DatabaseMigration {
     for (Component component : readSession.getMapper(Migration50Mapper.class).selectDisabledDirectComponentChildrenForProjects(project.getId())) {
       component.setUuid(getOrCreateUuid(component, uuidByComponentId));
       component.setProjectUuid(projectUuid);
+      component.setModuleUuidPath("");
 
       writeSession.getMapper(Migration50Mapper.class).updateComponentUuids(component);
       counter.getAndIncrement();
@@ -122,6 +124,7 @@ public class PopulateProjectsUuidColumnsMigration implements DatabaseMigration {
     for (Component component : readSession.getMapper(Migration50Mapper.class).selectDisabledNoneDirectComponentChildrenForProjects(project.getId())) {
       component.setUuid(getOrCreateUuid(component, uuidByComponentId));
       component.setProjectUuid(projectUuid);
+      component.setModuleUuidPath("");
 
       writeSession.getMapper(Migration50Mapper.class).updateComponentUuids(component);
       counter.getAndIncrement();
@@ -159,6 +162,7 @@ public class PopulateProjectsUuidColumnsMigration implements DatabaseMigration {
       String uuid = Uuids.create();
       component.setUuid(uuid);
       component.setProjectUuid(uuid);
+      component.setModuleUuidPath("");
 
       writeSession.getMapper(Migration50Mapper.class).updateComponentUuids(component);
       counter.getAndIncrement();
index d1a6db4a09ad74220f7137b1ae31f7008f3c5ba1..347a2afb8e13af167b493683b47de5d31c97e708 100644 (file)
@@ -54,7 +54,7 @@ public class ComponentTesting {
       .setUuid(Uuids.create())
       .setProjectUuid(subProjectOrProject.projectUuid())
       .setModuleUuid(subProjectOrProject.uuid())
-      .setModuleUuidPath(subProjectOrProject.moduleUuidPath() == null ? subProjectOrProject.uuid() + "." : subProjectOrProject.moduleUuidPath() + subProjectOrProject.uuid() + ".")
+      .setModuleUuidPath(subProjectOrProject.moduleUuidPath() == null ? subProjectOrProject.uuid() : subProjectOrProject.moduleUuidPath() + "." + subProjectOrProject.uuid())
       .setKey("KEY_" + uuid)
       .setName("NAME_" + uuid)
       .setLongName("LONG_NAME_" + uuid)
index a61d93c52c765c6be761f32062839c98843bf959..0ec5cfaebcc2acaba770770cf9f7049b140d07bb 100644 (file)
@@ -73,7 +73,7 @@ public class PopulateProjectsUuidColumnsMigrationTest {
     assertThat(root.getUuid()).isNotNull();
     assertThat(root.getProjectUuid()).isEqualTo(root.getUuid());
     assertThat(root.getModuleUuid()).isNull();
-    assertThat(root.getModuleUuidPath()).isNull();
+    assertThat(root.getModuleUuidPath()).isEmpty();
 
     Component module = mapper.selectComponentByKey("org.struts:struts-core");
     assertThat(module.getUuid()).isNotNull();
@@ -114,7 +114,7 @@ public class PopulateProjectsUuidColumnsMigrationTest {
     assertThat(root.getUuid()).isEqualTo("ABCD");
     assertThat(root.getProjectUuid()).isEqualTo("ABCD");
     assertThat(root.getModuleUuid()).isNull();
-    assertThat(root.getModuleUuidPath()).isNull();
+    assertThat(root.getModuleUuidPath()).isEmpty();
 
     Component module = mapper.selectComponentByKey("org.struts:struts-core");
     assertThat(module.getUuid()).isEqualTo("BCDE");
@@ -162,28 +162,28 @@ public class PopulateProjectsUuidColumnsMigrationTest {
     assertThat(module.getProjectUuid()).isEqualTo(root.getUuid());
     // Module and module path will always be null for removed components
     assertThat(module.getModuleUuid()).isNull();
-    assertThat(module.getModuleUuidPath()).isNull();
+    assertThat(module.getModuleUuidPath()).isEmpty();
 
     Component subModule = mapper.selectComponentByKey("org.struts:struts-db");
     assertThat(subModule.getUuid()).isNotNull();
     assertThat(subModule.getProjectUuid()).isEqualTo(root.getUuid());
     // Module and module path will always be null for removed components
     assertThat(subModule.getModuleUuid()).isNull();
-    assertThat(subModule.getModuleUuidPath()).isNull();
+    assertThat(subModule.getModuleUuidPath()).isEmpty();
 
     Component directory = mapper.selectComponentByKey("org.struts:struts-core:src/org/struts");
     assertThat(directory.getUuid()).isNotNull();
     assertThat(directory.getProjectUuid()).isEqualTo(root.getUuid());
     // Module and module path will always be null for removed components
     assertThat(directory.getModuleUuid()).isNull();
-    assertThat(directory.getModuleUuidPath()).isNull();
+    assertThat(directory.getModuleUuidPath()).isEmpty();
 
     Component file = mapper.selectComponentByKey("org.struts:struts-core:src/org/struts/RequestContext.java");
     assertThat(file.getUuid()).isNotNull();
     assertThat(file.getProjectUuid()).isEqualTo(root.getUuid());
     // Module and module path will always be null for removed components
     assertThat(file.getModuleUuid()).isNull();
-    assertThat(file.getModuleUuidPath()).isNull();
+    assertThat(file.getModuleUuidPath()).isEmpty();
   }
 
   @Test
@@ -197,7 +197,7 @@ public class PopulateProjectsUuidColumnsMigrationTest {
     assertThat(root.getUuid()).isNotNull();
     assertThat(root.getProjectUuid()).isEqualTo(root.getUuid());
     assertThat(root.getModuleUuid()).isNull();
-    assertThat(root.getModuleUuidPath()).isNull();
+    assertThat(root.getModuleUuidPath()).isEmpty();
   }
 
   @Test
@@ -211,7 +211,7 @@ public class PopulateProjectsUuidColumnsMigrationTest {
     assertThat(root.getUuid()).isNotNull();
     assertThat(root.getProjectUuid()).isEqualTo(root.getUuid());
     assertThat(root.getModuleUuid()).isNull();
-    assertThat(root.getModuleUuidPath()).isNull();
+    assertThat(root.getModuleUuidPath()).isEmpty();
   }
 
   @Test
@@ -225,7 +225,7 @@ public class PopulateProjectsUuidColumnsMigrationTest {
     assertThat(view.getUuid()).isNotNull();
     assertThat(view.getProjectUuid()).isEqualTo(view.getUuid());
     assertThat(view.getModuleUuid()).isNull();
-    assertThat(view.getModuleUuidPath()).isNull();
+    assertThat(view.getModuleUuidPath()).isEmpty();
 
     Component subView = mapper.selectComponentByKey("subView");
     assertThat(subView.getUuid()).isNotNull();
@@ -251,7 +251,7 @@ public class PopulateProjectsUuidColumnsMigrationTest {
     assertThat(dev.getUuid()).isNotNull();
     assertThat(dev.getProjectUuid()).isEqualTo(dev.getUuid());
     assertThat(dev.getModuleUuid()).isNull();
-    assertThat(dev.getModuleUuidPath()).isNull();
+    assertThat(dev.getModuleUuidPath()).isEmpty();
 
     Component techDev = mapper.selectComponentByKey("DEV:developer@company.net:org.struts:struts");
     assertThat(techDev.getUuid()).isNotNull();
@@ -272,21 +272,21 @@ public class PopulateProjectsUuidColumnsMigrationTest {
     assertThat(root.getUuid()).isNotNull();
     assertThat(root.getProjectUuid()).isEqualTo(root.getUuid());
     assertThat(root.getModuleUuid()).isNull();
-    assertThat(root.getModuleUuidPath()).isNull();
+    assertThat(root.getModuleUuidPath()).isEmpty();
 
     // Module with a snapshot having no islast=true
     Component module = mapper.selectComponentByKey("org.struts:struts-core");
     assertThat(module.getUuid()).isNotNull();
     assertThat(module.getProjectUuid()).isEqualTo(module.getUuid());
     assertThat(module.getModuleUuid()).isNull();
-    assertThat(module.getModuleUuidPath()).isNull();
+    assertThat(module.getModuleUuidPath()).isEmpty();
 
     // File linked on a no more existing project
-     Component file = mapper.selectComponentByKey("org.struts:struts-core:src/org/struts/RequestContext.java");
+    Component file = mapper.selectComponentByKey("org.struts:struts-core:src/org/struts/RequestContext.java");
     assertThat(file.getUuid()).isNotNull();
     assertThat(file.getProjectUuid()).isEqualTo(file.getUuid());
     assertThat(file.getModuleUuid()).isNull();
-    assertThat(file.getModuleUuidPath()).isNull();
+    assertThat(file.getModuleUuidPath()).isEmpty();
   }
 
 }
index cff6eb311732e97efb69a6665057983cb31155e1..e38e16ae56fb79b6ddf98b180f496226e9098ed6 100644 (file)
@@ -2,7 +2,7 @@
 
   <!-- root project -->
   <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             description="the description" long_name="Apache Struts"
             enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-06-18" />
@@ -18,7 +18,7 @@
 
   <!-- module -->
   <projects id="2" root_id="1" kee="org.struts:struts-core" name="Struts Core"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             scope="PRJ" qualifier="BRC" long_name="Struts Core" deprecated_kee="[null]"
             description="[null]" enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" created_at="2014-06-18" />
   <snapshots id="2" project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
@@ -33,7 +33,7 @@
 
   <!-- sub module -->
   <projects id="3" root_id="2" kee="org.struts:struts-db" name="Struts Db"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             scope="PRJ" qualifier="BRC" long_name="Struts Db" deprecated_kee="[null]"
             description="[null]" enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" created_at="2014-06-18" />
   <snapshots id="3" project_id="3" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="1"
@@ -48,7 +48,7 @@
 
   <!-- directory -->
   <projects long_name="org.struts" id="4" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             name="src/org/struts" root_id="2"
             description="[null]" deprecated_kee="[null]"
             enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="src/org/struts" created_at="2014-06-18" />
@@ -64,7 +64,7 @@
 
   <!-- file -->
   <projects long_name="org.struts.RequestContext" id="5" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             name="RequestContext.java" root_id="2"
             description="[null]" deprecated_kee="[null]"
             enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="src/org/struts/RequestContext.java" created_at="2014-06-18" />
index c10e10949b5a0f50793b2a2a1d14a782cd30f1b6..4c4c2ec4e2821858d41413f0820b6a2d3b87ccf8 100644 (file)
@@ -2,7 +2,7 @@
 
   <!-- root project -->
   <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             description="the description" long_name="Apache Struts"
             enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-06-18" />
@@ -18,7 +18,7 @@
 
   <!-- module with a snapshot having no islast=true -->
   <projects id="2" root_id="1" kee="org.struts:struts-core" name="Struts Core"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             scope="PRJ" qualifier="BRC" long_name="Struts Core" deprecated_kee="[null]"
             description="[null]" enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" created_at="2014-06-18" />
   <snapshots id="2" project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
@@ -33,7 +33,7 @@
 
   <!-- file linked on a no more existing project -->
   <projects long_name="org.struts.RequestContext" id="5" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             name="RequestContext.java" root_id="999"
             description="[null]" deprecated_kee="[null]"
             enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="src/org/struts/RequestContext.java" created_at="2014-06-18" />
index 0be69725843955027ea675f31c2874a82ae3032d..f2a7202514ca58fe3270dccd2d1068fadfa9e6d9 100644 (file)
@@ -2,7 +2,7 @@
 
   <!-- developer -->
   <projects id="1" kee="DEV:developer@company.net" name="developer@company.net" long_name="Developer" scope="PRJ" qualifier="DEV" root_id="[null]" description="[null]"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-09-01" />
   <snapshots id="1" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]"
@@ -17,7 +17,7 @@
 
   <!-- technical project -->
   <projects id="2" root_id="1" scope="PRJ" qualifier="DEV_PRJ" kee="DEV:developer@company.net:org.struts:struts" name="Struts"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             description="the description" long_name="Apache Struts"
             enabled="[true]" language="[null]" copy_resource_id="10" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-06-18" />
index fed87fc45a7a412f0832bace9796e2b7bf7f095e..a1e51111fc0f0dbdebca5a2068633f31a88d5bf1 100644 (file)
@@ -2,7 +2,7 @@
 
   <!-- root project -->
   <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             description="the description" long_name="Apache Struts"
             enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-06-18" />
@@ -18,7 +18,7 @@
 
   <!-- removed module -->
   <projects id="2" root_id="1" kee="org.struts:struts-core" name="Struts Core"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             scope="PRJ" qualifier="BRC" long_name="Struts Core" deprecated_kee="[null]"
             description="[null]" enabled="[false]" language="[null]" copy_resource_id="[null]" person_id="[null]" created_at="2014-06-18" />
   <snapshots id="2" project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
@@ -33,7 +33,7 @@
 
   <!--removed  sub module -->
   <projects id="3" root_id="2" kee="org.struts:struts-db" name="Struts Db"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             scope="PRJ" qualifier="BRC" long_name="Struts Db" deprecated_kee="[null]"
             description="[null]" enabled="[false]" language="[null]" copy_resource_id="[null]" person_id="[null]" created_at="2014-06-18" />
   <snapshots id="3" project_id="3" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="1"
@@ -48,7 +48,7 @@
 
   <!-- removed directory -->
   <projects long_name="org.struts" id="4" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             name="src/org/struts" root_id="2"
             description="[null]" deprecated_kee="[null]"
             enabled="[false]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="src/org/struts" created_at="2014-06-18" />
@@ -64,7 +64,7 @@
 
   <!-- removed file -->
   <projects long_name="org.struts.RequestContext" id="5" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             name="RequestContext.java" root_id="2"
             description="[null]" deprecated_kee="[null]"
             enabled="[false]" language="java" copy_resource_id="[null]" person_id="[null]" path="src/org/struts/RequestContext.java" created_at="2014-06-18" />
index d1e8908bf0458a621f0f50dfdbfeedb23dbc50e3..bc464dc5264222b32bd5cd3842dbff3e0514e47b 100644 (file)
@@ -2,7 +2,7 @@
 
   <!-- library -->
   <projects id="1" root_id="[null]" scope="PRJ" qualifier="LIB" kee="org.hamcrest:hamcrest-library" name="org.hamcrest:hamcrest-library"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             description="[null]" long_name="org.hamcrest:hamcrest-library"
             enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-06-18" />
index 9e688d16451f6257774b5f84bb39d2a867b7d30a..0d3962b8d6713abf4ce80417d841bcc57ac56754 100644 (file)
@@ -2,7 +2,7 @@
 
   <!-- provisioned project -->
   <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             description="the description" long_name="Apache Struts"
             enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-06-18" />
index 5a1a222a2ba9d4e9e30dc0d83c28f9fb83589bde..7b20b9d98ee928f75e0a9537b0ec32efbbd21435 100644 (file)
@@ -2,7 +2,7 @@
 
   <!-- view -->
   <projects id="1" kee="view" name="View" long_name="View" scope="PRJ" qualifier="VW" root_id="[null]" description="[null]"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-09-01" />
   <snapshots id="1" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]"
@@ -17,7 +17,7 @@
 
   <!-- sub view -->
   <projects id="2" kee="subView" name="Sub View" long_name="Sub View" scope="PRJ" qualifier="SVW" root_id="1" description="[null]"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-09-01" />
   <snapshots id="2" project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
@@ -32,7 +32,7 @@
 
   <!-- technical project -->
   <projects id="3" root_id="1" scope="FIL" qualifier="TRK" kee="vieworg.struts:struts" name="Struts"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             description="the description" long_name="Apache Struts"
             enabled="[true]" language="[null]" copy_resource_id="10" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-06-18" />
index 98471afd445a40de7532d082e7ef03422223c86a..524a1e3a682ceb27c93d273e92f162441f61263d 100644 (file)
@@ -2,7 +2,7 @@
 
   <!-- root project migrated -->
   <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts"
-            uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=""
             description="the description" long_name="Apache Struts"
             enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]"
             created_at="2014-06-18" />
@@ -33,7 +33,7 @@
 
   <!-- sub module not migrated -->
   <projects id="3" root_id="2" kee="org.struts:struts-db" name="Struts Db"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             scope="PRJ" qualifier="BRC" long_name="Struts Db" deprecated_kee="[null]"
             description="[null]" enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" created_at="2014-06-18" />
   <snapshots id="3" project_id="3" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="1"
@@ -48,7 +48,7 @@
 
   <!-- directory not migrated -->
   <projects long_name="org.struts" id="4" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             name="src/org/struts" root_id="2"
             description="[null]" deprecated_kee="[null]"
             enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="src/org/struts" created_at="2014-06-18" />
@@ -64,7 +64,7 @@
 
   <!-- file not migrated -->
   <projects long_name="org.struts.RequestContext" id="5" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path="[null]"
+            uuid="[null]" project_uuid="[null]" module_uuid="[null]" module_uuid_path=""
             name="RequestContext.java" root_id="2"
             description="[null]" deprecated_kee="[null]"
             enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="src/org/struts/RequestContext.java" created_at="2014-06-18" />
index b26f6ff465e50a441c6a2009c9219d2be0bc41f6..26de7532558cd029323c30d1d304f7747e993dfe 100644 (file)
@@ -158,6 +158,7 @@ public class ResourceDao implements DaoComponent {
             String uuid = Uuids.create();
             resource.setUuid(uuid);
             resource.setProjectUuid(uuid);
+            resource.setModuleUuidPath("");
           }
           resource.setCreatedAt(now);
           resource.setAuthorizationUpdatedAt(now.getTime());
index 025d5f4deb188694dbfdb992e3433d6bced49cda..310b42e62ad143bca1cda184f13fbf20f64cf5ef 100644 (file)
 
   <insert id="insert" parameterType="Resource" keyColumn="id" useGeneratedKeys="true" keyProperty="id" >
     insert into projects
-    (uuid, project_uuid, name, long_name, description, scope, qualifier, kee, deprecated_kee, path, language, root_id, copy_resource_id, person_id, enabled, authorization_updated_at, created_at)
+    (uuid, project_uuid, module_uuid, module_uuid_path, name, long_name, description, scope, qualifier, kee, deprecated_kee, path, language, root_id, copy_resource_id, person_id,
+    enabled, authorization_updated_at, created_at)
     values (
-    #{uuid}, #{projectUuid}, #{name}, #{longName}, #{description}, #{scope}, #{qualifier},
+    #{uuid}, #{projectUuid}, #{moduleUuid}, #{moduleUuidPath}, #{name}, #{longName}, #{description}, #{scope}, #{qualifier},
     #{key}, #{deprecatedKey}, #{path}, #{language}, #{rootId}, #{copyResourceId},
     #{personId}, #{enabled}, #{authorizationUpdatedAt}, #{createdAt}
     )
index b5fdb0c48ac95c068cb0fd7599972ebd85cc3080..a071e05492997169a929db607cc93ddf5130142d 100644 (file)
@@ -251,12 +251,12 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
     setupData("insert");
 
     ResourceDto file1 = new ResourceDto()
-      .setUuid("ABCD").setProjectUuid("EFGH")
+      .setUuid("ABCD").setProjectUuid("EFGH").setModuleUuid("EFGH").setModuleUuidPath("EFGH")
       .setKey("org.struts:struts:/src/main/java/org/struts/Action.java")
       .setDeprecatedKey("org.struts:struts:org.struts.Action").setScope(Scopes.FILE).setQualifier(Qualifiers.FILE)
       .setLanguage("java").setName("Action").setLongName("org.struts.Action").setPath("/foo/bar");
     ResourceDto file2 = new ResourceDto()
-      .setUuid("BCDE").setProjectUuid("FGHI")
+      .setUuid("BCDE").setProjectUuid("FGHI").setModuleUuid("FGHI").setModuleUuidPath("FGHI")
       .setKey("org.struts:struts:/src/main/java/org/struts/Filter.java")
       .setDeprecatedKey("org.struts:struts:org.struts.Filter").setScope(Scopes.FILE).setQualifier(Qualifiers.FILE)
       .setLanguage("java").setName("Filter").setLongName("org.struts.Filter");
@@ -314,9 +314,11 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
 
     assertThat(project.getUuid()).isNotNull();
     assertThat(project.getProjectUuid()).isEqualTo(project.getUuid());
+    assertThat(project.getModuleUuidPath()).isEmpty();
 
     assertThat(file.getUuid()).isNull();
     assertThat(file.getProjectUuid()).isNull();
+    assertThat(file.getModuleUuidPath()).isNull();
   }
 
   @Test
index 08cef5638d4b98a62594415987d8a4d6c34780ba..bbaa53ea1a300b09c2ac618d4ecdd234a12f5219 100644 (file)
@@ -1,12 +1,12 @@
 <dataset>
 
-  <projects id="1" root_id="[null]" uuid="ABCD" project_uuid="EFGH" module_uuid="[null]" module_uuid_path="[null]"
+  <projects id="1" root_id="[null]" uuid="ABCD" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path="EFGH"
             scope="FIL" qualifier="FIL" kee="org.struts:struts:/src/main/java/org/struts/Action.java" name="Action"
             description="[null]" long_name="org.struts.Action"
             enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="2014-09-03" path="/foo/bar" deprecated_kee="org.struts:struts:org.struts.Action"
             authorization_updated_at="123456789"/>
 
-  <projects id="2" root_id="[null]" uuid="BCDE" project_uuid="FGHI" module_uuid="[null]" module_uuid_path="[null]"
+  <projects id="2" root_id="[null]" uuid="BCDE" project_uuid="FGHI" module_uuid="FGHI" module_uuid_path="FGHI"
             scope="FIL" qualifier="FIL" kee="org.struts:struts:/src/main/java/org/struts/Filter.java" name="Filter"
             description="[null]" long_name="org.struts.Filter"
             enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="2014-09-03" path="[null]" deprecated_kee="org.struts:struts:org.struts.Filter"