hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [1/5] HBASE-11822 Convert EnvironmentEdge#getCurrentTimeMillis to getCurrentTime
Date Sat, 30 Aug 2014 00:30:18 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 2668cc467 -> 1834196fc


http://git-wip-us.apache.org/repos/asf/hbase/blob/f149c26e/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java
index 0edad8b..71ee595 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java
@@ -784,14 +784,14 @@ public class TestWALReplay {
 
     // Add an edit to another family, should be skipped.
     WALEdit edit = new WALEdit();
-    long now = ee.currentTimeMillis();
+    long now = ee.currentTime();
     edit.add(new KeyValue(rowName, Bytes.toBytes("another family"), rowName,
       now, rowName));
     wal.append(hri, tableName, edit, now, htd, sequenceId);
 
     // Delete the c family to verify deletes make it over.
     edit = new WALEdit();
-    now = ee.currentTimeMillis();
+    now = ee.currentTime();
     edit.add(new KeyValue(rowName, Bytes.toBytes("c"), null, now,
       KeyValue.Type.DeleteFamily));
     wal.append(hri, tableName, edit, now, htd, sequenceId);
@@ -976,8 +976,8 @@ public class TestWALReplay {
       byte[] columnBytes = Bytes.toBytes(familyStr + ":" + Integer.toString(j));
       WALEdit edit = new WALEdit();
       edit.add(new KeyValue(rowName, family, qualifierBytes,
-        ee.currentTimeMillis(), columnBytes));
-      wal.append(hri, tableName, edit, ee.currentTimeMillis(), htd, sequenceId);
+        ee.currentTime(), columnBytes));
+      wal.append(hri, tableName, edit, ee.currentTime(), htd, sequenceId);
     }
   }
 
