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;
@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;
}
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
@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;
}
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;
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;
}
@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);
@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);
@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);
}
<!-- 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"
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 -->
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 -->
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 -->
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"/>
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"
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>