]> source.dussan.org Git - sonarqube.git/commitdiff
Replace Date by Timestamp on all components using MassUpdater
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 13 Mar 2014 15:10:28 +0000 (16:10 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 13 Mar 2014 15:10:28 +0000 (16:10 +0100)
sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueChangelogMigration.java
sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueMigration.java
sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java
sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest.java
sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueMigrationTest.java
sonar-server/src/test/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest.java
sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationTest/migrate_issue_changelog_debt_result.xml
sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueMigrationTest/migrate_issues_debt_result.xml
sonar-server/src/test/resources/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest/copy_requirements_from_characteristics_to_rules_result.xml

index 0bc03306782e060b2a88ece747a96a1e87ab79df..6133183688d654a951bc658d4624e2a3f9ce049f 100644 (file)
@@ -29,10 +29,10 @@ import org.sonar.server.db.migrations.DatabaseMigration;
 import org.sonar.server.db.migrations.MassUpdater;
 import org.sonar.server.db.migrations.SqlUtil;
 
-import java.sql.Date;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Timestamp;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -84,7 +84,7 @@ public class IssueChangelogMigration implements DatabaseMigration {
         @Override
         public boolean convert(Row row, PreparedStatement updateStatement) throws SQLException {
           updateStatement.setString(1, convertChangelog(row.changeData));
-          updateStatement.setDate(2, new Date(system2.now()));
+          updateStatement.setTimestamp(2, new Timestamp(system2.now()));
           updateStatement.setLong(3, row.id);
           return true;
         }
index 0edbfb3a54588ffa7aed0c1412609c3a14d47932..539e1e9d39315ce119b3b67e50eeab605c6cfb48 100644 (file)
@@ -28,10 +28,10 @@ import org.sonar.server.db.migrations.DatabaseMigration;
 import org.sonar.server.db.migrations.MassUpdater;
 import org.sonar.server.db.migrations.SqlUtil;
 
-import java.sql.Date;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Timestamp;
 
 /**
  * Used in the Active Record Migration 513
@@ -80,7 +80,7 @@ public class IssueMigration implements DatabaseMigration {
         @Override
         public boolean convert(Row row, PreparedStatement updateStatement) throws SQLException {
           updateStatement.setLong(1, workDurationConvertor.createFromLong(row.debt));
-          updateStatement.setDate(2, new Date(system2.now()));
+          updateStatement.setTimestamp(2, new Timestamp(system2.now()));
           updateStatement.setLong(3, row.id);
           return true;
         }
index 9a9bdddcc43727ac1d9c9868af90afe7f1a57cae..310168fca93b7642b3299e0d20f67407081aed58 100644 (file)
@@ -176,7 +176,7 @@ public class CopyRequirementsFromCharacteristicsToRules {
         updateStatement.setNull(2, Types.VARCHAR);
         updateStatement.setNull(3, Types.VARCHAR);
         updateStatement.setNull(4, Types.VARCHAR);
-        updateStatement.setDate(5, new Date(system2.now()));
+        updateStatement.setTimestamp(5, new Timestamp(system2.now()));
         updateStatement.setInt(6, ruleRow.getId());
         return true;
 
@@ -194,7 +194,7 @@ public class CopyRequirementsFromCharacteristicsToRules {
           updateStatement.setString(2, ruleRow.getFunction());
           updateStatement.setString(3, ruleRow.getFactor());
           updateStatement.setString(4, ruleRow.getOffset());
-          updateStatement.setDate(5, new Date(system2.now()));
+          updateStatement.setTimestamp(5, new Timestamp(system2.now()));
           updateStatement.setInt(6, ruleRow.getId());
           return true;
         }
index f99b4d748f0ad3d3be8b6a99ee7af03259d759dc..0ce7c54c1de5acc11a6c1487cfbdafef5d1af5c5 100644 (file)
@@ -49,7 +49,7 @@ public class IssueChangelogMigrationTest {
 
   @Before
   public void setUp() throws Exception {
-    when(system2.now()).thenReturn(DateUtils.parseDate("2014-02-19").getTime());
+    when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime());
     settings = new Settings();
     settings.setProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY, 8);
 
index 3527b6e3c6a5ca068bdc2617ee922ccc5ca87ec8..601540c77ac00b76a655bacb392300a8e49171ba 100644 (file)
@@ -48,7 +48,7 @@ public class IssueMigrationTest {
 
   @Before
   public void setUp() throws Exception {
-    when(system2.now()).thenReturn(DateUtils.parseDate("2014-02-19").getTime());
+    when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime());
     settings = new Settings();
     settings.setProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY, 8);
 
index 81890413e127f0a3b7e87ec272694f83aec3ce18..bd67a8b08e7b30cc1c4cb06d04a25e050541ef52 100644 (file)
@@ -51,7 +51,7 @@ public class CopyRequirementsFromCharacteristicsToRulesTest extends AbstractDaoT
 
   @Before
   public void setUp() throws Exception {
-    when(system2.now()).thenReturn(DateUtils.parseDate("2014-03-12").getTime());
+    when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-03-13T19:10:03+0100").getTime());
     service = new CopyRequirementsFromCharacteristicsToRules(db.database(), new RequirementDao(getMyBatis()), status, system2);
   }
 
index 1f176fb01e9fbd083c6340a49660e0569b0a32df..a42f67e500bc190f00d4957eee2a49fc4a552adf 100644 (file)
@@ -2,7 +2,7 @@
 
   <!-- Change from 1 day, 1 hour and 1 minute of debt to 2 days -->
   <issue_changes ID="1" KEE="1" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="technicalDebt=541|960,resolution=,status=RESOLVED|REOPENED"
-                 CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
+                 CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0" ISSUE_CHANGE_CREATION_DATE="2012-01-05"/>
 
   <!-- No change on debt, should not be touched -->
   <issue_changes ID="2" KEE="2" ISSUE_KEY="ABCD" USER_LOGIN ="[null]" CHANGE_TYPE="diff" CHANGE_DATA="status=RESOLVED|REOPENED"
index 1f0c371891a71fc13a6019e63650182c86a0fc99..c8d9eaecc06602e36e80154c8d15177310b8c200 100644 (file)
@@ -5,7 +5,7 @@
           ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
           EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
           ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
           TECHNICAL_DEBT="541"/>
 
   <!-- 1 day debt -->
@@ -13,7 +13,7 @@
           ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
           EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
           ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
           TECHNICAL_DEBT="480"/>
 
   <!-- 1 hour debt -->
@@ -21,7 +21,7 @@
           ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
           EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
           ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
           TECHNICAL_DEBT="60"/>
 
   <!-- 1 minute debt -->
@@ -29,7 +29,7 @@
           ACTION_PLAN_KEY="[null]" ASSIGNEE="[null]" AUTHOR_LOGIN="[null]" CHECKSUM="ABCDE"
           EFFORT_TO_FIX="3.14" ISSUE_ATTRIBUTES="[null]" ISSUE_CLOSE_DATE="[null]" ISSUE_CREATION_DATE="2012-01-05"
           ISSUE_UPDATE_DATE="2012-01-05" LINE="1234" MANUAL_SEVERITY="[false]" MESSAGE="the message" REPORTER="[null]"
-          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19"
+          RESOLUTION="[null]" STATUS="OPEN" CREATED_AT="2012-01-05" UPDATED_AT="2014-02-19 19:10:03.0"
           TECHNICAL_DEBT="1"/>
 
 
index 2faa1762d2bdc9cb001c2d89ccf4d8875e2d5eba..503f39a1d6d562f7887c6db5343df61589353d5e 100644 (file)
@@ -12,7 +12,7 @@
          characteristic_id="-1" default_characteristic_id="10"
          remediation_function="[null]" default_remediation_function="LINEAR_OFFSET"
          remediation_factor="[null]" default_remediation_factor="5d"
-         remediation_offset="[null]" default_remediation_offset="10h" updated_at="2014-03-12"/>
+         remediation_offset="[null]" default_remediation_offset="10h" updated_at="2014-03-13 19:10:03.0"/>
 
   <!-- Removed rule linked to a disabled requirement -> Do nothing -->
   <rules id="3" plugin_rule_key="CallToFileDeleteOnExitMethod" plugin_name="squid" name="CallToFileDeleteOnExitMethod" description="CallToFileDeleteOnExitMethod" status="REMOVED"
@@ -33,6 +33,6 @@
          characteristic_id="10" default_characteristic_id="20"
          remediation_function="LINEAR_OFFSET" default_remediation_function="LINEAR"
          remediation_factor="20min" default_remediation_factor="5d"
-         remediation_offset="30h" default_remediation_offset="[null]" updated_at="2014-03-12"/>
+         remediation_offset="30h" default_remediation_offset="[null]" updated_at="2014-03-13 19:10:03.0"/>
 
 </dataset>