@@ -989,7 +989,7 @@ public class TestWALReplay {
     for (int j = 0; j < count; j++) {
       byte[] qualifier = Bytes.toBytes(qualifierPrefix + Integer.toString(j));
       Put p = new Put(rowName);
-      p.add(family, qualifier, ee.currentTimeMillis(), rowName);
+      p.add(family, qualifier, ee.currentTime(), rowName);
       r.put(p);
       puts.add(p);
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/f149c26e/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
index f67ab1f..68a99aa 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
@@ -116,7 +116,7 @@ public class TestReplicationSmallTests extends TestReplicationBase {
     final byte[] v3 = Bytes.toBytes("v3");
     htable1 = new HTable(conf1, tableName);
 
-    long t = EnvironmentEdgeManager.currentTimeMillis();
+    long t = EnvironmentEdgeManager.currentTime();
     // create three versions for "row"
     Put put = new Put(row);
     put.add(famName, row, t, v1);

http://git-wip-us.apache.org/repos/asf/hbase/blob/f149c26e/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
index e3ea397..fd8c9a1 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
@@ -367,7 +367,7 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
         try {
           // Store read only ACL at a future time
           Put p = new Put(TEST_ROW).add(TEST_FAMILY1, TEST_Q1,
-            EnvironmentEdgeManager.currentTimeMillis() + 1000000,
+            EnvironmentEdgeManager.currentTime() + 1000000,
             ZERO);
           p.setACL(USER_OTHER.getShortName(), new Permission(Permission.Action.READ));
           t.put(p);

http://git-wip-us.apache.org/repos/asf/hbase/blob/f149c26e/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
index 8f8d92d..1773027 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
@@ -117,7 +117,7 @@ public class TestTokenAuthentication {
 
     public TokenServer(Configuration conf) throws IOException {
       this.conf = conf;
-      this.startcode = EnvironmentEdgeManager.currentTimeMillis();
+      this.startcode = EnvironmentEdgeManager.currentTime();
       // Server to handle client requests.
       String hostname =
         Strings.domainNamePointerToHostName(DNS.getDefaultHost("default", "default"));

http://git-wip-us.apache.org/repos/asf/hbase/blob/f149c26e/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestZKSecretWatcher.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestZKSecretWatcher.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestZKSecretWatcher.java
index d471c39..b22a713 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestZKSecretWatcher.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestZKSecretWatcher.java
@@ -155,7 +155,7 @@ public class TestZKSecretWatcher {
     LOG.debug("Master new current key: "+key3.getKeyId());
 
     // force expire the original key
-    key1.setExpiration(EnvironmentEdgeManager.currentTimeMillis() - 1000);
+    key1.setExpiration(EnvironmentEdgeManager.currentTime() - 1000);
     KEY_MASTER.removeExpiredKeys();
     // verify removed from master
     assertNull(KEY_MASTER.getKey(key1.getKeyId()));

http://git-wip-us.apache.org/repos/asf/hbase/blob/f149c26e/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
index dd2bfd4..dba1bba 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
@@ -115,7 +115,7 @@ public class TestCoprocessorScanPolicy {
     p.add(F, tableName.getName(), Bytes.toBytes(2));
     t.put(p);
 
-    long now = EnvironmentEdgeManager.currentTimeMillis();
+    long now = EnvironmentEdgeManager.currentTime();
 
     // insert 2 versions
     p = new Put(R);
@@ -165,7 +165,7 @@ public class TestCoprocessorScanPolicy {
     desc.addFamily(hcd);
     TEST_UTIL.getHBaseAdmin().createTable(desc);
     HTable t = new HTable(new Configuration(TEST_UTIL.getConfiguration()), tableName);
-    long now = EnvironmentEdgeManager.currentTimeMillis();
+    long now = EnvironmentEdgeManager.currentTime();
     ManualEnvironmentEdge me = new ManualEnvironmentEdge();
     me.setValue(now);
     EnvironmentEdgeManagerTestHelper.injectEdge(me);

http://git-wip-us.apache.org/repos/asf/hbase/blob/f149c26e/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestDefaultEnvironmentEdge.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestDefaultEnvironmentEdge.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestDefaultEnvironmentEdge.java
index 2be502e..b7243ab 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestDefaultEnvironmentEdge.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestDefaultEnvironmentEdge.java
@@ -36,7 +36,7 @@ public class TestDefaultEnvironmentEdge {
   public void testGetCurrentTimeUsesSystemClock() {
     DefaultEnvironmentEdge edge = new DefaultEnvironmentEdge();
     long systemTime = System.currentTimeMillis();
-    long edgeTime = edge.currentTimeMillis();
+    long edgeTime = edge.currentTime();
     assertTrue("System time must be either the same or less than the edge time",
             systemTime < edgeTime || systemTime == edgeTime);
     try {
@@ -44,11 +44,8 @@ public class TestDefaultEnvironmentEdge {
     } catch (InterruptedException e) {
       fail(e.getMessage());
     }
-    long secondEdgeTime = edge.currentTimeMillis();
+    long secondEdgeTime = edge.currentTime();
     assertTrue("Second time must be greater than the first",
             secondEdgeTime > edgeTime);
   }
-
-
-}
-
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hbase/blob/f149c26e/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSHDFSUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSHDFSUtils.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSHDFSUtils.java
index 5c9208a..d82db0d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSHDFSUtils.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSHDFSUtils.java
@@ -53,7 +53,7 @@ public class TestFSHDFSUtils {
 
   @Before
   public void setup() {
-    this.startTime = EnvironmentEdgeManager.currentTimeMillis();
+    this.startTime = EnvironmentEdgeManager.currentTime();
   }
 
   /**
@@ -73,7 +73,7 @@ public class TestFSHDFSUtils {
     Mockito.verify(dfs, Mockito.times(5)).recoverLease(FILE);
     // Make sure we waited at least hbase.lease.recovery.dfs.timeout * 3 (the first two
     // invocations will happen pretty fast... the we fall into the longer wait loop).
-    assertTrue((EnvironmentEdgeManager.currentTimeMillis() - this.startTime) >
+    assertTrue((EnvironmentEdgeManager.currentTime() - this.startTime) >
       (3 * HTU.getConfiguration().getInt("hbase.lease.recovery.dfs.timeout", 61000)));
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/f149c26e/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIncrementingEnvironmentEdge.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIncrementingEnvironmentEdge.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIncrementingEnvironmentEdge.java
index 89450b2..67718d6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIncrementingEnvironmentEdge.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIncrementingEnvironmentEdge.java
@@ -18,13 +18,12 @@
  */
 package org.apache.hadoop.hbase.util;
 
-import org.apache.hadoop.hbase.MediumTests;
+import static junit.framework.Assert.assertEquals;
+
 import org.apache.hadoop.hbase.SmallTests;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import static junit.framework.Assert.assertEquals;
-
 /**
  * Tests that the incrementing environment edge increments time instead of using
  * the default.
@@ -35,11 +34,9 @@ public class TestIncrementingEnvironmentEdge {
   @Test
   public void testGetCurrentTimeUsesSystemClock() {
     IncrementingEnvironmentEdge edge = new IncrementingEnvironmentEdge(1);
-    assertEquals(1, edge.currentTimeMillis());
-    assertEquals(2, edge.currentTimeMillis());
-    assertEquals(3, edge.currentTimeMillis());
-    assertEquals(4, edge.currentTimeMillis());
+    assertEquals(1, edge.currentTime());
+    assertEquals(2, edge.currentTime());
+    assertEquals(3, edge.currentTime());
+    assertEquals(4, edge.currentTime());
   }
-
-}
-
+}
\ No newline at end of file


Mime
View raw message