Use DateTimeUtils.currentTimeMillis() to get current time
This method from joda-time supports replacing the system time provider with a custom provider for tests. Since it is verbose, and we expect more related methods, put it in the more succinct TimeUtil.nowMs(). This commit covers the trivial cases in the server side; client-side code still uses System.currentTimeMillis(). Change-Id: I6c56e8c5bbb0cf7b0271e431d1ebdb532967b9e8
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.rules;
|
||||
|
||||
import com.google.gerrit.server.util.TimeUtil;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Module;
|
||||
|
||||
@@ -116,7 +117,7 @@ public abstract class PrologTestCase extends TestCase {
|
||||
|
||||
public void runPrologBasedTests() {
|
||||
int errors = 0;
|
||||
long start = System.currentTimeMillis();
|
||||
long start = TimeUtil.nowMs();
|
||||
|
||||
for (Term test : tests) {
|
||||
PrologEnvironment env = envFactory.create(machine);
|
||||
@@ -159,7 +160,7 @@ public abstract class PrologTestCase extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
long end = TimeUtil.nowMs();
|
||||
System.out.println("-------------------------------");
|
||||
System.out.format("Prolog tests: %d, Failures: %d, Time elapsed %.3f sec",
|
||||
tests.size(), errors, (end - start) / 1000.0);
|
||||
|
@@ -30,14 +30,15 @@ import com.google.gerrit.extensions.restapi.RestReadView;
|
||||
import com.google.gerrit.extensions.restapi.RestView;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.CommentRange;
|
||||
import com.google.gerrit.reviewdb.client.Patch;
|
||||
import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.reviewdb.client.PatchLineComment.Status;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.CommentRange;
|
||||
import com.google.gerrit.reviewdb.server.PatchLineCommentAccess;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.account.AccountInfo;
|
||||
import com.google.gerrit.server.util.TimeUtil;
|
||||
import com.google.gwtorm.server.ListResultSet;
|
||||
import com.google.gwtorm.server.ResultSet;
|
||||
import com.google.inject.AbstractModule;
|
||||
@@ -109,7 +110,7 @@ public class CommentsTest extends TestCase {
|
||||
PatchSet ps2 = new PatchSet(psId2);
|
||||
expect(revRes2.getPatchSet()).andReturn(ps2);
|
||||
|
||||
long timeBase = System.currentTimeMillis();
|
||||
long timeBase = TimeUtil.nowMs();
|
||||
plc1 = newPatchLineComment(psId1, "Comment1", null,
|
||||
"FileOne.txt", Side.REVISION, 1, account1, timeBase,
|
||||
"First Comment", new CommentRange(1, 2, 3, 4));
|
||||
|
Reference in New Issue
Block a user