]> source.dussan.org Git - sonarqube.git/commitdiff
delete component ids from the issues table 56/head
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 23 Jan 2015 13:55:40 +0000 (14:55 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 26 Jan 2015 13:20:12 +0000 (14:20 +0100)
80 files changed:
server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java
server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java
server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistIssuesStep.java
server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java
server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueResultSetIterator.java
server/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueStorageTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java
server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/return_only_manual_severity.xml
server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/shared.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_insert_new_issues-result.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_update_issues-result.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_update_issues.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/find_by_action_plan.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/get_by_key.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/insert-result.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/select_non_closed_issues_by_module_uuid.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/select_non_closed_issues_by_project_uuid.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/update-result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/update.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml
server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml
server/sonar-web/src/main/webapp/WEB-INF/db/migrate/773_remove_issue_component_ids.rb [new file with mode: 0644]
sonar-batch/src/main/java/org/sonar/batch/scan/report/JSONReport.java
sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTask.java
sonar-core/src/main/java/org/sonar/core/issue/db/IssueDto.java
sonar-core/src/main/java/org/sonar/core/issue/db/UpdateConflictResolver.java
sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
sonar-core/src/main/java/org/sonar/core/persistence/PreviewDatabaseFactory.java
sonar-core/src/main/java/org/sonar/core/purge/IdUuidPairs.java
sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java
sonar-core/src/main/java/org/sonar/core/purge/PurgeConfiguration.java
sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java
sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java
sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml
sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml
sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml
sonar-core/src/test/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTaskTest.java
sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java
sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java
sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java
sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java
sonar-core/src/test/java/org/sonar/core/issue/db/UpdateConflictResolverTest.java
sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java
sonar-core/src/test/java/org/sonar/core/purge/PurgeConfigurationTest.java
sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java
sonar-core/src/test/resources/org/sonar/core/issue/db/ActionPlanStatsDaoTest/should_find_by_project.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeDaoTest/select_issue_changelog_by_module.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeDaoTest/select_issue_changelog_by_module_are_sorted_by_creation_date.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/find_rules_by_component.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/find_severities_by_component.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_key.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_issue_and_component_ids.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_non_closed_issues_by_module.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testInsert-result.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testUpdate-result.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testUpdate.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/updateBeforeSelectedDate_with_conflict-result.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/updateBeforeSelectedDate_with_conflict.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStatsDaoTest/should_select_assignees.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStorageTest/should_insert_new_issues-result.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStorageTest/should_resolve_conflicts_on_updates-result.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStorageTest/should_resolve_conflicts_on_updates.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStorageTest/should_update_issues-result.xml
sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStorageTest/should_update_issues.xml
sonar-core/src/test/resources/org/sonar/core/persistence/PreviewDatabaseFactoryTest/multi-modules-with-issues.xml
sonar-core/src/test/resources/org/sonar/core/persistence/PreviewDatabaseFactoryTest/should_create_database_with_issues.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/disable_resources_without_last_snapshot-result.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/disable_resources_without_last_snapshot.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/should_delete_all_closed_issues-result.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/should_delete_all_closed_issues.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/should_delete_old_closed_issues-result.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/should_delete_old_closed_issues.xml
sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java
sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java

index dbeb19e65ff5aacec53c7c61ecb7c06b4bfbb1ae..021f88ebdaf2ad4633ad6ff1e8c6d57206c996ee 100644 (file)
@@ -34,7 +34,6 @@ import org.sonar.server.properties.ProjectSettingsFactory;
 import org.sonar.server.search.IndexClient;
 
 import javax.annotation.Nullable;
-
 import java.util.Date;
 
 import static org.sonar.core.purge.PurgeConfiguration.newDefaultPurgeConfiguration;
@@ -50,7 +49,7 @@ public class ProjectCleaner implements ServerComponent {
   private final IndexClient indexClient;
 
   public ProjectCleaner(PurgeDao purgeDao, DefaultPeriodCleaner periodCleaner, PurgeProfiler profiler, PurgeListener purgeListener,
-    ProjectSettingsFactory projectSettingsFactory, IndexClient indexClient) {
+                        ProjectSettingsFactory projectSettingsFactory, IndexClient indexClient) {
     this.purgeDao = purgeDao;
     this.periodCleaner = periodCleaner;
     this.profiler = profiler;
@@ -64,9 +63,9 @@ public class ProjectCleaner implements ServerComponent {
     profiler.reset();
 
     Settings settings = projectSettingsFactory.newProjectSettings(session, idUuidPair.getId());
-    PurgeConfiguration configuration = newDefaultPurgeConfiguration(settings, idUuidPair.getId());
+    PurgeConfiguration configuration = newDefaultPurgeConfiguration(settings, idUuidPair);
 
-    cleanHistoricalData(session, configuration.rootProjectId(), settings);
+    cleanHistoricalData(session, configuration.rootProjectIdUuid().getId(), settings);
     doPurge(session, configuration);
 
     deleteIndexedIssuesBefore(idUuidPair.getUuid(), configuration.maxLiveDateOfClosedIssues());
@@ -105,7 +104,7 @@ public class ProjectCleaner implements ServerComponent {
       purgeDao.purge(session, configuration, purgeListener);
     } catch (Exception e) {
       // purge errors must no fail the report analysis
-      LOG.error("Fail to purge data [id=" + configuration.rootProjectId() + "]", e);
+      LOG.error("Fail to purge data [id=" + configuration.rootProjectIdUuid().getId() + "]", e);
     }
   }
 }
index 9fa4fdcda5090710f84ffb983135b63c59c3b242..29fc0933b164242de81754c2347b71e5eb9e89f0 100644 (file)
@@ -137,7 +137,6 @@ public class AnalysisReportService {
 
   private DefaultIssue setComponent(DefaultIssue issue, @Nullable ReportComponent component) {
     if (component != null) {
-      issue.setComponentId((long) component.id());
       issue.setComponentUuid(component.uuid());
     }
     return issue;
index ecfae85a8fcf4dcd6f88b70a5c352de9c7652e81..8f56637cfa58fcd38543d02c42e5fe41531d8236 100644 (file)
@@ -70,11 +70,11 @@ public class PersistIssuesStep implements ComputationStep {
         boolean saved = false;
         if (issue.isNew()) {
           Integer ruleId = ruleCache.get(issue.ruleKey()).getId();
-          mapper.insert(IssueDto.toDtoForComputationInsert(issue, issue.componentId(), context.getProject().getId(), ruleId, system2.now()));
+          mapper.insert(IssueDto.toDtoForComputationInsert(issue, ruleId, system2.now()));
           count++;
           saved = true;
         } else if (issue.isChanged()) {
-          IssueDto dto = IssueDto.toDtoForUpdate(issue, context.getProject().getId(), system2.now());
+          IssueDto dto = IssueDto.toDtoForUpdate(issue, system2.now());
           if (Issue.STATUS_CLOSED.equals(issue.status()) || issue.selectedAt() == null) {
             // Issue is closed by scan or changed by end-user
             mapper.update(dto);
index aed1124e1c40fb1a1e5ab67161a40584d55f3bc7..ca7b48f31a2c7fad0c7f3fd36d10bcdd552abdce 100644 (file)
@@ -56,7 +56,7 @@ public class ServerIssueStorage extends IssueStorage implements ServerComponent
 
   @Override
   protected void doUpdate(DbSession session, long now, DefaultIssue issue) {
-    IssueDto dto = IssueDto.toDtoForUpdate(issue, project(session, issue).getId(), now);
+    IssueDto dto = IssueDto.toDtoForUpdate(issue, now);
 
     dbClient.issueDao().update(session, dto);
   }
index 072639ef48f6420cab7b8f788da8936c6dc2a49d..7bb8c882c9d27a8373b7e49313fd6ea11a85d86f 100644 (file)
@@ -80,8 +80,8 @@ class IssueResultSetIterator extends ResultSetIterator<IssueDoc> {
 
   private static final String SQL_ALL = "select " + StringUtils.join(FIELDS, ",") + " from issues i " +
     "inner join rules r on r.id=i.rule_id " +
-    "inner join projects p on p.id=i.component_id " +
-    "inner join projects root on root.id=i.root_component_id";
+    "inner join projects p on p.uuid=i.component_uuid " +
+    "inner join projects root on root.uuid=i.project_uuid";
 
   private static final String SQL_AFTER_DATE = SQL_ALL + " where i.updated_at>?";
 
index 7c8025960e6618f7995ecb9f9384035a848d2360..f4a9f6372f41418725ebca4771c1af6711d01f1c 100644 (file)
@@ -124,7 +124,7 @@ public class ServerIssueStorageTest extends AbstractDaoTestCase {
 
     storage.save(issue);
 
-    checkTables("should_insert_new_issues", new String[]{"id", "created_at", "updated_at", "issue_change_creation_date"}, "issues", "issue_changes");
+    checkTables("should_insert_new_issues", new String[] {"id", "created_at", "updated_at", "issue_change_creation_date"}, "issues", "issue_changes");
   }
 
   @Test
@@ -143,8 +143,9 @@ public class ServerIssueStorageTest extends AbstractDaoTestCase {
       .setNew(false)
       .setChanged(true)
 
-        // updated fields
+      // updated fields
       .setLine(5000)
+      .setProjectUuid("CDEF")
       .setDebt(Duration.create(10L))
       .setChecksum("FFFFF")
       .setAuthorLogin("simon")
@@ -160,14 +161,14 @@ public class ServerIssueStorageTest extends AbstractDaoTestCase {
       .setUpdateDate(date)
       .setCloseDate(date)
 
-        // unmodifiable fields
+      // unmodifiable fields
       .setRuleKey(RuleKey.of("xxx", "unknown"))
       .setComponentKey("struts:Action")
       .setProjectKey("struts");
 
     storage.save(issue);
 
-    checkTables("should_update_issues", new String[]{"id", "created_at", "updated_at", "issue_change_creation_date"}, "issues", "issue_changes");
+    checkTables("should_update_issues", new String[] {"id", "created_at", "updated_at", "issue_change_creation_date"}, "issues", "issue_changes");
   }
 
   static class FakeRuleFinder implements RuleFinder {
index 0a51301d34ae42519b31eb07201323951e2dac7a..9717ea919938d2a1d893d74fcc2330a62af4cf30 100644 (file)
@@ -62,8 +62,8 @@ public class IssueDaoTest extends AbstractDaoTestCase {
     IssueDto issue = sut.selectByKey(session, "ABCDE");
     assertThat(issue.getKee()).isEqualTo("ABCDE");
     assertThat(issue.getId()).isEqualTo(100L);
-    assertThat(issue.getComponentId()).isEqualTo(401);
-    assertThat(issue.getProjectId()).isEqualTo(399);
+    assertThat(issue.getComponentUuid()).isEqualTo("CDEF");
+    assertThat(issue.getProjectUuid()).isEqualTo("ABCD");
     assertThat(issue.getRuleId()).isEqualTo(500);
     assertThat(issue.getLanguage()).isEqualTo("java");
     assertThat(issue.getSeverity()).isEqualTo("BLOCKER");
@@ -107,8 +107,8 @@ public class IssueDaoTest extends AbstractDaoTestCase {
     IssueDto issue = issues.get(0);
     assertThat(issue.getKee()).isEqualTo("ABCDE");
     assertThat(issue.getActionPlanKey()).isEqualTo("AP-1");
-    assertThat(issue.getComponentId()).isEqualTo(401);
-    assertThat(issue.getProjectId()).isEqualTo(399);
+    assertThat(issue.getComponentUuid()).isEqualTo("CDEF");
+    assertThat(issue.getProjectUuid()).isEqualTo("ABCD");
     assertThat(issue.getRuleId()).isEqualTo(500);
     assertThat(issue.getLanguage()).isEqualTo("java");
     assertThat(issue.getSeverity()).isEqualTo("BLOCKER");
index 798a1eb398bb4b9b21ec356dedafcc60a1d2e4aa..c6aae18497da63ca04ac2f9c47ebd0c395e95a99 100644 (file)
@@ -13,8 +13,8 @@
   <issues
       id="101"
       kee="FGHI"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="501"
       severity="CRITICAL"
       manual_severity="[true]"
index 36efd6773128d7c9209e526388b928d718305000..12bf28931c08efa86c34680c6a202452875f9a05 100644 (file)
@@ -1,10 +1,13 @@
 <dataset>
 
   <!-- Multi module project -->
-  <projects id="399" kee="struts" root_id="[null]" qualifier="TRK" scope="PRJ" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." path="[null]"/>
-  <projects id="400" kee="struts-core" root_id="399" qualifier="BRC" scope="PRJ" uuid="BCDE" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD.BCDE."
+  <projects id="399" kee="struts" root_id="[null]" qualifier="TRK" scope="PRJ" uuid="ABCD" project_uuid="ABCD"
+            module_uuid="[null]" module_uuid_path="." path="[null]"/>
+  <projects id="400" kee="struts-core" root_id="399" qualifier="BRC" scope="PRJ" uuid="BCDE" project_uuid="ABCD"
+            module_uuid="ABCD" module_uuid_path=".ABCD.BCDE."
             path="struts-core"/>
-  <projects id="401" kee="Action.java" root_id="400" qualifier="CLA" scope="PRJ" uuid="CDEF" project_uuid="ABCD" module_uuid="BCDE" module_uuid_path=".ABCD.BCDE."
+  <projects id="401" kee="Action.java" root_id="400" qualifier="CLA" scope="PRJ" uuid="CDEF" project_uuid="ABCD"
+            module_uuid="BCDE" module_uuid_path=".ABCD.BCDE."
             path="src/main/java/Action.java"/>
 
   <rules id="500" tags="[null]" system_tags="[null]" plugin_rule_key="AvoidCycle" plugin_name="squid" language="java"/>
@@ -13,8 +16,8 @@
   <issues
       id="100"
       kee="EFGH"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
index 5060b24c26b3838d51da1de46066efa3ae53dd04..88c1fd254946d673a06e427ddc40d01fa1dbb35a 100644 (file)
@@ -7,10 +7,8 @@
           technical_debt="10"
           message="[null]"
           line="5000"
-          component_id="100"
           component_uuid="BCDE"
           project_uuid="ABCD"
-          root_component_id="10"
           rule_id="200"
           created_at="1000000000"
           updated_at="1000000000"
index 4015eba96a7d7f98e3606fc00b835faab808d810..68bff9c4b09a9e1350d8e80f00bb254bf2cabd9b 100644 (file)
           technical_debt="10"
           message="[null]"
           line="5000"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="10"
+          component_uuid="BCDE"
+          project_uuid="CDEF"
           rule_id="200"
           created_at="1000000000"
           updated_at="2000000000"
index 259a311ea36312a064081c4ebb48fb5635bc398c..ae407238d7e442dc96bea7011003da02a0864881 100644 (file)
           technical_debt="[null]"
           message="[null]"
           line="3000"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="10"
+          component_uuid="BCDE"
+          project_uuid="ABCD"
           rule_id="200"
           created_at="1000000000"
           updated_at="1000000000"
@@ -32,5 +30,5 @@
           issue_creation_date="2010-01-01"
           issue_update_date="2010-02-02"
           issue_close_date="[null]"
-    />
+      />
 </dataset>
index b9421a4cb4c5869f2ad881443003eb8e287324b1..6d6767134350396c4d01928174ed99f50640928a 100644 (file)
@@ -3,8 +3,8 @@
   <issues
       id="100"
       kee="ABCDE"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
index 21284a7aa0b2f51869b062f422feca88a35658dd..fef3faebe50766e996ec121103f0847825c1ae94 100644 (file)
@@ -3,8 +3,8 @@
   <issues
       id="100"
       kee="ABCDE"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
index 2a8b878b60ee6ef4666330348f5f5339db037bd5..c661584c6d371e85e2d18a20bdcb473dd00d761d 100644 (file)
@@ -2,10 +2,8 @@
   <issues
       id="100"
       kee="ABCDE"
-      component_id="123"
       component_uuid="component-uuid"
       project_uuid="project-uuid"
-      root_component_id="100"
       rule_id="200"
       severity="BLOCKER"
       manual_severity="[false]"
index cf95656f2a1a9669e9d40d8b75e792553fa09232..7ea5e75f18c29dddfbc4f00a03168a248e51c057 100644 (file)
@@ -4,8 +4,8 @@
   <issues
       id="100"
       kee="100"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -30,8 +30,8 @@
   <issues
       id="101"
       kee="101"
-      component_id="402"
-      root_component_id="399"
+      component_uuid="DEFG"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
@@ -56,8 +56,8 @@
   <issues
       id="102"
       kee="102"
-      component_id="402"
-      root_component_id="399"
+      component_uuid="DEFG"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
@@ -82,8 +82,8 @@
   <issues
       id="103"
       kee="103"
-      component_id="400"
-      root_component_id="399"
+      component_uuid="BCDE"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
   <issues
       id="104"
       kee="104"
-      component_id="399"
-      root_component_id="399"
+      component_uuid="ABCD"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
   <issues
       id="1000"
       kee="1000"
-      component_id="1001"
-      root_component_id="1000"
+      component_uuid="EDCB"
+      project_uuid="DBCA"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[true]"
index cf95656f2a1a9669e9d40d8b75e792553fa09232..7ea5e75f18c29dddfbc4f00a03168a248e51c057 100644 (file)
@@ -4,8 +4,8 @@
   <issues
       id="100"
       kee="100"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -30,8 +30,8 @@
   <issues
       id="101"
       kee="101"
-      component_id="402"
-      root_component_id="399"
+      component_uuid="DEFG"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
@@ -56,8 +56,8 @@
   <issues
       id="102"
       kee="102"
-      component_id="402"
-      root_component_id="399"
+      component_uuid="DEFG"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
@@ -82,8 +82,8 @@
   <issues
       id="103"
       kee="103"
-      component_id="400"
-      root_component_id="399"
+      component_uuid="BCDE"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
   <issues
       id="104"
       kee="104"
-      component_id="399"
-      root_component_id="399"
+      component_uuid="ABCD"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
   <issues
       id="1000"
       kee="1000"
-      component_id="1001"
-      root_component_id="1000"
+      component_uuid="EDCB"
+      project_uuid="DBCA"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[true]"
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/update-result.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/update-result.xml
new file mode 100644 (file)
index 0000000..ba77751
--- /dev/null
@@ -0,0 +1,29 @@
+<dataset>
+  <issues
+      id="100"
+      kee="ABCDE"
+      component_uuid="123"
+      project_uuid="101"
+      rule_id="200"
+      severity="BLOCKER"
+      manual_severity="[false]"
+      message="the message"
+      line="500"
+      effort_to_fix="3.14"
+      technical_debt="10"
+      status="RESOLVED"
+      resolution="FIXED"
+      checksum="123456789"
+      reporter="emmerik"
+      author_login="morgan"
+      assignee="karadoc"
+      issue_attributes="JIRA=FOO-1234"
+      tags="[null]"
+      issue_creation_date="2013-05-18"
+      issue_update_date="2013-05-19"
+      issue_close_date="2013-05-20"
+      created_at="1400000000000"
+      updated_at="1450000000000"
+      action_plan_key="current_sprint"
+      />
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/update.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/db/IssueDaoTest/update.xml
new file mode 100644 (file)
index 0000000..9c41f19
--- /dev/null
@@ -0,0 +1,28 @@
+<dataset>
+  <issues
+      id="100"
+      kee="ABCDE"
+      component_uuid="123"
+      project_uuid="100"
+      rule_id="200"
+      severity="INFO"
+      manual_severity="[false]"
+      message="old"
+      line="[null]"
+      effort_to_fix="[null]"
+      technical_debt="[null]"
+      status="OPEN"
+      resolution="[null]"
+      checksum="[null]"
+      reporter="[null]"
+      author_login="[null]"
+      assignee="[null]"
+      issue_attributes="[null]"
+      issue_creation_date="[null]"
+      issue_update_date="[null]"
+      issue_close_date="[null]"
+      created_at="1400000000000"
+      updated_at="1400000000000"
+      action_plan_key="[null]"
+      />
+</dataset>
index 791b02efb2b5a386848a98d7507ca0631f0710b5..fc04143b52257f826ef23fb3d7dafc678a3dbfef 100644 (file)
@@ -5,7 +5,8 @@
   <projects id="10" scope="PRJ" qualifier="TRK" kee="the_project" name="TheProject"
             uuid="THE_PROJECT" module_uuid="[null]" module_uuid_path="." path="[null]"/>
   <projects id="11" scope="FIL" qualifier="FIL" kee="abcde" name="TheFile"
-            uuid="THE_FILE" module_uuid="THE_PROJECT" module_uuid_path=".THE_PROJECT." path="src/main/java/TheFile.java"/>
+            uuid="THE_FILE" module_uuid="THE_PROJECT" module_uuid_path=".THE_PROJECT."
+            path="src/main/java/TheFile.java"/>
 
   <issues id="1"
           kee="ABCDE"
@@ -20,8 +21,8 @@
           technical_debt="[null]"
           message="[null]"
           line="444"
-          component_id="11"
-          root_component_id="10"
+          component_uuid="THE_FILE"
+          project_uuid="THE_PROJECT"
           rule_id="1"
           reporter="[null]"
           issue_attributes="JIRA=http://jira.com"
@@ -31,5 +32,5 @@
           issue_creation_date="2005-05-12 00:00:00.0"
           issue_update_date="2013-05-18 00:00:00.0"
           issue_close_date="[null]"
-    />
+      />
 </dataset>
index 47fc2609e1e4df8870a5856137ad47105c693544..fc425638e3dba2f672daa4487fdaabee6adce420 100644 (file)
@@ -20,8 +20,8 @@
       technical_debt="10"
       message="[null]"
       line="444"
-      component_id="100"
-      root_component_id="10"
+      component_uuid="FILE1"
+      project_uuid="PROJECT1"
       rule_id="200"
       reporter="[null]"
       issue_attributes="JIRA=http://jira.com"
@@ -47,8 +47,8 @@
       technical_debt="15"
       message="[null]"
       line="444"
-      component_id="101"
-      root_component_id="10"
+      component_uuid="ROOT_FILE1"
+      project_uuid="PROJECT1"
       rule_id="200"
       reporter="[null]"
       issue_attributes="JIRA=http://jira.com"
@@ -74,8 +74,8 @@
       technical_debt="15"
       message="[null]"
       line="444"
-      component_id="10"
-      root_component_id="10"
+      component_uuid="PROJECT1"
+      project_uuid="PROJECT1"
       rule_id="200"
       reporter="[null]"
       issue_attributes="JIRA=http://jira.com"
index d6f9ba9209815aff2a981babb45182ea6b76be90..e3e8b7c52f298ff43a6c9c78539eb4524265ad2e 100644 (file)
@@ -19,8 +19,8 @@
     technical_debt="10"
     message="[null]"
     line="444"
-    component_id="100"
-    root_component_id="10"
+    component_uuid="FILE1"
+    project_uuid="PROJECT1"
     rule_id="200"
     reporter="[null]"
     issue_attributes="JIRA=http://jira.com"
@@ -46,8 +46,8 @@
     technical_debt="15"
     message="[null]"
     line="444"
-    component_id="100"
-    root_component_id="10"
+    component_uuid="FILE1"
+    project_uuid="PROJECT1"
     rule_id="200"
     reporter="[null]"
     issue_attributes="JIRA=http://jira.com"
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/773_remove_issue_component_ids.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/773_remove_issue_component_ids.rb
new file mode 100644 (file)
index 0000000..123c155
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# SonarQube is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+#
+
+#
+# SonarQube 5.1
+#
+class RemoveIssueComponentIds < ActiveRecord::Migration
+
+  def self.up
+    remove_index 'issues', :name => 'issues_component_id'
+    remove_index 'issues', :name => 'issues_root_component_id'
+    remove_column 'issues', 'component_id'
+    remove_column 'issues', 'root_component_id'
+    change_column 'issues', :component_uuid, :string, :limit => 50, :null => false
+    change_column 'issues', :project_uuid, :string, :limit => 50, :null => false
+  end
+end
index 043507a6db4c168d18087595dd78b838be5b4b20..975b313e3abb1180311eff02858c1262c950947b 100644 (file)
@@ -47,12 +47,7 @@ import org.sonar.batch.scan.filesystem.InputPathCache;
 import org.sonar.batch.user.User;
 import org.sonar.batch.user.UserRepository;
 
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
+import java.io.*;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Set;
@@ -80,7 +75,7 @@ public class JSONReport implements Reporter {
   private final UserRepository userRepository;
 
   public JSONReport(Settings settings, FileSystem fileSystem, Server server, ActiveRules activeRules, IssueCache issueCache,
-    Project rootModule, InputPathCache fileCache, UserRepository userRepository) {
+                    Project rootModule, InputPathCache fileCache, UserRepository userRepository) {
     this.settings = settings;
     this.fileSystem = fileSystem;
     this.server = server;
index c9e317ec9dfe57f3dde6a46d013624f6bddf33e6..cab746aa79b78445ee34ede406a9a7741fd0f2bb 100644 (file)
@@ -72,11 +72,11 @@ public class DefaultPurgeTask implements PurgeTask {
   @Override
   public DefaultPurgeTask purge(long resourceId) {
     long start = System.currentTimeMillis();
-    String resourceQualifier = resourceDao.getResource(resourceId).getQualifier();
-    if (isNotViewNorSubview(resourceQualifier)) {
+    ResourceDto component = resourceDao.getResource(resourceId);
+    if (isNotViewNorSubview(component.getQualifier())) {
       profiler.reset();
       cleanHistoricalData(resourceId);
-      doPurge(resourceId);
+      doPurge(new IdUuidPair(component.getId(), component.getUuid()));
       if (settings.getBoolean(CoreProperties.PROFILING_LOG_PROPERTY)) {
         long duration = System.currentTimeMillis() - start;
         LOG.info("\n -------- Profiling for purge: " + TimeUtils.formatDuration(duration) + " --------\n");
@@ -96,16 +96,16 @@ public class DefaultPurgeTask implements PurgeTask {
     }
   }
 
-  private void doPurge(long resourceId) {
+  private void doPurge(IdUuidPair componentIdUuid) {
     try {
-      purgeDao.purge(newPurgeConfigurationOnResource(resourceId), PurgeListener.EMPTY);
+      purgeDao.purge(newPurgeConfigurationOnResource(componentIdUuid), PurgeListener.EMPTY);
     } catch (Exception e) {
       // purge errors must not fail the report analysis
-      LOG.error("Fail to purge data [id=" + resourceId + "]", e);
+      LOG.error("Fail to purge data [id=" + componentIdUuid + "]", e);
     }
   }
 
-  public PurgeConfiguration newPurgeConfigurationOnResource(long resourceId) {
-    return newDefaultPurgeConfiguration(settings, resourceId);
+  public PurgeConfiguration newPurgeConfigurationOnResource(IdUuidPair componentIdUuid) {
+    return newDefaultPurgeConfiguration(settings, componentIdUuid);
   }
 }
index 4b0b0db2ba665ac92f0961e122279f603751c317..d683a64cc11b36c79002077ebf86667954524c68 100644 (file)
@@ -37,7 +37,6 @@ import org.sonar.core.rule.RuleDto;
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
-
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Date;
@@ -53,8 +52,8 @@ public final class IssueDto implements Serializable {
 
   private Long id;
   private String kee;
-  private Long componentId;
-  private Long projectId;
+  private String componentUuid;
+  private String projectUuid;
   private Integer ruleId;
   private String severity;
   private boolean manualSeverity;
@@ -88,11 +87,9 @@ public final class IssueDto implements Serializable {
   private String ruleRepo;
   private String language;
   private String componentKey;
-  private String componentUuid;
   private String moduleUuid;
   private String moduleUuidPath;
   private String projectKey;
-  private String projectUuid;
   private String filePath;
   private String tags;
 
@@ -118,12 +115,7 @@ public final class IssueDto implements Serializable {
     return this;
   }
 
-  public Long getComponentId() {
-    return componentId;
-  }
-
   public IssueDto setComponent(ComponentDto component) {
-    this.componentId = component.getId();
     this.componentKey = component.getKey();
     this.componentUuid = component.uuid();
     this.moduleUuid = component.moduleUuid();
@@ -132,33 +124,12 @@ public final class IssueDto implements Serializable {
     return this;
   }
 
-  /**
-   * please use setComponent(ComponentDto component)
-   */
-  public IssueDto setComponentId(Long componentId) {
-    this.componentId = componentId;
-    return this;
-  }
-
-  public Long getProjectId() {
-    return projectId;
-  }
-
   public IssueDto setProject(ComponentDto project) {
-    this.projectId = project.getId();
     this.projectKey = project.getKey();
     this.projectUuid = project.uuid();
     return this;
   }
 
-  /**
-   * please use setProject
-   */
-  public IssueDto setProjectId(Long projectId) {
-    this.projectId = projectId;
-    return this;
-  }
-
   public Integer getRuleId() {
     return ruleId;
   }
@@ -433,7 +404,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setRule(org.sonar.core.rule.RuleDto)} instead
    */
   public IssueDto setRuleKey(String repo, String rule) {
@@ -444,7 +415,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setRule(org.sonar.core.rule.RuleDto)} instead
    */
   public IssueDto setLanguage(String language) {
@@ -454,7 +425,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setComponent(org.sonar.core.component.ComponentDto)} instead
    */
   public IssueDto setComponentKey(String componentKey) {
@@ -464,7 +435,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setComponent(org.sonar.core.component.ComponentDto)} instead
    */
   public IssueDto setComponentUuid(@Nullable String componentUuid) {
@@ -474,7 +445,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setComponent(org.sonar.core.component.ComponentDto)} instead
    */
   public IssueDto setModuleUuid(@Nullable String moduleUuid) {
@@ -484,7 +455,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setComponent(org.sonar.core.component.ComponentDto)} instead
    */
   public IssueDto setModuleUuidPath(@Nullable String moduleUuidPath) {
@@ -494,7 +465,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setProject(org.sonar.core.component.ComponentDto)} instead
    */
   public IssueDto setProjectKey(String projectKey) {
@@ -504,7 +475,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setProject(org.sonar.core.component.ComponentDto)} instead
    */
   public IssueDto setProjectUuid(@Nullable String projectUuid) {
@@ -514,7 +485,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setProject(org.sonar.core.component.ComponentDto)} instead
    */
   public String getFilePath() {
@@ -523,7 +494,7 @@ public final class IssueDto implements Serializable {
 
   /**
    * Should only be used to persist in E/S
-   *
+   * <p/>
    * Please use {@link #setProject(org.sonar.core.component.ComponentDto)} instead
    */
   public IssueDto setFilePath(String filePath) {
@@ -561,7 +532,7 @@ public final class IssueDto implements Serializable {
   /**
    * On batch side, component keys and uuid are useless
    */
-  public static IssueDto toDtoForComputationInsert(DefaultIssue issue, long componentId, long projectId, int ruleId, long now) {
+  public static IssueDto toDtoForComputationInsert(DefaultIssue issue, int ruleId, long now) {
     return new IssueDto()
       .setKee(issue.key())
       .setLine(issue.line())
@@ -579,13 +550,11 @@ public final class IssueDto implements Serializable {
       .setRuleKey(issue.ruleKey().repository(), issue.ruleKey().rule())
       .setTags(issue.tags())
       .setComponentUuid(issue.componentUuid())
-      .setComponentId(componentId)
       .setComponentKey(issue.componentKey())
       .setModuleUuid(issue.moduleUuid())
       .setModuleUuidPath(issue.moduleUuidPath())
       .setComponentUuid(issue.componentUuid())
       .setProjectUuid(issue.projectUuid())
-      .setProjectId(projectId)
       .setProjectKey(issue.projectKey())
       .setActionPlanKey(issue.actionPlanKey())
       .setIssueAttributes(KeyValueFormat.format(issue.attributes()))
@@ -604,12 +573,12 @@ public final class IssueDto implements Serializable {
    * On server side, we need component keys and uuid
    */
   public static IssueDto toDtoForServerInsert(DefaultIssue issue, ComponentDto component, ComponentDto project, int ruleId, long now) {
-    return toDtoForComputationInsert(issue, component.getId(), project.getId(), ruleId, now)
+    return toDtoForComputationInsert(issue, ruleId, now)
       .setComponent(component)
       .setProject(project);
   }
 
-  public static IssueDto toDtoForUpdate(DefaultIssue issue, Long rootComponentId, long now) {
+  public static IssueDto toDtoForUpdate(DefaultIssue issue, long now) {
     // Invariant fields, like key and rule, can't be updated
     return new IssueDto()
       .setKee(issue.key())
@@ -635,13 +604,12 @@ public final class IssueDto implements Serializable {
       .setModuleUuidPath(issue.moduleUuidPath())
       .setProjectUuid(issue.projectUuid())
       .setProjectKey(issue.projectKey())
-      .setProjectId(rootComponentId)
       .setIssueCreationDate(issue.creationDate())
       .setIssueCloseDate(issue.closeDate())
       .setIssueUpdateDate(issue.updateDate())
       .setSelectedAt(issue.selectedAt())
 
-      // technical date
+        // technical date
       .setUpdatedAt(now);
   }
 
@@ -659,7 +627,6 @@ public final class IssueDto implements Serializable {
     issue.setAssignee(assignee);
     issue.setAttributes(KeyValueFormat.parse(Objects.firstNonNull(issueAttributes, "")));
     issue.setComponentKey(componentKey);
-    issue.setComponentId(componentId);
     issue.setComponentUuid(componentUuid);
     issue.setModuleUuid(moduleUuid);
     issue.setModuleUuidPath(moduleUuidPath);
@@ -681,7 +648,7 @@ public final class IssueDto implements Serializable {
 
   public static IssueDto createFor(Project project, RuleDto rule) {
     return new IssueDto()
-      .setProjectId(Long.valueOf(project.getId()))
+      .setProjectUuid(project.getUuid())
       .setRuleId(rule.getId())
       .setKee(Uuids.create());
   }
index 6ce04317fb0927ad0188ac2829517b3266bcfd30..5c4457e3637667b359a97ad5ec53defa01dad26a 100644 (file)
@@ -38,7 +38,7 @@ public class UpdateConflictResolver {
     IssueDto dbIssue = mapper.selectByKey(issue.key());
     if (dbIssue != null) {
       mergeFields(dbIssue, issue);
-      mapper.update(IssueDto.toDtoForUpdate(issue, dbIssue.getProjectId(), System.currentTimeMillis()));
+      mapper.update(IssueDto.toDtoForUpdate(issue, System.currentTimeMillis()));
     }
   }
 
index f51fae850ba887c7cfa4c8ca6fad8ace85e66590..fbb2b1be49f8487f77397d1a4a1a6093a7a00147 100644 (file)
@@ -33,7 +33,7 @@ import java.util.List;
  */
 public class DatabaseVersion implements BatchComponent, ServerComponent {
 
-  public static final int LAST_VERSION = 772;
+  public static final int LAST_VERSION = 773;
 
   /**
    * List of all the tables.n
index 8b1cbf45992ad91681c1fc3219a79a2fa130b24f..e9996cf7201d8884fc928c433e3c21276deaa50c 100644 (file)
@@ -34,10 +34,10 @@ import java.io.File;
 import java.sql.SQLException;
 
 public class PreviewDatabaseFactory implements ServerComponent {
+  public static final String H2_FILE_SUFFIX = ".h2.db";
   private static final String DIALECT = "h2";
   private static final String DRIVER = "org.h2.Driver";
   private static final String URL = "jdbc:h2:";
-  public static final String H2_FILE_SUFFIX = ".h2.db";
   private static final String SONAR = "sonar";
   private static final String USER = SONAR;
   private static final String PASSWORD = SONAR;
@@ -111,7 +111,7 @@ public class PreviewDatabaseFactory implements ServerComponent {
         .append(" INNER JOIN (")
         .append(projectQuery(projectId, true))
         .append(") resources")
-        .append(" ON issues.component_id=resources.id")
+        .append(" ON issues.component_uuid=resources.uuid")
         .append(" AND status <> '").append(Issue.STATUS_CLOSED).append("'");
       template.copyTable(source, dest, "issues", issueQuery.toString());
     }
@@ -119,12 +119,12 @@ public class PreviewDatabaseFactory implements ServerComponent {
 
   private String projectQuery(Long projectId, boolean returnOnlyIds) {
     return new StringBuilder()
-      .append("SELECT p.").append(returnOnlyIds ? "id" : "*")
+      .append("SELECT p.").append(returnOnlyIds ? "id, p.uuid" : "*")
       .append(" FROM projects p INNER JOIN snapshots s ON p.id = s.project_id")
       .append(" WHERE s.islast=").append(database.getDialect().getTrueSqlValue())
       .append(" AND s.root_project_id=").append(projectId)
       .append(" UNION")
-      .append(" SELECT p.").append(returnOnlyIds ? "id" : "*")
+      .append(" SELECT p.").append(returnOnlyIds ? "id, p.uuid" : "*")
       .append(" FROM projects p")
       .append(" WHERE p.id=").append(projectId)
       .append(" OR p.root_id=").append(projectId).toString();
index 1ad2939d07367a8e13268752119171856cae4c3c..856072a24838c8c4c047d942cd02f29063c67aee 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.sonar.core.purge;
 
+import com.google.common.base.Function;
 import com.google.common.collect.Lists;
 
 import java.util.List;
@@ -29,22 +30,20 @@ public class IdUuidPairs {
   }
 
   public static List<Long> ids(List<IdUuidPair> pairs) {
-    List<Long> ids = Lists.newArrayList();
-
-    for (IdUuidPair idUuidPair : pairs) {
-      ids.add(idUuidPair.getId());
-    }
-
-    return ids;
+    return Lists.transform(pairs, new Function<IdUuidPair, Long>() {
+      @Override
+      public Long apply(IdUuidPair pair) {
+        return pair.getId();
+      }
+    });
   }
 
-  public static List<String> uuids(List<IdUuidPair> idUuidPairList) {
-    List<String> uuids = Lists.newArrayList();
-
-    for (IdUuidPair idUuidPair : idUuidPairList) {
-      uuids.add(idUuidPair.getUuid());
-    }
-
-    return uuids;
+  public static List<String> uuids(List<IdUuidPair> pairs) {
+    return Lists.transform(pairs, new Function<IdUuidPair, String>() {
+      @Override
+      public String apply(IdUuidPair pair) {
+        return pair.getUuid();
+      }
+    });
   }
 }
index 546cf8c3d333960142085df0672372a2a619c24d..687788e415dce3e48b027c75ea159af544a396bb 100644 (file)
@@ -49,104 +49,105 @@ class PurgeCommands {
     return purgeMapper.selectSnapshotIds(query);
   }
 
-  void deleteResources(List<Long> resourceIds) {
-    List<List<Long>> resourceIdsPartition = Lists.partition(resourceIds, MAX_RESOURCES_PER_QUERY);
+  void deleteResources(List<IdUuidPair> componentIdUuids) {
+    List<List<Long>> componentIdPartitions = Lists.partition(IdUuidPairs.ids(componentIdUuids), MAX_RESOURCES_PER_QUERY);
+    List<List<String>> componentUuidsPartitions = Lists.partition(IdUuidPairs.uuids(componentIdUuids), MAX_RESOURCES_PER_QUERY);
     // Note : do not merge the delete statements into a single loop of resource ids. It's
     // voluntarily grouped by tables in order to benefit from JDBC batch mode.
     // Batch requests can only relate to the same PreparedStatement.
 
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       deleteSnapshots(purgeMapper.selectSnapshotIdsByResource(partResourceIds));
     }
 
     // possible missing optimization: filter requests according to resource scope
 
     profiler.start("deleteResourceLinks (project_links)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResourceLinks(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteResourceProperties (properties)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResourceProperties(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteResourceIndex (resource_index)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResourceIndex(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteResourceGroupRoles (group_roles)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResourceGroupRoles(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteResourceUserRoles (user_roles)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResourceUserRoles(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteResourceManualMeasures (manual_measures)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResourceManualMeasures(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
-    profiler.start("deleteResourceIssueChanges (issue_changes)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
-      purgeMapper.deleteResourceIssueChanges(partResourceIds);
+    profiler.start("deleteComponentIssueChanges (issue_changes)");
+    for (List<String> componentUuidPartition : componentUuidsPartitions) {
+      purgeMapper.deleteComponentIssueChanges(componentUuidPartition);
     }
     session.commit();
     profiler.stop();
 
-    profiler.start("deleteResourceIssues (issues)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
-      purgeMapper.deleteResourceIssues(partResourceIds);
+    profiler.start("deleteComponentIssues (issues)");
+    for (List<String> componentUuidPartition : componentUuidsPartitions) {
+      purgeMapper.deleteComponentIssues(componentUuidPartition);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteResourceActionPlans (action_plans)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResourceActionPlans(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteResourceEvents (events)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResourceEvents(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteResourceGraphs (graphs)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResourceGraphs(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteResource (projects)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteResource(partResourceIds);
     }
     session.commit();
     profiler.stop();
 
     profiler.start("deleteAuthors (authors)");
-    for (List<Long> partResourceIds : resourceIdsPartition) {
+    for (List<Long> partResourceIds : componentIdPartitions) {
       purgeMapper.deleteAuthors(partResourceIds);
     }
     session.commit();
index 772d3670c880063236da7cac14485afca9e20eb3..ba0248ff139d4d4a240865c32e7d0695bd1910cf 100644 (file)
@@ -27,38 +27,37 @@ import org.sonar.api.utils.System2;
 import org.sonar.core.computation.dbcleaner.DbCleanerConstants;
 
 import javax.annotation.CheckForNull;
-
 import java.util.Date;
 
 public class PurgeConfiguration {
 
-  private final long rootProjectId;
+  private final IdUuidPair rootProjectIdUuid;
   private final String[] scopesWithoutHistoricalData;
   private final int maxAgeInDaysOfClosedIssues;
   private final System2 system2;
 
-  public PurgeConfiguration(long rootProjectId, String[] scopesWithoutHistoricalData, int maxAgeInDaysOfClosedIssues) {
+  public PurgeConfiguration(IdUuidPair rootProjectId, String[] scopesWithoutHistoricalData, int maxAgeInDaysOfClosedIssues) {
     this(rootProjectId, scopesWithoutHistoricalData, maxAgeInDaysOfClosedIssues, System2.INSTANCE);
   }
 
   @VisibleForTesting
-  PurgeConfiguration(long rootProjectId, String[] scopesWithoutHistoricalData, int maxAgeInDaysOfClosedIssues, System2 system2) {
-    this.rootProjectId = rootProjectId;
+  PurgeConfiguration(IdUuidPair rootProjectId, String[] scopesWithoutHistoricalData, int maxAgeInDaysOfClosedIssues, System2 system2) {
+    this.rootProjectIdUuid = rootProjectId;
     this.scopesWithoutHistoricalData = scopesWithoutHistoricalData;
     this.maxAgeInDaysOfClosedIssues = maxAgeInDaysOfClosedIssues;
     this.system2 = system2;
   }
 
-  public static PurgeConfiguration newDefaultPurgeConfiguration(Settings settings, long resourceId) {
-    String[] scopes = new String[] {Scopes.FILE};
+  public static PurgeConfiguration newDefaultPurgeConfiguration(Settings settings, IdUuidPair idUuidPair) {
+    String[] scopes = new String[]{Scopes.FILE};
     if (settings.getBoolean(DbCleanerConstants.PROPERTY_CLEAN_DIRECTORY)) {
-      scopes = new String[] {Scopes.DIRECTORY, Scopes.FILE};
+      scopes = new String[]{Scopes.DIRECTORY, Scopes.FILE};
     }
-    return new PurgeConfiguration(resourceId, scopes, settings.getInt(DbCleanerConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES));
+    return new PurgeConfiguration(idUuidPair, scopes, settings.getInt(DbCleanerConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES));
   }
 
-  public long rootProjectId() {
-    return rootProjectId;
+  public IdUuidPair rootProjectIdUuid() {
+    return rootProjectIdUuid;
   }
 
   public String[] scopesWithoutHistoricalData() {
index 2e9b914d6055b6271669600ee17cae17d854fe77..656853059423f60523ba06989cfa6e3153c9d4ab 100644 (file)
@@ -68,7 +68,7 @@ public class PurgeDao {
   public void purge(DbSession session, PurgeConfiguration conf, PurgeListener purgeListener) {
     PurgeMapper mapper = session.getMapper(PurgeMapper.class);
     PurgeCommands commands = new PurgeCommands(session, mapper, profiler);
-    List<ResourceDto> projects = getProjects(conf.rootProjectId(), session);
+    List<ResourceDto> projects = getProjects(conf.rootProjectIdUuid().getId(), session);
     for (ResourceDto project : projects) {
       LOG.info("-> Clean " + project.getLongName() + " [id=" + project.getId() + "]");
       deleteAbortedBuilds(project, commands);
@@ -82,8 +82,8 @@ public class PurgeDao {
 
   private void deleteOldClosedIssues(PurgeConfiguration conf, PurgeMapper mapper) {
     Date toDate = conf.maxLiveDateOfClosedIssues();
-    mapper.deleteOldClosedIssueChanges(conf.rootProjectId(), toDate);
-    mapper.deleteOldClosedIssues(conf.rootProjectId(), toDate);
+    mapper.deleteOldClosedIssueChanges(conf.rootProjectIdUuid().getUuid(), toDate);
+    mapper.deleteOldClosedIssues(conf.rootProjectIdUuid().getUuid(), toDate);
   }
 
   private void deleteAbortedBuilds(ResourceDto project, PurgeCommands commands) {
@@ -91,7 +91,7 @@ public class PurgeDao {
       LOG.info("<- Delete aborted builds");
       PurgeSnapshotQuery query = PurgeSnapshotQuery.create()
         .setIslast(false)
-        .setStatus(new String[] {"U"})
+        .setStatus(new String[]{"U"})
         .setRootProjectId(project.getId());
       commands.deleteSnapshots(query);
     }
@@ -100,7 +100,7 @@ public class PurgeDao {
   private boolean hasAbortedBuilds(Long projectId, PurgeCommands commands) {
     PurgeSnapshotQuery query = PurgeSnapshotQuery.create()
       .setIslast(false)
-      .setStatus(new String[] {"U"})
+      .setStatus(new String[]{"U"})
       .setResourceId(projectId);
     return !commands.selectSnapshotIds(query).isEmpty();
   }
@@ -111,7 +111,7 @@ public class PurgeDao {
         .setResourceId(project.getId())
         .setIslast(false)
         .setNotPurged(true)
-      );
+    );
     for (final Long projectSnapshotId : projectSnapshotIds) {
       LOG.info("<- Clean snapshot " + projectSnapshotId);
       if (!ArrayUtils.isEmpty(scopesWithoutHistoricalData)) {
@@ -131,13 +131,13 @@ public class PurgeDao {
   }
 
   private void disableOrphanResources(final ResourceDto project, final SqlSession session, final PurgeMapper purgeMapper, final PurgeListener purgeListener) {
-    session.select("org.sonar.core.purge.PurgeMapper.selectResourceIdsToDisable", project.getId(), new ResultHandler() {
+    session.select("org.sonar.core.purge.PurgeMapper.selectComponentIdUuidsToDisable", project.getId(), new ResultHandler() {
       @Override
       public void handleResult(ResultContext resultContext) {
-        IdUuidPair resourceIdUuid = (IdUuidPair) resultContext.getResultObject();
-        if (resourceIdUuid.getId() != null) {
-          disableResource(resourceIdUuid, purgeMapper);
-          purgeListener.onComponentDisabling(resourceIdUuid.getUuid());
+        IdUuidPair componentIdUuid = (IdUuidPair) resultContext.getResultObject();
+        if (componentIdUuid.getId() != null) {
+          disableResource(componentIdUuid, purgeMapper);
+          purgeListener.onComponentDisabling(componentIdUuid.getUuid());
         }
       }
     });
@@ -167,7 +167,7 @@ public class PurgeDao {
     final DbSession session = mybatis.openSession(true);
     final PurgeMapper mapper = session.getMapper(PurgeMapper.class);
     try {
-      deleteProject(rootIdUuid.getId(), mapper, new PurgeCommands(session, profiler));
+      deleteProject(rootIdUuid, mapper, new PurgeCommands(session, profiler));
       deleteFileSources(rootIdUuid.getUuid(), new PurgeCommands(session, profiler));
       return this;
     } finally {
@@ -179,23 +179,23 @@ public class PurgeDao {
     commands.deleteFileSources(rootUuid);
   }
 
-  private void deleteProject(long rootProjectId, PurgeMapper mapper, PurgeCommands commands) {
-    List<Long> childrenIds = mapper.selectProjectIdsByRootId(rootProjectId);
-    for (Long childId : childrenIds) {
+  private void deleteProject(IdUuidPair rootProjectId, PurgeMapper mapper, PurgeCommands commands) {
+    List<IdUuidPair> childrenIdUuid = mapper.selectProjectIdUuidsByRootId(rootProjectId.getId());
+    for (IdUuidPair childId : childrenIdUuid) {
       deleteProject(childId, mapper, commands);
     }
 
-    List<Long> resourceIds = mapper.selectResourceIdsByRootId(rootProjectId);
-    commands.deleteResources(resourceIds);
+    List<IdUuidPair> componentIdUuids = mapper.selectComponentIdUuidsByRootId(rootProjectId.getId());
+    commands.deleteResources(componentIdUuids);
   }
 
-  private void disableResource(IdUuidPair resourceIdUuid, PurgeMapper mapper) {
-    long resourceId = resourceIdUuid.getId();
-    mapper.deleteResourceIndex(Arrays.asList(resourceId));
-    mapper.setSnapshotIsLastToFalse(resourceId);
-    mapper.deleteFileSourcesByUuid(resourceIdUuid.getUuid());
-    mapper.disableResource(resourceId);
-    mapper.resolveResourceIssuesNotAlreadyResolved(resourceId, new Date(system2.now()), system2.now());
+  private void disableResource(IdUuidPair componentIdUuid, PurgeMapper mapper) {
+    long componentId = componentIdUuid.getId();
+    mapper.deleteResourceIndex(Arrays.asList(componentId));
+    mapper.setSnapshotIsLastToFalse(componentId);
+    mapper.deleteFileSourcesByUuid(componentIdUuid.getUuid());
+    mapper.disableResource(componentId);
+    mapper.resolveResourceIssuesNotAlreadyResolved(componentIdUuid.getUuid(), new Date(system2.now()), system2.now());
   }
 
   public PurgeDao deleteSnapshots(PurgeSnapshotQuery query) {
index 54cffca45c36e1b95d37502a000d90618fd09971..c73cc86dd82fb879169246dbd4b833961ac3c562 100644 (file)
@@ -22,7 +22,6 @@ package org.sonar.core.purge;
 import org.apache.ibatis.annotations.Param;
 
 import javax.annotation.Nullable;
-
 import java.util.Date;
 import java.util.List;
 
@@ -32,7 +31,9 @@ public interface PurgeMapper {
 
   List<Long> selectSnapshotIdsByResource(@Param("resourceIds") List<Long> resourceIds);
 
-  List<Long> selectProjectIdsByRootId(long rootResourceId);
+  List<IdUuidPair> selectProjectIdUuidsByRootId(long rootResourceId);
+
+  List<IdUuidPair> selectComponentIdUuidsByRootId(long rootProjectId);
 
   void deleteSnapshot(@Param("snapshotIds") List<Long> snapshotIds);
 
@@ -58,7 +59,7 @@ public interface PurgeMapper {
 
   void disableResource(long resourceId);
 
-  void resolveResourceIssuesNotAlreadyResolved(@Param("resourceId") long resourceId, @Param("date") Date date, @Param("dateAsLong") Long dateAsLong);
+  void resolveResourceIssuesNotAlreadyResolved(@Param("componentUuid") String componentUuid, @Param("date") Date date, @Param("dateAsLong") Long dateAsLong);
 
   void deleteResourceIndex(@Param("resourceIds") List<Long> resourceIds);
 
@@ -90,15 +91,13 @@ public interface PurgeMapper {
 
   List<PurgeableSnapshotDto> selectPurgeableSnapshotsWithoutEvents(long resourceId);
 
-  List<Long> selectResourceIdsByRootId(long rootProjectId);
-
-  void deleteResourceIssueChanges(@Param("resourceIds") List<Long> resourceIds);
+  void deleteComponentIssueChanges(@Param("componentUuids") List<String> componentUuids);
 
-  void deleteResourceIssues(@Param("resourceIds") List<Long> resourceIds);
+  void deleteComponentIssues(@Param("componentUuids") List<String> componentUuids);
 
-  void deleteOldClosedIssueChanges(@Param("rootProjectId") long rootProjectId, @Nullable @Param("toDate") Date toDate);
+  void deleteOldClosedIssueChanges(@Param("projectUuid") String projectUuid, @Nullable @Param("toDate") Date toDate);
 
-  void deleteOldClosedIssues(@Param("rootProjectId") long rootProjectId, @Nullable @Param("toDate") Date toDate);
+  void deleteOldClosedIssues(@Param("projectUuid") String projectUuid, @Nullable @Param("toDate") Date toDate);
 
   void deleteFileSourcesByProjectUuid(String rootProjectUuid);
 
index c1cfc09fb36ccde279235c49dd04919491c22063..47d0bc96d717f57fed5bd942e328fe797f8b36b1 100644 (file)
@@ -48,8 +48,8 @@
     <include refid="issueChangeColumns"/>
     from issue_changes c
     inner join issues i on i.kee = c.issue_key
-    inner join (select p.id,p.kee from projects p where (p.root_id=#{componentId} and p.qualifier &lt;&gt; 'BRC') or
-    (p.id=#{componentId})) p on p.id=i.component_id
+    inner join (select p.id, p.uuid, p.kee from projects p where (p.root_id=#{componentId} and p.qualifier &lt;&gt; 'BRC') or
+    (p.id=#{componentId})) p on p.uuid=i.component_uuid
     <where>
       and c.change_type=#{changeType}
       and i.status &lt;&gt; 'CLOSED'
index 5ea815e5c94c96967f590915da5bea06c99524ff..8217084291ce489d186937ed9acbd3a5832fe384 100644 (file)
@@ -7,8 +7,6 @@
   <sql id="issueColumns">
     i.id,
     i.kee as kee,
-    i.component_id as componentId,
-    i.root_component_id as projectId,
     i.rule_id as ruleId,
     i.action_plan_key as actionPlanKey,
     i.severity as severity,
     r.plugin_name as ruleRepo,
     r.language as language,
     p.kee as componentKey,
-    p.uuid as componentUuid,
+    i.component_uuid as componentUuid,
     p.module_uuid as moduleUuid,
     p.module_uuid_path as moduleUuidPath,
     p.path as filePath,
     root.kee as projectKey,
-    root.uuid as projectUuid
+    i.project_uuid as projectUuid
   </sql>
 
   <sql id="sortColumn">
   </sql>
 
   <insert id="insert" parameterType="Issue" useGeneratedKeys="false" keyProperty="id">
-    INSERT INTO issues (kee, component_id, root_component_id, rule_id, action_plan_key, severity, manual_severity,
+    INSERT INTO issues (kee, rule_id, action_plan_key, severity, manual_severity,
     message, line, effort_to_fix, technical_debt, status, tags,
     resolution, checksum, reporter, assignee, author_login, issue_attributes, issue_creation_date, issue_update_date,
     issue_close_date, created_at, updated_at, component_uuid, project_uuid)
-    VALUES (#{kee,jdbcType=VARCHAR}, #{componentId,jdbcType=BIGINT}, #{projectId,jdbcType=BIGINT},
-    #{ruleId,jdbcType=INTEGER}, #{actionPlanKey,jdbcType=VARCHAR}, #{severity,jdbcType=VARCHAR},
+    VALUES (#{kee,jdbcType=VARCHAR}, #{ruleId,jdbcType=INTEGER}, #{actionPlanKey,jdbcType=VARCHAR},
+    #{severity,jdbcType=VARCHAR},
     #{manualSeverity,jdbcType=BOOLEAN}, #{message,jdbcType=VARCHAR}, #{line,jdbcType=INTEGER},
     #{effortToFix,jdbcType=DOUBLE}, #{debt,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR},
     #{tagsString,jdbcType=VARCHAR}, #{resolution,jdbcType=VARCHAR}, #{checksum,jdbcType=VARCHAR},
     assignee=#{assignee},
     author_login=#{authorLogin},
     tags=#{tagsString},
-    root_component_id=#{projectId},
     project_uuid=#{projectUuid},
     issue_attributes=#{issueAttributes},
     issue_creation_date=#{issueCreationDate},
     assignee=#{assignee},
     author_login=#{authorLogin},
     tags=#{tagsString},
-    root_component_id=#{projectId},
     project_uuid=#{projectUuid},
     issue_attributes=#{issueAttributes},
     issue_creation_date=#{issueCreationDate},
     <include refid="issueColumns"/>
     from issues i
     inner join rules r on r.id=i.rule_id
-    inner join projects p on p.id=i.component_id
-    inner join projects root on root.id=i.root_component_id
+    inner join projects p on p.uuid=i.component_uuid
+    inner join projects root on root.uuid=i.project_uuid
     where i.kee=#{kee}
   </select>
 
     select
     i.id,
     i.kee as kee,
-    i.component_id as componentId,
-    i.root_component_id as projectId,
     i.rule_id as ruleId,
     i.component_uuid as componentUuid,
     i.project_uuid as projectUuid,
     p.kee as componentKey,
     root.kee as projectKey
     from issues i
-    inner join (select p.id,p.kee from projects p where (p.root_id=#{id} and p.qualifier &lt;&gt; 'BRC') or
-    (p.id=#{id})) p on p.id=i.component_id
+    inner join (select p.id, p.uuid,p.kee from projects p where (p.root_id=#{id} and p.qualifier &lt;&gt; 'BRC') or
+    (p.id=#{id})) p on p.uuid=i.component_uuid
     inner join rules r on r.id=i.rule_id
-    left outer join projects root on root.id=i.root_component_id
+    left outer join projects root on root.uuid=i.project_uuid
     where i.status &lt;&gt; 'CLOSED'
   </select>
 
     r.plugin_name as ruleRepo,
     component.kee as componentKey
     FROM issues i
-    INNER JOIN (SELECT p.id,p.kee FROM projects p WHERE p.module_uuid=#{uuid} OR p.uuid=#{uuid}) component ON
-    component.id=i.component_id
+    INNER JOIN (SELECT p.id,p.uuid, p.kee FROM projects p WHERE p.module_uuid=#{uuid} OR p.uuid=#{uuid}) component ON
+    component.uuid=i.component_uuid
     INNER JOIN rules r ON r.id=i.rule_id
     WHERE i.status &lt;&gt; 'CLOSED'
   </select>
     r.plugin_name as ruleRepo,
     component.kee as componentKey
     FROM issues i
-    INNER JOIN projects component on component.id=i.component_id
-    INNER JOIN projects project on project.uuid=component.project_uuid AND project.uuid=#{uuid}
+    INNER JOIN projects component on component.uuid=i.component_uuid
     INNER JOIN rules r ON r.id=i.rule_id
-    WHERE i.status &lt;&gt; 'CLOSED'
+    WHERE i.status &lt;&gt; 'CLOSED' AND i.project_uuid=#{uuid}
   </select>
 
   <select id="selectByKeys" parameterType="map" resultType="Issue">
     <include refid="issueColumns"/>
     from issues i
     inner join rules r on r.id=i.rule_id
-    inner join projects p on p.id=i.component_id
-    inner join projects root on root.id=i.root_component_id
+    inner join projects p on p.uuid=i.component_uuid
+    inner join projects root on root.uuid=i.project_uuid
     where i.kee in
     <foreach collection="list" open="(" close=")" item="key" separator=",">
       #{key}
     <include refid="issueColumns"/>
     from issues i
     inner join rules r on r.id=i.rule_id
-    inner join projects p on p.id=i.component_id
-    inner join projects root on root.id=i.root_component_id
+    inner join projects p on p.uuid=i.component_uuid
+    inner join projects root on root.uuid=i.project_uuid
     <where>
       and i.action_plan_key=#{action_plan}
     </where>
     SELECT
     <include refid="org.sonar.core.rule.RuleMapper.selectColumns"/>
     FROM issues i
-    INNER JOIN projects p on p.id=i.component_id
+    INNER JOIN projects p on p.uuid=i.component_uuid
     INNER JOIN rules r on r.id=i.rule_id
     WHERE
     p.kee=#{componentKey}
   <select id="findSeveritiesByComponent" parameterType="String" resultType="String">
     SELECT i.severity
     FROM issues i
-    INNER JOIN projects on projects.id=i.component_id
+    INNER JOIN projects on projects.uuid=i.component_uuid
     INNER JOIN rules on rules.id=i.rule_id
     WHERE
     projects.kee=#{componentKey}
index 206704d1de61389cc5cbad6bbeedc9321fcd3a61..5fa95735f7c746f4c471188e01ea1398261dd017 100644 (file)
@@ -301,6 +301,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('769');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('770');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('771');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('772');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('773');
 
 INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null);
 ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
index 5e1b3a7521a1d416892e4846272672361e26d774..d30b14e1a7882ba650973a1f1aaf5b37da00623d 100644 (file)
@@ -442,10 +442,8 @@ CREATE TABLE "GRAPHS" (
 CREATE TABLE "ISSUES" (
   "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
   "KEE" VARCHAR(50) UNIQUE NOT NULL,
-  "COMPONENT_ID" INTEGER NOT NULL,
-  "COMPONENT_UUID" VARCHAR(50),
-  "ROOT_COMPONENT_ID" INTEGER,
-  "PROJECT_UUID" VARCHAR(50),
+  "COMPONENT_UUID" VARCHAR(50) NOT NULL,
+  "PROJECT_UUID" VARCHAR(50) NOT NULL,
   "RULE_ID" INTEGER,
   "SEVERITY" VARCHAR(10),
   "MANUAL_SEVERITY" BOOLEAN NOT NULL,
@@ -660,12 +658,8 @@ CREATE UNIQUE INDEX "GRAPHS_PERSPECTIVES" ON "GRAPHS" ("SNAPSHOT_ID", "PERSPECTI
 
 CREATE UNIQUE INDEX "ISSUES_KEE" ON "ISSUES" ("KEE");
 
-CREATE INDEX "ISSUES_COMPONENT_ID" ON "ISSUES" ("COMPONENT_ID");
-
 CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES" ("COMPONENT_UUID");
 
-CREATE INDEX "ISSUES_ROOT_COMPONENT_ID" ON "ISSUES" ("ROOT_COMPONENT_ID");
-
 CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES" ("PROJECT_UUID");
 
 CREATE INDEX "ISSUES_RULE_ID" ON "ISSUES" ("RULE_ID");
index c3464bee19688a4e9e121b3f7d0cedc5c7a21c4f..2bd8f7e9aaee75a05c15285ef0ce1da80f1ccb0b 100644 (file)
@@ -72,7 +72,7 @@
     not exists(select e.id from events e where e.snapshot_id=s.id)
   </select>
 
-  <select id="selectResourceIdsToDisable" resultType="IdUuidPair" parameterType="long">
+  <select id="selectComponentIdUuidsToDisable" resultType="IdUuidPair" parameterType="long">
     select p.id, p.uuid from projects p
     where (p.id=#{id} or p.root_id=#{id}) and p.enabled=${_true}
     and not exists(select s.project_id from snapshots s where s.islast=${_true} and s.project_id=p.id)
     select id from metrics where delete_historical_data=${_true}
   </select>
 
-  <select id="selectProjectIdsByRootId" resultType="long" parameterType="long">
-    select id from projects where root_id=#{id} and scope='PRJ'
+  <select id="selectProjectIdUuidsByRootId" resultType="IdUuidPair" parameterType="long">
+    select id, uuid from projects where root_id=#{id} and scope='PRJ'
   </select>
 
-  <select id="selectResourceIdsByRootId" resultType="long" parameterType="long">
-    select id from projects where root_id=#{id} or id=#{id}
+  <select id="selectComponentIdUuidsByRootId" resultType="IdUuidPair" parameterType="long">
+    select id, uuid from projects where root_id=#{id} or id=#{id}
   </select>
 
   <delete id="deleteSnapshotMeasures" parameterType="map">
   <update id="resolveResourceIssuesNotAlreadyResolved" parameterType="map">
     UPDATE issues SET status='CLOSED',resolution='REMOVED',updated_at=#{dateAsLong},issue_close_date=#{date},
     issue_update_date=#{date}
-    WHERE component_id=#{resourceId} AND resolution IS NULL
+    WHERE component_uuid=#{componentUuid} AND resolution IS NULL
   </update>
 
   <delete id="deleteResourceIndex" parameterType="map">
     update snapshots set islast=${_false} where project_id=#{id}
   </update>
 
-  <delete id="deleteResourceIssueChanges" parameterType="map">
+  <delete id="deleteComponentIssueChanges" parameterType="map">
     delete from issue_changes ic
-    where exists (select * from issues i where i.kee=ic.issue_key and i.component_id in
-    <foreach collection="resourceIds" open="(" close=")" item="resourceId" separator=",">
-      #{resourceId}
+    where exists (select * from issues i where i.kee=ic.issue_key and i.component_uuid in
+    <foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=",">
+      #{componentUuid}
     </foreach>
     )
   </delete>
 
   <!-- Mssql -->
-  <delete id="deleteResourceIssueChanges" databaseId="mssql" parameterType="map">
+  <delete id="deleteComponentIssueChanges" databaseId="mssql" parameterType="map">
     delete issue_changes from issue_changes
     inner join issues on issue_changes.issue_key=issues.kee
-    where issues.component_id in
-    <foreach collection="resourceIds" open="(" close=")" item="resourceId" separator=",">
-      #{resourceId}
+    where issues.component_uuid in
+    <foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=",">
+      #{componentUuid}
     </foreach>
   </delete>
 
   <!-- Mysql -->
-  <delete id="deleteResourceIssueChanges" databaseId="mysql" parameterType="map">
-    delete ic from issue_changes as ic, issues as i where ic.issue_key=i.kee and i.component_id in
-    <foreach collection="resourceIds" open="(" close=")" item="resourceId" separator=",">
-      #{resourceId}
+  <delete id="deleteComponentIssueChanges" databaseId="mysql" parameterType="map">
+    delete ic from issue_changes as ic, issues as i where ic.issue_key=i.kee and i.component_uuid in
+    <foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=",">
+      #{componentUuid}
     </foreach>
   </delete>
 
-  <delete id="deleteResourceIssues" parameterType="map">
-    delete from issues where component_id in
-    <foreach collection="resourceIds" open="(" close=")" item="resourceId" separator=",">
-      #{resourceId}
+  <delete id="deleteComponentIssues" parameterType="map">
+    delete from issues where component_uuid in
+    <foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=",">
+      #{componentUuid}
     </foreach>
   </delete>
 
     delete from issue_changes ic
     where exists (
     select * from issues i
-    where i.root_component_id=#{rootProjectId} and i.kee=ic.issue_key
+    where i.project_uuid=#{projectUuid} and i.kee=ic.issue_key
     <choose>
       <when test="toDate == null">
         and i.issue_close_date is not null
   <delete id="deleteOldClosedIssueChanges" databaseId="mssql" parameterType="map">
     delete issue_changes from issue_changes
     inner join issues on issue_changes.issue_key=issues.kee
-    where issues.root_component_id=#{rootProjectId}
+    where issues.project_uuid=#{projectUuid}
     <choose>
       <when test="toDate == null">
         and issues.issue_close_date is not null
   <delete id="deleteOldClosedIssueChanges" databaseId="mysql" parameterType="map">
     delete ic
     from issue_changes as ic, issues as i
-    where i.root_component_id=#{rootProjectId}
+    where i.project_uuid=#{projectUuid}
     and ic.issue_key=i.kee
     <choose>
       <when test="toDate == null">
 
   <delete id="deleteOldClosedIssues" parameterType="map">
     delete from issues
-    where root_component_id=#{rootProjectId}
+    where project_uuid=#{projectUuid}
     <choose>
       <when test="toDate == null">
         and issue_close_date is not null
index 1742a7e372909941cc16c90505d186860c34dd14..a65dda0382d28e4e9241aa623828eca49f148268 100644 (file)
@@ -29,8 +29,8 @@ import org.sonar.api.config.PropertyDefinitions;
 import org.sonar.api.config.Settings;
 import org.sonar.api.resources.Qualifiers;
 import org.sonar.api.resources.Scopes;
-import org.sonar.core.purge.*;
 import org.sonar.core.computation.dbcleaner.period.DefaultPeriodCleaner;
+import org.sonar.core.purge.*;
 import org.sonar.core.resource.ResourceDao;
 import org.sonar.core.resource.ResourceDto;
 
@@ -53,7 +53,7 @@ public class DefaultPurgeTaskTest {
   public void before() throws Exception {
     this.purgeDao = mock(PurgeDao.class);
     this.resourceDao = mock(ResourceDao.class);
-    when(resourceDao.getResource(anyLong())).thenReturn(new ResourceDto().setQualifier(Qualifiers.PROJECT));
+    when(resourceDao.getResource(anyLong())).thenReturn(new ResourceDto().setQualifier(Qualifiers.PROJECT).setUuid("1").setId(1L));
 
     this.settings = mock(Settings.class);
     this.periodCleaner = mock(DefaultPeriodCleaner.class);
@@ -75,7 +75,7 @@ public class DefaultPurgeTaskTest {
       @Override
       public boolean matches(Object o) {
         PurgeConfiguration conf = (PurgeConfiguration) o;
-        return conf.rootProjectId() == 1L && conf.scopesWithoutHistoricalData().length == 1 && conf.scopesWithoutHistoricalData()[0].equals(Scopes.FILE);
+        return conf.rootProjectIdUuid().getId() == 1L && conf.scopesWithoutHistoricalData().length == 1 && conf.scopesWithoutHistoricalData()[0].equals(Scopes.FILE);
       }
     }), any(PurgeListener.class));
   }
@@ -92,7 +92,7 @@ public class DefaultPurgeTaskTest {
       @Override
       public boolean matches(Object o) {
         PurgeConfiguration conf = (PurgeConfiguration) o;
-        return conf.rootProjectId() == 1L &&
+        return conf.rootProjectIdUuid().getId() == 1L &&
           conf.scopesWithoutHistoricalData().length == 2 &&
           conf.scopesWithoutHistoricalData()[0].equals(Scopes.DIRECTORY) &&
           conf.scopesWithoutHistoricalData()[1].equals(Scopes.FILE);
@@ -103,7 +103,7 @@ public class DefaultPurgeTaskTest {
   @Test
   public void shouldNotFailOnErrors() {
     PurgeDao purgeDao = mock(PurgeDao.class);
-    when(purgeDao.purge(any(PurgeConfiguration.class),any(PurgeListener.class))).thenThrow(new RuntimeException());
+    when(purgeDao.purge(any(PurgeConfiguration.class), any(PurgeListener.class))).thenThrow(new RuntimeException());
     DefaultPurgeTask task = new DefaultPurgeTask(purgeDao, resourceDao, new Settings(), mock(DefaultPeriodCleaner.class), mock(PurgeProfiler.class));
 
     task.purge(1L);
@@ -113,7 +113,7 @@ public class DefaultPurgeTaskTest {
 
   @Test
   public void shouldDumpProfiling() {
-    PurgeConfiguration conf = new PurgeConfiguration(1L, new String[0], 30);
+    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 30);
     PurgeDao purgeDao = mock(PurgeDao.class);
     when(purgeDao.purge(conf, PurgeListener.EMPTY)).thenThrow(new RuntimeException());
     Settings settings = new Settings(new PropertyDefinitions(DataCleanerProperties.all()));
index 70a3765d66cfe652652767410ca3897f63ca5d0d..785b52b7e67b932dc44ae5c75277f049846b56bc 100644 (file)
@@ -77,12 +77,10 @@ public class IssueDaoTest extends AbstractDaoTestCase {
     assertThat(issue.getRule()).isEqualTo("AvoidCycle");
     assertThat(issue.getComponentUuid()).isEqualTo("CDEF");
     assertThat(issue.getComponentKey()).isEqualTo("Action.java");
-    assertThat(issue.getComponentId()).isEqualTo(401);
     assertThat(issue.getModuleUuid()).isEqualTo("BCDE");
     assertThat(issue.getModuleUuidPath()).isEqualTo(".ABCD.BCDE.");
     assertThat(issue.getProjectKey()).isEqualTo("struts"); // ABCD
     assertThat(issue.getProjectUuid()).isEqualTo("ABCD"); // null
-    assertThat(issue.getProjectId()).isEqualTo(399);
   }
 
   @Test
index aee61d1fc0faf5c8847533af23361052594afed3..edac8a2dd84dec473b4ba8784ee87e08a97d1b8a 100644 (file)
@@ -64,12 +64,10 @@ public class IssueDtoTest {
       .setLanguage("xoo")
       .setComponentKey("org.sonar.sample:Sample")
       .setComponentUuid("CDEF")
+      .setProjectUuid("GHIJ")
       .setModuleUuid("BCDE")
       .setModuleUuidPath("ABCD.BCDE.")
-      .setProjectUuid("ABCD")
       .setProjectKey("org.sonar.sample")
-      .setComponentId(1l)
-      .setProjectId(1l)
       .setStatus(Issue.STATUS_CLOSED)
       .setResolution(Issue.RESOLUTION_FALSE_POSITIVE)
       .setEffortToFix(15.0)
@@ -91,11 +89,10 @@ public class IssueDtoTest {
     assertThat(issue.ruleKey().toString()).isEqualTo("squid:AvoidCycle");
     assertThat(issue.language()).isEqualTo("xoo");
     assertThat(issue.componentUuid()).isEqualTo("CDEF");
+    assertThat(issue.projectUuid()).isEqualTo("GHIJ");
     assertThat(issue.componentKey()).isEqualTo("org.sonar.sample:Sample");
-    assertThat(issue.componentId()).isEqualTo(1L);
     assertThat(issue.moduleUuid()).isEqualTo("BCDE");
     assertThat(issue.moduleUuidPath()).isEqualTo("ABCD.BCDE.");
-    assertThat(issue.projectUuid()).isEqualTo("ABCD");
     assertThat(issue.projectKey()).isEqualTo("org.sonar.sample");
     assertThat(issue.status()).isEqualTo(Issue.STATUS_CLOSED);
     assertThat(issue.resolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE);
index 86004c2bec921ae4e2144693d82799551e9d06e2..b09958301cf4678b7a1fa3323bfb05ef872847e7 100644 (file)
@@ -48,10 +48,8 @@ public class IssueMapperTest extends AbstractDaoTestCase {
   @Test
   public void insert() throws Exception {
     IssueDto dto = new IssueDto();
-    dto.setComponentId(123l);
-    dto.setComponentUuid("component-uuid");
-    dto.setProjectId(100l);
-    dto.setProjectUuid("project-uuid");
+    dto.setComponentUuid("uuid-123");
+    dto.setProjectUuid("uuid-100");
     dto.setRuleId(200);
     dto.setKee("ABCDE");
     dto.setLine(500);
@@ -85,9 +83,8 @@ public class IssueMapperTest extends AbstractDaoTestCase {
     setupData("testUpdate");
 
     IssueDto dto = new IssueDto();
-    dto.setComponentId(123l);
-    dto.setProjectId(101l);
-    dto.setProjectUuid("project-uuid-2");
+    dto.setComponentUuid("uuid-123");
+    dto.setProjectUuid("uuid-101");
     dto.setRuleId(200);
     dto.setKee("ABCDE");
     dto.setLine(500);
@@ -121,9 +118,8 @@ public class IssueMapperTest extends AbstractDaoTestCase {
     setupData("testUpdate");
 
     IssueDto dto = new IssueDto();
-    dto.setComponentId(123l);
-    dto.setProjectId(101l);
-    dto.setProjectUuid("project-uuid-2");
+    dto.setComponentUuid("uuid-123");
+    dto.setProjectUuid("uuid-101");
     dto.setRuleId(200);
     dto.setKee("ABCDE");
     dto.setLine(500);
@@ -160,9 +156,8 @@ public class IssueMapperTest extends AbstractDaoTestCase {
     setupData("updateBeforeSelectedDate_with_conflict");
 
     IssueDto dto = new IssueDto();
-    dto.setComponentId(123l);
-    dto.setProjectId(101l);
-    dto.setProjectUuid("project-uuid-2");
+    dto.setComponentUuid("uuid-123");
+    dto.setProjectUuid("uuid-101");
     dto.setRuleId(200);
     dto.setKee("ABCDE");
     dto.setLine(500);
index 240aa0e8596b4ffa66ef77e55ab8d03140177240..8ec847c3c86dd3dea277e6a247a7fc409051477b 100644 (file)
@@ -81,8 +81,8 @@ public class IssueStorageTest extends AbstractDaoTestCase {
       .setUpdateDate(date)
       .setCloseDate(date)
 
-      .setComponentUuid("component-uuid")
-      .setProjectUuid("project-uuid")
+      .setComponentUuid("uuid-100")
+      .setProjectUuid("uuid-10")
       .setComponentKey("struts:Action");
 
     saver.save(issue);
@@ -116,8 +116,8 @@ public class IssueStorageTest extends AbstractDaoTestCase {
       .setUpdateDate(date)
       .setCloseDate(date)
 
-      .setComponentUuid("component-uuid")
-      .setProjectUuid("project-uuid")
+      .setComponentUuid("uuid-100")
+      .setProjectUuid("uuid-10")
       .setComponentKey("struts:Action");
 
     saver.save(session, issue);
@@ -128,8 +128,8 @@ public class IssueStorageTest extends AbstractDaoTestCase {
 
   @Test
   public void server_insert_new_issues_with_session() throws Exception {
-    ComponentDto project = new ComponentDto().setId(10L).setUuid("project-uuid");
-    ComponentDto component = new ComponentDto().setId(100L).setUuid("component-uuid");
+    ComponentDto project = new ComponentDto().setId(10L).setUuid("uuid-10");
+    ComponentDto component = new ComponentDto().setId(100L).setUuid("uuid-100");
     FakeServerSaver saver = new FakeServerSaver(getMyBatis(), new FakeRuleFinder(), component, project);
 
     DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment");
@@ -196,6 +196,8 @@ public class IssueStorageTest extends AbstractDaoTestCase {
       .setCreationDate(date)
       .setUpdateDate(date)
       .setCloseDate(date)
+      .setComponentUuid("uuid-100")
+      .setProjectUuid("uuid-10")
 
       // unmodifiable fields
       .setRuleKey(RuleKey.of("xxx", "unknown"))
@@ -210,8 +212,8 @@ public class IssueStorageTest extends AbstractDaoTestCase {
   public void server_update_issues() throws Exception {
     setupData("should_update_issues");
 
-    ComponentDto project = new ComponentDto().setId(10L);
-    ComponentDto component = new ComponentDto().setId(100L);
+    ComponentDto project = new ComponentDto().setId(10L).setUuid("whatever-uuid");
+    ComponentDto component = new ComponentDto().setId(100L).setUuid("whatever-uuid-2");
     FakeServerSaver saver = new FakeServerSaver(getMyBatis(), new FakeRuleFinder(), component, project);
 
     DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment");
@@ -240,6 +242,7 @@ public class IssueStorageTest extends AbstractDaoTestCase {
       .setCreationDate(date)
       .setUpdateDate(date)
       .setCloseDate(date)
+      .setProjectUuid("uuid-10")
 
       // unmodifiable fields
       .setRuleKey(RuleKey.of("xxx", "unknown"))
@@ -259,14 +262,14 @@ public class IssueStorageTest extends AbstractDaoTestCase {
     @Override
     protected void doInsert(DbSession session, long now, DefaultIssue issue) {
       int ruleId = rule(issue).getId();
-      IssueDto dto = IssueDto.toDtoForComputationInsert(issue, 100l, 10l, ruleId, now);
+      IssueDto dto = IssueDto.toDtoForComputationInsert(issue, ruleId, now);
 
       session.getMapper(IssueMapper.class).insert(dto);
     }
 
     @Override
     protected void doUpdate(DbSession session, long now, DefaultIssue issue) {
-      IssueDto dto = IssueDto.toDtoForUpdate(issue, 10l, now);
+      IssueDto dto = IssueDto.toDtoForUpdate(issue, now);
       session.getMapper(IssueMapper.class).update(dto);
     }
   }
@@ -292,7 +295,7 @@ public class IssueStorageTest extends AbstractDaoTestCase {
 
     @Override
     protected void doUpdate(DbSession session, long now, DefaultIssue issue) {
-      IssueDto dto = IssueDto.toDtoForUpdate(issue, 10l, now);
+      IssueDto dto = IssueDto.toDtoForUpdate(issue, now);
       session.getMapper(IssueMapper.class).update(dto);
     }
   }
index f3a251acca38a00f26298f72cdb296757856ec96..ba6599d789dae9596ae490b14c21249b621a02b6 100644 (file)
@@ -48,7 +48,6 @@ public class UpdateConflictResolverTest {
         .setKee("ABCDE")
         .setRuleId(10)
         .setRuleKey("squid", "AvoidCycles")
-        .setComponentId(100L)
         .setComponentKey("struts:org.apache.struts.Action")
         .setLine(10)
         .setStatus(Issue.STATUS_OPEN)
@@ -94,7 +93,7 @@ public class UpdateConflictResolverTest {
       .setKee("ABCDE")
       .setRuleId(10)
       .setRuleKey("squid", "AvoidCycles")
-      .setComponentId(100L)
+      .setComponentUuid("100")
       .setComponentKey("struts:org.apache.struts.Action")
       .setLine(10)
       .setResolution(Issue.RESOLUTION_FALSE_POSITIVE)
index 42fa52604aae2173fb857456cbb4ab01ecc86fe8..d7d285e42faa8dd44d1155489886aa06875f1299 100644 (file)
@@ -25,7 +25,6 @@ import org.junit.Test;
 import org.sonar.core.persistence.AbstractDaoTestCase;
 import org.sonar.core.persistence.MyBatis;
 
-import java.util.Arrays;
 import java.util.List;
 
 import static com.google.common.collect.Lists.newArrayList;
@@ -118,7 +117,7 @@ public class PurgeCommandsTest extends AbstractDaoTestCase {
     setupData("shouldDeleteResource");
     SqlSession session = getMyBatis().openSession();
     try {
-      new PurgeCommands(session, profiler).deleteResources(Arrays.asList(1L));
+      new PurgeCommands(session, profiler).deleteResources(newArrayList(new IdUuidPair(1L, "1")));
     } finally {
       MyBatis.closeQuietly(session);
     }
@@ -132,13 +131,21 @@ public class PurgeCommandsTest extends AbstractDaoTestCase {
   public void should_not_fail_when_deleting_huge_number_of_resources() {
     SqlSession session = getMyBatis().openSession();
     try {
-      new PurgeCommands(session, profiler).deleteResources(getHugeNumberOfIds());
+      new PurgeCommands(session, profiler).deleteResources(getHugeNumberOfIdUuids());
     } finally {
       MyBatis.closeQuietly(session);
     }
     // The goal of this test is only to check that the query do no fail, not to check result
   }
 
+  private List<IdUuidPair> getHugeNumberOfIdUuids() {
+    List<IdUuidPair> hugeNbOfSnapshotIds = newArrayList();
+    for (long i = 0; i < 4500; i++) {
+      hugeNbOfSnapshotIds.add(new IdUuidPair(i, String.valueOf(i)));
+    }
+    return hugeNbOfSnapshotIds;
+  }
+
   private List<Long> getHugeNumberOfIds() {
     List<Long> hugeNbOfSnapshotIds = newArrayList();
     for (long i = 0; i < 4500; i++) {
index d545ed63d0a94a701f0c4d3261954968648b2977..71dc8567ba1a3bd4e22b490cd825929162f38c0a 100644 (file)
@@ -29,10 +29,10 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class PurgeConfigurationTest {
   @Test
   public void should_delete_all_closed_issues() throws Exception {
-    PurgeConfiguration conf = new PurgeConfiguration(1L, new String[0], 0);
+    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 0);
     assertThat(conf.maxLiveDateOfClosedIssues()).isNull();
 
-    conf = new PurgeConfiguration(1L, new String[0], -1);
+    conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], -1);
     assertThat(conf.maxLiveDateOfClosedIssues()).isNull();
   }
 
@@ -40,7 +40,7 @@ public class PurgeConfigurationTest {
   public void should_delete_only_old_closed_issues() throws Exception {
     Date now = DateUtils.parseDate("2013-05-18");
 
-    PurgeConfiguration conf = new PurgeConfiguration(1L, new String[0], 30);
+    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 30);
     Date toDate = conf.maxLiveDateOfClosedIssues(now);
 
     assertThat(toDate.getYear()).isEqualTo(113);//=2013
index 0683bade2de3660c6e20317026b17e6c633e4a88..0e57b5654e3eba9355affb8ce6d892d4f0c4c28e 100644 (file)
@@ -58,6 +58,7 @@ public class PurgeDaoTest extends AbstractDaoTestCase {
 
     sut = new PurgeDao(getMyBatis(), new ResourceDao(getMyBatis(), system2), new PurgeProfiler(), system2);
   }
+
   @After
   public void after() {
     MyBatis.closeQuietly(dbSession);
@@ -66,35 +67,44 @@ public class PurgeDaoTest extends AbstractDaoTestCase {
   @Test
   public void shouldDeleteAbortedBuilds() {
     setupData("shouldDeleteAbortedBuilds");
-    sut.purge(new PurgeConfiguration(1L, new String[0], 30), PurgeListener.EMPTY);
+    sut.purge(newConfigurationWith30Days(), PurgeListener.EMPTY);
     checkTables("shouldDeleteAbortedBuilds", "snapshots");
   }
 
   @Test
   public void should_purge_project() {
     setupData("shouldPurgeProject");
-    sut.purge(new PurgeConfiguration(1L, new String[0], 30), PurgeListener.EMPTY);
+    sut.purge(newConfigurationWith30Days(), PurgeListener.EMPTY);
     checkTables("shouldPurgeProject", "projects", "snapshots");
   }
 
+  private PurgeConfiguration newConfigurationWith30Days() {
+    return new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 30);
+  }
+
+  private PurgeConfiguration newConfigurationWith30Days(System2 system2) {
+    return new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 30, system2);
+  }
+
+
   @Test
   public void delete_file_sources_of_disabled_resources() {
     setupData("delete_file_sources_of_disabled_resources");
-    sut.purge(new PurgeConfiguration(1L, new String[0], 30, system2), PurgeListener.EMPTY);
+    sut.purge(newConfigurationWith30Days(system2), PurgeListener.EMPTY);
     checkTables("delete_file_sources_of_disabled_resources", "file_sources");
   }
 
   @Test
   public void shouldDeleteHistoricalDataOfDirectoriesAndFiles() {
     setupData("shouldDeleteHistoricalDataOfDirectoriesAndFiles");
-    sut.purge(new PurgeConfiguration(1L, new String[] {Scopes.DIRECTORY, Scopes.FILE}, 30), PurgeListener.EMPTY);
+    sut.purge(new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[]{Scopes.DIRECTORY, Scopes.FILE}, 30), PurgeListener.EMPTY);
     checkTables("shouldDeleteHistoricalDataOfDirectoriesAndFiles", "projects", "snapshots");
   }
 
   @Test
   public void disable_resources_without_last_snapshot() {
     setupData("disable_resources_without_last_snapshot");
-    sut.purge(new PurgeConfiguration(1L, new String[0], 30, system2), PurgeListener.EMPTY);
+    sut.purge(newConfigurationWith30Days(system2), PurgeListener.EMPTY);
     checkTables("disable_resources_without_last_snapshot", new String[]{"issue_close_date", "issue_update_date"}, "projects", "snapshots", "issues");
   }
 
@@ -129,14 +139,14 @@ public class PurgeDaoTest extends AbstractDaoTestCase {
   @Test
   public void should_delete_old_closed_issues() {
     setupData("should_delete_old_closed_issues");
-    sut.purge(new PurgeConfiguration(1L, new String[0], 30), PurgeListener.EMPTY);
+    sut.purge(newConfigurationWith30Days(), PurgeListener.EMPTY);
     checkTables("should_delete_old_closed_issues", "issues", "issue_changes");
   }
 
   @Test
   public void should_delete_all_closed_issues() {
     setupData("should_delete_all_closed_issues");
-    sut.purge(new PurgeConfiguration(1L, new String[0], 0), PurgeListener.EMPTY);
+    sut.purge(new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 0), PurgeListener.EMPTY);
     checkTables("should_delete_all_closed_issues", "issues", "issue_changes");
   }
 
index de7167141e70254ce29063f0bd6fa5ed4c3e5616..e945efb6ab004565188ef189466f0a197abb8e8d 100644 (file)
@@ -1,12 +1,13 @@
 <dataset>
 
   <action_plans id="1" kee="ABC" project_id="1" name="SHORT_TERM" description="[null]" deadline="[null]"
-                user_login="igor" status="OPEN" created_at="[null]" updated_at="[null]" />
+                user_login="igor" status="OPEN" created_at="[null]" updated_at="[null]"/>
 
   <issues
       id="100"
       kee="ABCDE"
-      component_id="400"
+      component_uuid="uuid-400"
+      project_uuid="uuid-400"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -30,7 +31,8 @@
   <issues
       id="101"
       kee="ABCDF"
-      component_id="400"
+      component_uuid="uuid-400"
+      project_uuid="uuid-400"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -54,7 +56,8 @@
   <issues
       id="102"
       kee="ABCDG"
-      component_id="400"
+      component_uuid="uuid-400"
+      project_uuid="uuid-400"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
index cd51c9c7bc0d0e0ee15d0848ad197142652547b4..6b43a944834f69a30d86ccfbb8bb63fdb68604c9 100644 (file)
@@ -1,16 +1,16 @@
 <dataset>
 
-  <projects id="399" uuid="1" kee="struts" root_id="[null]" qualifier="TRK" scope="PRJ" />
-  <projects id="400" uuid="2" kee="struts-core" root_id="399" qualifier="BRC" scope="PRJ" />
-  <projects id="401" uuid="3" kee="Action.java" root_id="400" qualifier="CLA" scope="PRJ" />
-  <projects id="402" uuid="4" kee="Filter.java" root_id="400" qualifier="CLA" scope="PRJ" />
+  <projects id="399" uuid="uuid-399" kee="struts" root_id="[null]" project_uuid="[null]" qualifier="TRK" scope="PRJ" />
+  <projects id="400" uuid="uuid-400" kee="struts-core" root_id="399" project_uuid="uuid-399" qualifier="BRC" scope="PRJ" />
+  <projects id="401" uuid="uuid-401" kee="Action.java" root_id="400" project_uuid="uuid-400" qualifier="CLA" scope="PRJ" />
+  <projects id="402" uuid="uuid-402" kee="Filter.java" root_id="400" project_uuid="uuid-400" qualifier="CLA" scope="PRJ" />
 
   <!-- Open Issue on a file -->
   <issues
       id="100"
       kee="100"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="uuid-401"
+      project_uuid="uuid-399"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -71,8 +71,8 @@
   <issues
       id="101"
       kee="101"
-      component_id="402"
-      root_component_id="399"
+      component_uuid="uuid-402"
+      project_uuid="uuid-399"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
   <issues
       id="102"
       kee="102"
-      component_id="402"
-      root_component_id="399"
+      component_uuid="uuid-402"
+      project_uuid="uuid-399"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
   <issues
       id="103"
       kee="103"
-      component_id="400"
-      root_component_id="399"
+      component_uuid="uuid-400"
+      project_uuid="uuid-399"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
   <issues
       id="104"
       kee="104"
-      component_id="399"
-      root_component_id="399"
+      component_uuid="uuid-399"
+      project_uuid="uuid-399"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
index 29907c71ac0cda3b38e274ca86adfb0ac011cca5..88ce001bcc303f372c28ed72d3aea4ae302fd82f 100644 (file)
@@ -1,13 +1,13 @@
 <dataset>
 
-  <projects id="399" uuid="1" kee="struts" root_id="[null]" qualifier="TRK" scope="PRJ" />
+  <projects id="399" uuid="uuid-399" kee="struts" root_id="[null]" project_uuid="[null]" qualifier="TRK" scope="PRJ" />
 
   <!-- Open Issue on a root module -->
   <issues
       id="104"
       kee="104"
-      component_id="399"
-      root_component_id="399"
+      component_uuid="uuid-399"
+      project_uuid="uuid-399"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
index 8e7e6de33552f02096be715121d6a4b96f232ddf..3b0a6b64d2b78578d448787978710356929e971b 100644 (file)
@@ -4,8 +4,8 @@
   <issues
       id="100"
       kee="ABCDE-1"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -29,8 +29,8 @@
   <issues
       id="101"
       kee="ABCDE-2"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -56,8 +56,8 @@
   <issues
       id="102"
       kee="ABCDE-3"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="501"
       severity="BLOCKER"
       manual_severity="[false]"
index 12615141a32394c88191ec32a82b97168e9f3e25..19d8d5c7105f91563786ecfbdf0387fd92539cd8 100644 (file)
@@ -4,8 +4,8 @@
   <issues
       id="100"
       kee="ABCDE-1"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -29,8 +29,8 @@
   <issues
       id="101"
       kee="ABCDE-2"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="MAJOR"
       manual_severity="[false]"
@@ -56,8 +56,8 @@
   <issues
       id="102"
       kee="ABCDE-3"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="501"
       severity="BLOCKER"
       manual_severity="[false]"
index b8f264193f04d3155480ab03759759094e2696da..4faf9b16db0a3ed433da745f21b85839cfd352ef 100644 (file)
@@ -3,8 +3,8 @@
   <issues
       id="100"
       kee="ABCDE"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
index aeb1fc63497accbcd14e13e2383c5a8ef0334b0d..a8a8d8eafa3e17efd52ceeb24df880448edf5f61 100644 (file)
@@ -4,8 +4,8 @@
   <issues
       id="100"
       kee="ABCDE-1"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -29,8 +29,8 @@
   <issues
       id="101"
       kee="ABCDE-2"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -56,8 +56,8 @@
   <issues
       id="102"
       kee="ABCDE-3"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="501"
       severity="BLOCKER"
       manual_severity="[false]"
index 59044e8bc31dffaf885f48f6089c437ee6db304b..06824c52449d9bfcb08379c6fda7e000e0d0c4cf 100644 (file)
@@ -4,8 +4,8 @@
   <issues
       id="100"
       kee="100"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="CDEF"
+      project_uuid="ABCD"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -30,8 +30,8 @@
   <issues
       id="101"
       kee="101"
-      component_id="402"
-      root_component_id="399"
+      component_uuid="DEFG"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
@@ -56,8 +56,8 @@
   <issues
       id="102"
       kee="102"
-      component_id="402"
-      root_component_id="399"
+      component_uuid="DEFG"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
@@ -82,8 +82,8 @@
   <issues
       id="103"
       kee="103"
-      component_id="400"
-      root_component_id="399"
+      component_uuid="BCDE"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
   <issues
       id="104"
       kee="104"
-      component_id="399"
-      root_component_id="399"
+      component_uuid="ABCD"
+      project_uuid="ABCD"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
index 95f98bc0584099a3d581f0529f0ae95059a2313d..53906e7d6e51081c4e9c0dd0483e0dcd39c3fec7 100644 (file)
@@ -24,8 +24,8 @@
   <issues
       id="100"
       kee="100"
-      component_id="401"
-      root_component_id="111"
+      component_uuid="CDEF"
+      project_uuid="uuid-111"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -50,8 +50,8 @@
   <issues
       id="101"
       kee="101"
-      component_id="402"
-      root_component_id="111"
+      component_uuid="DEFG"
+      project_uuid="uuid-111"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
@@ -76,8 +76,8 @@
   <issues
       id="102"
       kee="102"
-      component_id="402"
-      root_component_id="111"
+      component_uuid="DEFG"
+      project_uuid="uuid-111"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
   <issues
       id="103"
       kee="103"
-      component_id="400"
-      root_component_id="111"
+      component_uuid="BCDE"
+      project_uuid="uuid-111"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
index 4e42661eff2b251a86018169167e37c572889aa0..19384f8380a31e7e26d415a7c96bee1604597ff1 100644 (file)
@@ -2,10 +2,8 @@
   <issues
       id="100"
       kee="ABCDE"
-      component_id="123"
-      component_uuid="component-uuid"
-      project_uuid="project-uuid"
-      root_component_id="100"
+      component_uuid="uuid-123"
+      project_uuid="uuid-100"
       rule_id="200"
       severity="BLOCKER"
       manual_severity="[false]"
index e786cee7859ba5888b527ae45d67cc64e823a975..5cf1714d9bb5e7031dc2e25dae3f91496e792485 100644 (file)
@@ -2,10 +2,8 @@
   <issues
       id="100"
       kee="ABCDE"
-      component_id="123"
-      component_uuid="component-uuid"
-      project_uuid="project-uuid-2"
-      root_component_id="101"
+      component_uuid="uuid-123"
+      project_uuid="uuid-101"
       rule_id="200"
       severity="BLOCKER"
       manual_severity="[false]"
index 3990d9ae5a21cab109324bd30498f729d6591a97..941e2e0e698fb21f3eb2205557146a2173488cb3 100644 (file)
@@ -2,10 +2,8 @@
   <issues
       id="100"
       kee="ABCDE"
-      component_id="123"
-      component_uuid="component-uuid"
-      project_uuid="project-uuid"
-      root_component_id="100"
+      component_uuid="uuid-123"
+      project_uuid="uuid-100"
       rule_id="200"
       severity="INFO"
       manual_severity="[false]"
index 7035788c73991a705ab09805c6a8fe78c90a0ae1..8b95b508f1c1c5d3ce66e1583f8cc05f6a70d575 100644 (file)
@@ -3,10 +3,8 @@
   <issues
       id="100"
       kee="ABCDE"
-      component_id="123"
-      component_uuid="component-uuid"
-      project_uuid="project-uuid"
-      root_component_id="100"
+      component_uuid="uuid-123"
+      project_uuid="uuid-100"
       rule_id="200"
       severity="INFO"
       manual_severity="[false]"
index 8af4d4cbfc9e7198bc8b88fbd244129936b85c70..3ea44387a57e6ab2f0b2fbdbb0a170f56fda561e 100644 (file)
@@ -2,10 +2,8 @@
   <issues
       id="100"
       kee="ABCDE"
-      component_id="123"
-      component_uuid="component-uuid"
-      project_uuid="project-uuid"
-      root_component_id="100"
+      component_uuid="uuid-123"
+      project_uuid="uuid-100"
       rule_id="200"
       severity="INFO"
       manual_severity="[false]"
index 4cf535d51a2aef9839faaeaf20ed18d847370842..1fd8a9ec17b6f4ec57433f622d6e344d913795df 100644 (file)
@@ -6,8 +6,8 @@
   <issues
       id="100"
       kee="ABCDE-1"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="uuid-401"
+      project_uuid="uuid-399"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -31,8 +31,8 @@
   <issues
       id="101"
       kee="ABCDE-2"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="uuid-401"
+      project_uuid="uuid-399"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -56,8 +56,8 @@
   <issues
       id="102"
       kee="ABCDE-3"
-      component_id="401"
-      root_component_id="399"
+      component_uuid="uuid-401"
+      project_uuid="uuid-399"
       rule_id="501"
       severity="BLOCKER"
       manual_severity="[false]"
index b30fd9374dda326e4ef8ecb23ba609b6971c5419..e9701caee6775c421a6a161e46023c2bac127477 100644 (file)
@@ -7,10 +7,8 @@
           technical_debt="10"
           message="[null]"
           line="5000"
-          component_id="100"
-          root_component_id="10"
-          component_uuid="component-uuid"
-          project_uuid="project-uuid"
+          component_uuid="uuid-100"
+          project_uuid="uuid-10"
           rule_id="200"
           created_at="[null]"
           updated_at="[null]"
index e3397e3d142d6395173ea10b1c4b82a23e6a531d..9620376c137b9afdee1214caff4e2edf5e149d2a 100644 (file)
           technical_debt="[null]"
           message="[null]"
           line="444"
-          component_id="100"
-          component_uuid="component-uuid"
-          project_uuid="project-uuid"
-          root_component_id="10"
+          component_uuid="uuid-100"
+          project_uuid="uuid-10"
           rule_id="200"
           reporter="[null]"
           issue_attributes="JIRA=http://jira.com"
index c2cd5033e0bb170a257d2914bfccb77d4bcf1c12..0346a0a03ea4680b972cb0f9010c85dd5ad1be91 100644 (file)
           technical_debt="[null]"
           message="[null]"
           line="1"
-          component_id="100"
-          component_uuid="component-uuid"
-          project_uuid="project-uuid"
-          root_component_id="10"
+          component_uuid="uuid-100"
+          project_uuid="uuid-10"
           rule_id="200"
           reporter="[null]"
           issue_attributes=""
index 2cf53b1e763a0934d017ef8eb745c51f443da8f7..3cc73d72c7c89fb25aa515fa88a1f8a3f5aa235b 100644 (file)
           technical_debt="10"
           message="[null]"
           line="5000"
-          component_id="100"
-          component_uuid="component-uuid"
-          project_uuid="[null]"
-          root_component_id="10"
+          component_uuid="uuid-100"
+          project_uuid="uuid-10"
           rule_id="200"
           created_at="2013-05-18"
           updated_at="2013-05-18"
index 751373bb9be288c393783f92cc1bd546571bd18b..cb130ab616c6f7cb69297321dab871e376b8bf4c 100644 (file)
           technical_debt="[null]"
           message="[null]"
           line="3000"
-          component_id="100"
-          component_uuid="component-uuid"
-          project_uuid="[null]"
-          root_component_id="10"
+          component_uuid="uuid-100"
+          project_uuid="uuid-11"
           rule_id="200"
           created_at="1400000000000"
           updated_at="1400000000000"
index 121c528c36626d9771b3bcbe4eb43cfb475bcb39..f6847e78a1c8b7a263e2a6564b98fa27a029423e 100644 (file)
   -->
 <dataset>
   <metrics id="1" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name=""
-           enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="[false]" delete_historical_data="[null]"/>
+           enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0"
+           hidden="[false]" delete_historical_data="[null]"/>
   <metrics id="2" name="coverage" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name=""
-           enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" delete_historical_data="[null]"/>
+           enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1"
+           hidden="[false]" delete_historical_data="[null]"/>
 
   <rules_profiles id="1" name="Sonar way with Findbugs" language="java" parent_kee="" kee="sonar_way_with_findbugs"/>
 
-  <projects id="300" uuid="A"  kee="struts" root_id="[null]" qualifier="TRK" scope="PRJ" />
-  <projects id="301" uuid="B" kee="struts-core" root_id="300" qualifier="BRC" scope="PRJ" />
-  <projects id="302" uuid="C" kee="struts-el" root_id="300" qualifier="BRC" scope="PRJ" />
-  <projects id="303" uuid="D" kee="Action.java" root_id="301" qualifier="CLA" scope="FIL" />
+  <projects id="300" uuid="A" kee="struts" root_id="[null]" qualifier="TRK" scope="PRJ"/>
+  <projects id="301" uuid="B" kee="struts-core" root_id="300" qualifier="BRC" scope="PRJ"/>
+  <projects id="302" uuid="C" kee="struts-el" root_id="300" qualifier="BRC" scope="PRJ"/>
+  <projects id="303" uuid="D" kee="Action.java" root_id="301" qualifier="CLA" scope="FIL"/>
 
   <snapshots id="3000" project_id="300" root_project_id="300" root_snapshot_id="[null]" path="" islast="[true]"/>
   <snapshots id="3001" project_id="301" root_project_id="300" root_snapshot_id="3000" path="3000." islast="[true]"/>
   <snapshots id="3002" project_id="302" root_project_id="300" root_snapshot_id="3000" path="3000." islast="[true]"/>
-  <snapshots id="3003" project_id="303" root_project_id="300" root_snapshot_id="3000" path="3000.3001." islast="[true]"/>
+  <snapshots id="3003" project_id="303" root_project_id="300" root_snapshot_id="3000" path="3000.3001."
+             islast="[true]"/>
 
   <snapshots id="3010" project_id="300" root_project_id="300" root_snapshot_id="[null]" path="" islast="[false]"/>
   <snapshots id="3011" project_id="301" root_project_id="300" root_snapshot_id="3010" path="3010." islast="[false]"/>
   <snapshots id="3012" project_id="302" root_project_id="300" root_snapshot_id="3010" path="3010." islast="[false]"/>
-  <snapshots id="3013" project_id="303" root_project_id="300" root_snapshot_id="3010" path="3010.3011." islast="[false]"/>
+  <snapshots id="3013" project_id="303" root_project_id="300" root_snapshot_id="3010" path="3010.3011."
+             islast="[false]"/>
 
-  <project_measures id="1" value="12" metric_id="1" snapshot_id="3000" />
-  <project_measures id="2" value="5" metric_id="1" snapshot_id="3001" />
-  <project_measures id="3" value="7" metric_id="1" snapshot_id="3002" />
-  <project_measures id="4" value="5" metric_id="1" snapshot_id="3003" />
+  <project_measures id="1" value="12" metric_id="1" snapshot_id="3000"/>
+  <project_measures id="2" value="5" metric_id="1" snapshot_id="3001"/>
+  <project_measures id="3" value="7" metric_id="1" snapshot_id="3002"/>
+  <project_measures id="4" value="5" metric_id="1" snapshot_id="3003"/>
 
-  <project_measures id="5" value="35" metric_id="2" snapshot_id="3000" />
-  <project_measures id="6" value="20" metric_id="2" snapshot_id="3001" />
-  <project_measures id="7" value="30" metric_id="2" snapshot_id="3002" />
-  <project_measures id="8" value="20" metric_id="2" snapshot_id="3003" />
+  <project_measures id="5" value="35" metric_id="2" snapshot_id="3000"/>
+  <project_measures id="6" value="20" metric_id="2" snapshot_id="3001"/>
+  <project_measures id="7" value="30" metric_id="2" snapshot_id="3002"/>
+  <project_measures id="8" value="20" metric_id="2" snapshot_id="3003"/>
 
-  <project_measures id="11" value="112" metric_id="1" snapshot_id="3010" />
-  <project_measures id="12" value="15" metric_id="1" snapshot_id="3011" />
-  <project_measures id="13" value="17" metric_id="1" snapshot_id="3012" />
-  <project_measures id="14" value="15" metric_id="1" snapshot_id="3013" />
+  <project_measures id="11" value="112" metric_id="1" snapshot_id="3010"/>
+  <project_measures id="12" value="15" metric_id="1" snapshot_id="3011"/>
+  <project_measures id="13" value="17" metric_id="1" snapshot_id="3012"/>
+  <project_measures id="14" value="15" metric_id="1" snapshot_id="3013"/>
 
-  <project_measures id="15" value="135" metric_id="2" snapshot_id="3010" />
-  <project_measures id="16" value="120" metric_id="2" snapshot_id="3011" />
-  <project_measures id="17" value="130" metric_id="2" snapshot_id="3012" />
-  <project_measures id="18" value="120" metric_id="2" snapshot_id="3013" />
+  <project_measures id="15" value="135" metric_id="2" snapshot_id="3010"/>
+  <project_measures id="16" value="120" metric_id="2" snapshot_id="3011"/>
+  <project_measures id="17" value="130" metric_id="2" snapshot_id="3012"/>
+  <project_measures id="18" value="120" metric_id="2" snapshot_id="3013"/>
 
 
   <rules tags="[null]" system_tags="[null]" id="500" plugin_rule_key="AvoidCycle" plugin_name="squid"/>
@@ -68,8 +72,8 @@
   <issues
       id="100"
       kee="ISSUE-100"
-      component_id="303"
-      root_component_id="300"
+      component_uuid="D"
+      project_uuid="A"
 
       rule_id="500"
       severity="BLOCKER"
@@ -94,8 +98,8 @@
   <issues
       id="101"
       kee="ISSUE-101"
-      component_id="303"
-      root_component_id="300"
+      component_uuid="D"
+      project_uuid="A"
 
       rule_id="501"
       severity="MAJOR"
index d2309a8c42e51e2693b8fb44aba34dff8f7ac535..ea8853259619b1b962689584431e29adf4d12327 100644 (file)
@@ -1,8 +1,10 @@
 <dataset>
   <metrics id="1" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name=""
-           enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="[false]" delete_historical_data="[null]"/>
+           enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0"
+           hidden="[false]" delete_historical_data="[null]"/>
   <metrics id="2" name="coverage" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name=""
-           enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" delete_historical_data="[null]"/>
+           enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1"
+           hidden="[false]" delete_historical_data="[null]"/>
 
   <rules_profiles id="1" name="Sonar way with Findbugs" language="java" parent_kee="" kee="sonar_way_with_findbugs"/>
 
@@ -20,7 +22,8 @@
   <issues
       id="100"
       kee="100"
-      component_id="400"
+      component_uuid="B"
+      project_uuid="A"
       rule_id="500"
       severity="BLOCKER"
       manual_severity="[false]"
@@ -44,7 +47,8 @@
   <issues
       id="101"
       kee="101"
-      component_id="401"
+      component_uuid="C"
+      project_uuid="A"
       rule_id="501"
       severity="MAJOR"
       manual_severity="[false]"
index 17cab18f3343dc3e6ceb7f4198469c42ecd7d60a..e7d9267148904a1c39946145c8b6adfa2e3f7961 100644 (file)
@@ -1,8 +1,8 @@
 <dataset>
 
-  <projects id="1" enabled="[true]" root_id="[null]"
+  <projects id="1" uuid="1" enabled="[true]" root_id="[null]"
             long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" />
+            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/>
 
   <snapshots id="1" project_id="1" parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]"
              status="P" islast="[false]" purge_status="[null]"
@@ -18,7 +18,8 @@
   <events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]"
           event_date="2008-12-02 13:58:00.00" created_at="[null]" event_data="[null]"/>
 
-  <issues id="1" kee="ABCDE" component_id="1" status="CLOSED" resolution="[null]" line="200" severity="BLOCKER"
+  <issues id="1" kee="ABCDE" component_uuid="1" project_uuid="1" status="CLOSED" resolution="[null]" line="200"
+          severity="BLOCKER"
           reporter="perceval" assignee="arthur" rule_id="500"
           manual_severity="[false]"
           message="[null]"
@@ -29,8 +30,9 @@
           updated_at="[null]"
       />
 
-  <issue_changes id="1" kee="ABDA" issue_key="ABCDE" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="this is a comment"/>
+  <issue_changes id="1" kee="ABDA" issue_key="ABCDE" created_at="[null]" updated_at="[null]" user_login="admin"
+                 change_type="comment" change_data="this is a comment"/>
 
-  <authors id="1" person_id="1" login="tartanpion" created_at="[null]" updated_at="[null]" />
-  <authors id="2" person_id="1" login="fanfoue" created_at="[null]" updated_at="[null]" />
+  <authors id="1" person_id="1" login="tartanpion" created_at="[null]" updated_at="[null]"/>
+  <authors id="2" person_id="1" login="fanfoue" created_at="[null]" updated_at="[null]"/>
 </dataset>
index cf7f9a41062fa9d039702e3187bc5a97e00d30fc..d086991945aff362395b71efbe357b34b1ecf7cc 100644 (file)
@@ -9,19 +9,25 @@ What has been changed :
 <dataset>
 
   <!-- the project -->
-  <projects id="1" enabled="[false]" root_id="[null]" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." created_at="[null]"
+  <projects id="1" enabled="[false]" root_id="[null]" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]"
+            module_uuid_path="." created_at="[null]"
             long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]" authorization_updated_at="[null]"/>
+            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]"
+            deprecated_kee="[null]" authorization_updated_at="[null]"/>
 
   <!-- the directory -->
-  <projects id="2" enabled="[false]" root_id="1" uuid="EFGH" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path="." created_at="[null]"
+  <projects id="2" enabled="[false]" root_id="1" uuid="EFGH" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path="."
+            created_at="[null]"
             long_name="[null]" scope="DIR" qualifier="DIR" kee="project:my/dir" name="my/dir"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]" authorization_updated_at="[null]"/>
+            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]"
+            deprecated_kee="[null]" authorization_updated_at="[null]"/>
 
   <!-- the file -->
-  <projects id="3" enabled="[false]" root_id="1" uuid="GHIJ" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." created_at="[null]"
+  <projects id="3" enabled="[false]" root_id="1" uuid="GHIJ" project_uuid="ABCD" module_uuid="ABCD"
+            module_uuid_path=".ABCD." created_at="[null]"
             long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/File.java" name="my/dir/File.java"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="[null]" authorization_updated_at="[null]" />
+            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]"
+            deprecated_kee="[null]" authorization_updated_at="[null]"/>
 
   <snapshots id="1"
              project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]"
@@ -31,7 +37,8 @@ What has been changed :
              period3_mode="[null]" period3_param="[null]" period3_date="[null]"
              period4_mode="[null]" period4_param="[null]" period4_date="[null]"
              period5_mode="[null]" period5_param="[null]" period5_date="[null]"
-             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
+             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00"
+             build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
 
   <snapshots id="2"
              project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
@@ -41,7 +48,8 @@ What has been changed :
              period3_mode="[null]" period3_param="[null]" period3_date="[null]"
              period4_mode="[null]" period4_param="[null]" period4_date="[null]"
              period5_mode="[null]" period5_param="[null]" period5_date="[null]"
-             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
+             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00"
+             build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
 
 
   <snapshots id="3"
@@ -52,54 +60,59 @@ What has been changed :
              period3_mode="[null]" period3_param="[null]" period3_date="[null]"
              period4_mode="[null]" period4_param="[null]" period4_date="[null]"
              period5_mode="[null]" period5_param="[null]" period5_date="[null]"
-             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
+             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00"
+             build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
 
   <!-- Open issue on file -->
   <issues id="1" kee="ISSUE-1"
-          component_id="3"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="GHIJ"
+          project_uuid="ABCD"
           status="CLOSED"
           issue_close_date="2014-04-09"
-          resolution="REMOVED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="1450000000000" issue_creation_date="2013-04-16" issue_update_date="2014-04-09" created_at="1450000000000" tags="[null]"/>
+          resolution="REMOVED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="1450000000000" issue_creation_date="2013-04-16" issue_update_date="2014-04-09"
+          created_at="1450000000000" tags="[null]"/>
 
   <!-- Open issue on directory -->
   <issues id="2" kee="ISSUE-2"
-          component_id="2"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="EFGH"
+          project_uuid="ABCD"
           status="CLOSED"
           issue_close_date="2014-04-09"
-          resolution="REMOVED" line="[null]" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="1450000000000" issue_creation_date="2013-04-16" issue_update_date="2014-04-09" created_at="1450000000000" tags="[null]"/>
+          resolution="REMOVED" line="[null]" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="1450000000000" issue_creation_date="2013-04-16" issue_update_date="2014-04-09"
+          created_at="1450000000000" tags="[null]"/>
 
   <!-- Open issue on project -->
   <issues id="3" kee="ISSUE-3"
-          component_id="1"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="ABCD"
+          project_uuid="ABCD"
           status="CLOSED"
           issue_close_date="2014-04-09"
-          resolution="REMOVED" line="[null]" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="1450000000000" issue_creation_date="2013-04-16" issue_update_date="2014-04-09" created_at="1450000000000" tags="[null]"/>
+          resolution="REMOVED" line="[null]" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="1450000000000" issue_creation_date="2013-04-16" issue_update_date="2014-04-09"
+          created_at="1450000000000" tags="[null]"/>
 
   <!-- Resolved issue on file -> not to be updated -->
   <issues id="4" kee="ISSUE-4"
-          component_id="3"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="GHIJ"
+          project_uuid="ABCD"
           status="CLOSED"
           issue_close_date="2015-12-08"
-          resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="1450000000000" issue_creation_date="2013-04-16" issue_update_date="2014-04-08" created_at="1450000000000" tags="[null]"/>
+          resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="1450000000000" issue_creation_date="2013-04-16" issue_update_date="2014-04-08"
+          created_at="1450000000000" tags="[null]"/>
 
 </dataset>
index 121c1148321e305c453535d904d9c94696bb77b5..b99d22d0a1b43a492d695d2e62ccaf15e73ec7d2 100644 (file)
 
   <!-- Open issue on file -->
   <issues id="1" kee="ISSUE-1"
-          component_id="3"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="GHIJ"
+          project_uuid="ABCD"
           status="OPEN"
           issue_close_date="[null]"
           resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
 
   <!-- Open issue on directory -->
   <issues id="2" kee="ISSUE-2"
-          component_id="2"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="EFGH"
+          project_uuid="ABCD"
           status="OPEN"
           issue_close_date="[null]"
           resolution="[null]" line="[null]" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
 
   <!-- Open issue on project -->
   <issues id="3" kee="ISSUE-3"
-          component_id="1"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="ABCD"
+          project_uuid="ABCD"
           status="CONFIRM"
           issue_close_date="[null]"
           resolution="[null]" line="[null]" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
 
   <!-- Resolved issue on file -> not to be updated -->
   <issues id="4" kee="ISSUE-4"
-          component_id="3"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="GHIJ"
+          project_uuid="ABCD"
           status="CLOSED"
           issue_close_date="2015-12-08"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
index c48c4a9ced44974b6d96052e15dd5faef89c4a27..a356e56fcf4c61eaee13469cb68657a87ed00962 100644 (file)
@@ -21,7 +21,8 @@
   <action_plans id="1" kee="ABCD" project_id="1" name="SHORT_TERM" description="[null]" deadline="[null]"
                 user_login="igor" status="[null]" created_at="[null]" updated_at="[null]"/>
 
-  <issues id="1" kee="ABCDE" component_id="1" status="CLOSED" resolution="[null]" line="200" severity="BLOCKER"
+  <issues id="1" kee="ABCDE" component_uuid="A" project_uuid="A" status="CLOSED" resolution="[null]" line="200"
+          severity="BLOCKER"
           reporter="perceval" assignee="arthur" rule_id="500"
           manual_severity="[false]"
           message="[null]"
@@ -33,7 +34,8 @@
           issue_close_date="2013-04-16"
       />
 
-  <issues id="2" kee="ABCDF" component_id="1" status="CLOSED" resolution="[null]" line="200" severity="BLOCKER"
+  <issues id="2" kee="ABCDF" component_uuid="A" project_uuid="A" status="CLOSED" resolution="[null]" line="200"
+          severity="BLOCKER"
           reporter="perceval" assignee="arthur" rule_id="500"
           manual_severity="[false]"
           message="[null]"
index 23d072cc1ffb09b790d56bf3621d546fc84e2cdc..f95c7fcd934eb2d20fce7bcb56b778f071ea0a6c 100644 (file)
@@ -5,9 +5,10 @@
 -->
 <dataset>
 
-  <projects id="1" enabled="[true]" root_id="[null]" created_at="[null]"
+  <projects id="1" uuid="1" enabled="[true]" root_id="[null]" created_at="[null]"
             long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" authorization_updated_at="[null]"/>
+            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]"
+            authorization_updated_at="[null]"/>
 
   <snapshots id="1"
              project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]"
              period3_mode="[null]" period3_param="[null]" period3_date="[null]"
              period4_mode="[null]" period4_param="[null]" period4_date="[null]"
              period5_mode="[null]" period5_param="[null]" period5_date="[null]"
-             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
+             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00"
+             build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
 
 
   <!-- old closed issues on file and project -->
   <!--
   <issues id="1" kee="ISSUE-1"
-          component_id="100"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2010-01-01"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
@@ -33,8 +35,8 @@
   <issue_changes id="1" kee="[null]" issue_key="ISSUE-1" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <issues id="2" kee="ISSUE-2"
-          component_id="1"
-          root_component_id="1"
+          component_uuid="1"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2010-01-01"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
 
   <!-- old open issues -->
   <issues id="3" kee="ISSUE-3"
-          component_id="1"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="1"
+          project_uuid="1"
           status="OPEN"
           issue_close_date="[null]"
-          resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]" tags="[null]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="1400000000000"/>
-  <issue_changes id="3" kee="[null]" issue_key="ISSUE-3" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
+          resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]" tags="[null]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16"
+          created_at="1400000000000"/>
+  <issue_changes id="3" kee="[null]" issue_key="ISSUE-3" created_at="[null]" updated_at="[null]" user_login="admin"
+                 change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <!-- recent open and closed issues -->
   <issues id="4" kee="ISSUE-4"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="OPEN"
           issue_close_date="[null]"
-          resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]" tags="[null]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="1400000000000"/>
-  <issue_changes id="4" kee="[null]" issue_key="ISSUE-4" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
+          resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]" tags="[null]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16"
+          created_at="1400000000000"/>
+  <issue_changes id="4" kee="[null]" issue_key="ISSUE-4" created_at="[null]" updated_at="[null]" user_login="admin"
+                 change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <!--
   <issues id="5" kee="ISSUE-5"
-          component_id="100"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2025-01-01"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
index 401591c1b6a71240438cc161e9e57f8b3d07928c..7a35c7132e9d1aa76a3de2cc939f43ada51bca3b 100644 (file)
@@ -1,6 +1,6 @@
 <dataset>
 
-  <projects id="1" enabled="[true]" root_id="[null]" created_at="[null]"
+  <projects id="1" uuid="1" enabled="[true]" root_id="[null]" created_at="[null]"
             long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project"
             description="[null]" language="java" copy_resource_id="[null]" person_id="[null]"
             authorization_updated_at="[null]"/>
 
   <!-- old closed issues on file and project -->
   <issues id="1" kee="ISSUE-1"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2010-01-01"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
                  change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <issues id="2" kee="ISSUE-2"
-          component_id="1"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="1"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2010-01-01"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
 
   <!-- old open issues -->
   <issues id="3" kee="ISSUE-3"
-          component_id="1"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="1"
+          project_uuid="1"
           status="OPEN"
           issue_close_date="[null]"
           resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
 
   <!-- recent open and closed issues -->
   <issues id="4" kee="ISSUE-4"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="OPEN"
           issue_close_date="[null]"
           resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
                  change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <issues id="5" kee="ISSUE-5"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2025-01-01"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
index 95d93990575b42954a290bfeb45bb34a6f4c8813..86284fe0b2a0473496354358fc01618d0893a885 100644 (file)
@@ -1,6 +1,6 @@
 <dataset>
 
-  <projects id="1" enabled="[true]" root_id="[null]" created_at="[null]"
+  <projects id="1" uuid="1" enabled="[true]" root_id="[null]" created_at="[null]"
             long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project"
             description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" authorization_updated_at="[null]"/>
 
@@ -17,8 +17,8 @@
   <!-- old closed issues on file and project -> to be purged -->
   <!--
   <issues id="1" kee="ISSUE-1"
-          component_id="100"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2010-01-01"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
@@ -27,8 +27,8 @@
   <issue_changes id="1" kee="[null]" issue_key="ISSUE-1" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <issues id="2" kee="ISSUE-2"
-          component_id="1"
-          root_component_id="1"
+          component_uuid="1"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2010-01-01"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
 
   <!-- old open issues -> do not purge -->
   <issues id="3" kee="ISSUE-3"
-          component_id="1"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="1"
+          project_uuid="1"
           status="OPEN"
           issue_close_date="[null]"
           resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]" tags="[null]"
 
   <!-- recent open and closed issues -> do not purge -->
   <issues id="4" kee="ISSUE-4"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="OPEN"
           issue_close_date="[null]"
           resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]" tags="[null]"
   <issue_changes id="4" kee="[null]" issue_key="ISSUE-4" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <issues id="5" kee="ISSUE-5"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2025-01-01"
           resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]" tags="[null]"
index 353e75358a3a66a650839b5331e50778cf4f3b45..f85107748fb267bd64b2526e82f0fcbdc859091f 100644 (file)
@@ -1,8 +1,9 @@
 <dataset>
 
-  <projects id="1" enabled="[true]" root_id="[null]" created_at="[null]"
+  <projects id="1" uuid="1" enabled="[true]" root_id="[null]" created_at="[null]"
             long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project"
-            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" authorization_updated_at="[null]"/>
+            description="[null]" language="java" copy_resource_id="[null]" person_id="[null]"
+            authorization_updated_at="[null]"/>
 
   <snapshots id="1"
              project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]"
              period3_mode="[null]" period3_param="[null]" period3_date="[null]"
              period4_mode="[null]" period4_param="[null]" period4_date="[null]"
              period5_mode="[null]" period5_param="[null]" period5_date="[null]"
-             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
+             depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00"
+             build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/>
 
   <!-- old closed issues on file and project -> to be purged -->
   <issues id="1" kee="ISSUE-1"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2010-01-01"
-          resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="1400000000000"/>
-  <issue_changes id="1" kee="[null]" issue_key="ISSUE-1" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
+          resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16"
+          created_at="1400000000000"/>
+  <issue_changes id="1" kee="[null]" issue_key="ISSUE-1" created_at="[null]" updated_at="[null]" user_login="admin"
+                 change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <issues id="2" kee="ISSUE-2"
-          component_id="1"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="1"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2010-01-01"
-          resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="1400000000000"/>
-  <issue_changes id="2" kee="[null]" issue_key="ISSUE-2" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
+          resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16"
+          created_at="1400000000000"/>
+  <issue_changes id="2" kee="[null]" issue_key="ISSUE-2" created_at="[null]" updated_at="[null]" user_login="admin"
+                 change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
 
   <!-- old open issues -> do not purge -->
   <issues id="3" kee="ISSUE-3"
-          component_id="1"
-          root_component_id="1"
+          component_uuid="1"
+          project_uuid="1"
           status="OPEN"
           issue_close_date="[null]"
-          resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="1400000000000"/>
-  <issue_changes id="3" kee="[null]" issue_key="ISSUE-3" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
+          resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16"
+          created_at="1400000000000"/>
+  <issue_changes id="3" kee="[null]" issue_key="ISSUE-3" created_at="[null]" updated_at="[null]" user_login="admin"
+                 change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <!-- recent open and closed issues -> do not purge -->
   <issues id="4" kee="ISSUE-4"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="OPEN"
           issue_close_date="[null]"
-          resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="1400000000000"/>
-  <issue_changes id="4" kee="[null]" issue_key="ISSUE-4" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
+          resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16"
+          created_at="1400000000000"/>
+  <issue_changes id="4" kee="[null]" issue_key="ISSUE-4" created_at="[null]" updated_at="[null]" user_login="admin"
+                 change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
   <issues id="5" kee="ISSUE-5"
-          component_id="100"
-          component_uuid="[null]"
-          project_uuid="[null]"
-          root_component_id="1"
+          component_uuid="100"
+          project_uuid="1"
           status="CLOSED"
           issue_close_date="2025-01-01"
-          resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]"
-          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]" issue_attributes="[null]" checksum="[null]" author_login="[null]"
-          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16" created_at="1400000000000"/>
-  <issue_changes id="5" kee="[null]" issue_key="ISSUE-5" created_at="[null]" updated_at="[null]" user_login="admin" change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
+          resolution="FIXED" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500"
+          manual_severity="[false]"
+          message="[null]" action_plan_key="[null]" effort_to_fix="[null]" technical_debt="[null]"
+          issue_attributes="[null]" checksum="[null]" author_login="[null]"
+          updated_at="[null]" issue_creation_date="2013-04-16" issue_update_date="2013-04-16"
+          created_at="1400000000000"/>
+  <issue_changes id="5" kee="[null]" issue_key="ISSUE-5" created_at="[null]" updated_at="[null]" user_login="admin"
+                 change_type="comment" change_data="abc" issue_change_creation_date="[null]"/>
 
 </dataset>
index 9ba69fd9cc6dba1032c3a6b988aa8289170b78aa..05d5d0fc5bdd0f598c21f4ce58370b1bdd227a37 100644 (file)
@@ -55,7 +55,6 @@ public class DefaultIssue implements Issue {
 
   private String componentUuid;
   private String componentKey;
-  private Long componentId;
 
   private String moduleUuid;
   private String moduleUuidPath;
@@ -147,19 +146,6 @@ public class DefaultIssue implements Issue {
     return this;
   }
 
-  /**
-   * The component id not populated on batch side
-   */
-  @CheckForNull
-  public Long componentId() {
-    return componentId;
-  }
-
-  public DefaultIssue setComponentId(@Nullable Long s) {
-    this.componentId = s;
-    return this;
-  }
-
   @CheckForNull
   public String moduleUuid() {
     return moduleUuid;
index 673aac868afdc72e5c1e2df6fd318226cb2a6bea..998d89e1451ce7b9b9ceb5e1f05d7ccb6ac8bd73 100644 (file)
@@ -43,7 +43,6 @@ public class DefaultIssueTest {
   public void test_setters_and_getters() throws Exception {
     issue.setKey("ABCD")
       .setComponentKey("org.sample.Sample")
-      .setComponentId(1L)
       .setProjectKey("Sample")
       .setRuleKey(RuleKey.of("squid", "S100"))
       .setLanguage("xoo")
@@ -72,7 +71,6 @@ public class DefaultIssueTest {
 
     assertThat(issue.key()).isEqualTo("ABCD");
     assertThat(issue.componentKey()).isEqualTo("org.sample.Sample");
-    assertThat(issue.componentId()).isEqualTo(1L);
     assertThat(issue.projectKey()).isEqualTo("Sample");
     assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("squid", "S100"));
     assertThat(issue.language()).isEqualTo("xoo");