Bläddra i källkod

svn merge -c 1507165 from trunk for HADOOP-9773. TestLightWeightCache should not set size limit to zero when esting it.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1507167 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze 12 år sedan
förälder
incheckning
ca8723f488

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -377,6 +377,9 @@ Release 2.1.0-beta - 2013-07-02
     HADOOP-9759. Add support for NativeCodeLoader#getLibraryName on Windows.
     (Chuan Liu via cnauroth)
 
+    HADOOP-9773. TestLightWeightCache should not set size limit to zero when
+    testing it.  (szetszwo)
+
   BREAKDOWN OF HADOOP-8562 SUBTASKS AND RELATED JIRAS
 
     HADOOP-8924. Hadoop Common creating package-info.java must not depend on

+ 4 - 3
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestLightWeightCache.java

@@ -27,9 +27,10 @@ import org.junit.Test;
 /** Testing {@link LightWeightCache} */
 public class TestLightWeightCache {
   private static final long starttime = Time.now();
-  private static final Random ran = new Random(starttime);
+  private static final long seed = starttime;
+  private static final Random ran = new Random(seed);
   static {
-    println("Start time = " + new Date(starttime) + ", seed=" +  starttime);
+    println("Start time = " + new Date(starttime) + ", seed=" +  seed);
   }
 
   private static void print(Object s) {
@@ -65,7 +66,7 @@ public class TestLightWeightCache {
     final int dataSize = 1 << 16;
     for(int i = 0; i < 10; i++) {
       final int modulus = ran.nextInt(1024) + 1;
-      final int sizeLimit = ran.nextInt(modulus);
+      final int sizeLimit = ran.nextInt(modulus) + 1;
       checkSizeLimit(sizeLimit, dataSize, modulus);
     }
   }