diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-10-24 11:57:23 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-10-24 11:57:28 +0200 |
commit | 5e77c6a792172648da384f133df2d88451c85b9e (patch) | |
tree | 84a5770211302b8199a09bcd8a9425d9d66d6722 | |
parent | 7750547755c96d5b5c9a46babf28a1a67d9da702 (diff) | |
download | sonarqube-5e77c6a792172648da384f133df2d88451c85b9e.tar.gz sonarqube-5e77c6a792172648da384f133df2d88451c85b9e.zip |
SONAR-5753 Module_uuid_path should not contain a '.' at the end
2 files changed, 6 insertions, 4 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigration.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigration.java index 86b3c966cde..3d969db2f13 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigration.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigration.java @@ -113,6 +113,8 @@ public class PopulateProjectsUuidColumnsMigration implements DatabaseMigration { } } if (moduleUuidPath.length() > 0) { + // Remove last '.' + moduleUuidPath.deleteCharAt(moduleUuidPath.length()-1); component.setModuleUuidPath(moduleUuidPath.toString()); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest.java index a2e05857f27..3709b6e3e3c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest.java @@ -79,25 +79,25 @@ public class PopulateProjectsUuidColumnsMigrationTest { assertThat(module.getUuid()).isNotNull(); assertThat(module.getProjectUuid()).isEqualTo(root.getUuid()); assertThat(module.getModuleUuid()).isNull(); - assertThat(module.getModuleUuidPath()).isEqualTo(root.getUuid() + "."); + assertThat(module.getModuleUuidPath()).isEqualTo(root.getUuid()); Component subModule = mapper.selectComponentByKey("org.struts:struts-db"); assertThat(subModule.getUuid()).isNotNull(); assertThat(subModule.getProjectUuid()).isEqualTo(root.getUuid()); assertThat(subModule.getModuleUuid()).isEqualTo(module.getUuid()); - assertThat(subModule.getModuleUuidPath()).isEqualTo(root.getUuid() + "." + module.getUuid() + "."); + assertThat(subModule.getModuleUuidPath()).isEqualTo(root.getUuid() + "." + module.getUuid()); Component directory = mapper.selectComponentByKey("org.struts:struts-core:src/org/struts"); assertThat(directory.getUuid()).isNotNull(); assertThat(directory.getProjectUuid()).isEqualTo(root.getUuid()); assertThat(directory.getModuleUuid()).isEqualTo(subModule.getUuid()); - assertThat(directory.getModuleUuidPath()).isEqualTo(root.getUuid() + "." + module.getUuid() + "." + subModule.getUuid() + "."); + assertThat(directory.getModuleUuidPath()).isEqualTo(root.getUuid() + "." + module.getUuid() + "." + subModule.getUuid()); Component file = mapper.selectComponentByKey("org.struts:struts-core:src/org/struts/RequestContext.java"); assertThat(file.getUuid()).isNotNull(); assertThat(file.getProjectUuid()).isEqualTo(root.getUuid()); assertThat(file.getModuleUuid()).isEqualTo(subModule.getUuid()); - assertThat(file.getModuleUuidPath()).isEqualTo(root.getUuid() + "." + module.getUuid() + "." + subModule.getUuid() + "."); + assertThat(file.getModuleUuidPath()).isEqualTo(root.getUuid() + "." + module.getUuid() + "." + subModule.getUuid()); // Verify that each generated uuid is unique assertThat(ImmutableSet.of(root.getUuid(), module.getUuid(), subModule.getUuid(), directory.getUuid(), file.getUuid())).hasSize(5); |