aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-02-04 09:24:23 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-02-09 15:16:29 +0100
commit5879a094d888e93a7ee4cbe4ed9d4c0ce0c23ac0 (patch)
treef87417dac02f40dec9261bec3c1b4bfd189ac984 /sonar-batch
parent2e0239d5170db953f631fa4a443b2025f8d3fe5b (diff)
downloadsonarqube-5879a094d888e93a7ee4cbe4ed9d4c0ce0c23ac0.tar.gz
sonarqube-5879a094d888e93a7ee4cbe4ed9d4c0ce0c23ac0.zip
SONAR-5183 timezones - migrate issues table from timestamp to long
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/DefaultTimeMachine.java4
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_insert_new_issues-result.xml6
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates-result.xml4
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates.xml4
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues-result.xml6
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues.xml4
6 files changed, 13 insertions, 15 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultTimeMachine.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultTimeMachine.java
index d026bfbb596..79d61dd2f74 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/DefaultTimeMachine.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultTimeMachine.java
@@ -37,11 +37,9 @@ import org.sonar.batch.index.DefaultIndex;
import javax.annotation.Nullable;
import javax.persistence.Query;
-
import java.util.*;
import static org.sonar.api.utils.DateUtils.dateToLong;
-import static org.sonar.api.utils.DateUtils.longToDate;
public class DefaultTimeMachine implements TimeMachine {
@@ -69,7 +67,7 @@ public class DefaultTimeMachine implements TimeMachine {
Integer characteristicId = model.getCharacteristicId();
Characteristic characteristic = techDebtModel.characteristicById(characteristicId);
Measure measure = toMeasure(model, metricById.get(model.getMetricId()), characteristic);
- measure.setDate(longToDate((Long) object[1]));
+ measure.setDate(new Date((Long) object[1]));
result.add(measure);
}
return result;
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_insert_new_issues-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_insert_new_issues-result.xml
index 458ce2553c2..badb286c2e1 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_insert_new_issues-result.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_insert_new_issues-result.xml
@@ -16,9 +16,9 @@
issue_attributes="foo=bar"
tags="[null]"
action_plan_key="[null]"
- issue_creation_date="2013-05-18"
- issue_update_date="2013-05-18"
- issue_close_date="2013-05-18"
+ issue_creation_date="1368828000000"
+ issue_update_date="1368828000000"
+ issue_close_date="1368828000000"
/>
<issue_changes id="1" kee="FGHIJ" issue_key="ABCDE" change_type="comment" user_login="emmerik" change_data="the comment"
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates-result.xml
index e421b224b5e..ef1122b47c6 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates-result.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates-result.xml
@@ -27,8 +27,8 @@
action_plan_key="[null]"
created_at="1400000000000"
updated_at="1400000000000"
- issue_creation_date="2005-05-12 00:00:00.0"
- issue_update_date="2013-05-18 00:00:00.0"
+ issue_creation_date="1115848800000"
+ issue_update_date="1368828000000"
issue_close_date="[null]"
/>
</dataset>
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates.xml b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates.xml
index 0ddfc4586ab..773cc50e1ae 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_resolve_conflicts_on_updates.xml
@@ -27,8 +27,8 @@
action_plan_key="[null]"
created_at="1400000000000"
updated_at="1500000000000"
- issue_creation_date="2005-05-12 00:00:00.0"
- issue_update_date="2013-05-18 00:00:00.0"
+ issue_creation_date="1115848800000"
+ issue_update_date="1368828000000"
issue_close_date="[null]"
/>
</dataset>
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues-result.xml
index ba65e9df145..5e2490d198d 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues-result.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues-result.xml
@@ -21,9 +21,9 @@
issue_attributes="foo=bar"
tags="[null]"
action_plan_key="[null]"
- issue_creation_date="2013-05-18 00:00:00.0"
- issue_update_date="2013-05-18 00:00:00.0"
- issue_close_date="2013-05-18 00:00:00.0"
+ issue_creation_date="1368828000000"
+ issue_update_date="1368828000000"
+ issue_close_date="1368828000000"
/>
<issue_changes id="1" kee="FGHIJ" issue_key="ABCDE" change_type="comment" user_login="emmerik"
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues.xml b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues.xml
index 5fd4a9e813c..afa28e09811 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/issue/ScanIssueStorageTest/should_update_issues.xml
@@ -24,8 +24,8 @@
reporter="emmerik"
issue_attributes="foo=bar"
action_plan_key="[null]"
- issue_creation_date="2010-01-01"
- issue_update_date="2010-02-02"
+ issue_creation_date="1262300400000"
+ issue_update_date="1265065200000"
issue_close_date="[null]"
/>
</dataset>