jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1361186 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
Date Fri, 13 Jul 2012 12:37:10 GMT
Author: jukka
Date: Fri Jul 13 12:37:10 2012
New Revision: 1361186

URL: http://svn.apache.org/viewvc?rev=1361186&view=rev
Log:
Include the random seed value in the RootImplFuzzIT assertion messages

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java?rev=1361186&r1=1361185&r2=1361186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
Fri Jul 13 12:37:10 2012
@@ -54,7 +54,11 @@ public class RootImplFuzzIT {
 
     private static final int OP_COUNT = 5000;
 
-    private final Random random;
+    private static final int SEED = Integer.getInteger(
+            RootImplFuzzIT.class.getSimpleName() + "-seed",
+            new Random().nextInt());
+
+    private static final Random random = new Random(SEED);
 
     private KernelNodeStore store1;
     private RootImpl root1;
@@ -66,13 +70,6 @@ public class RootImplFuzzIT {
 
     private CoreValueFactory vf;
 
-    public RootImplFuzzIT() {
-        int seed = Integer.getInteger(RootImplFuzzIT.class.getSimpleName() + "-seed",
-                new Random().nextInt());
-        log.info("Seed = {}", seed);
-        random = new Random(seed);
-    }
-
     @Before
     public void setup() {
         counter = 0;
@@ -101,7 +98,7 @@ public class RootImplFuzzIT {
             checkEqual(root1.getTree("/"), root2.getTree("/"));
             if (op instanceof Save) {
                 root2.commit(DefaultConflictHandler.OURS);
-                assertEquals(store1.getRoot(), store2.getRoot());
+                assertEquals("seed " + SEED, store1.getRoot(), store2.getRoot());
             }
         }
     }
@@ -431,13 +428,16 @@ public class RootImplFuzzIT {
     }
 
     private static void checkEqual(Tree tree1, Tree tree2) {
-        assertEquals(tree1.getPath() + "!=" + tree2.getPath(), tree1.getPath(), tree2.getPath());
-        assertEquals(tree1.getPath() + "!=" + tree2.getPath(), tree1.getChildrenCount(),
tree2.getChildrenCount());
-        assertEquals(tree1.getPath() + "!=" + tree2.getPath(), tree1.getPropertyCount(),
tree2.getPropertyCount());
+        String message =
+                tree1.getPath() + "!=" + tree2.getPath()
+                + " (seed " + SEED + ")";
+        assertEquals(message, tree1.getPath(), tree2.getPath());
+        assertEquals(message, tree1.getChildrenCount(), tree2.getChildrenCount());
+        assertEquals(message, tree1.getPropertyCount(), tree2.getPropertyCount());
 
         for (PropertyState property1 : tree1.getProperties()) {
             PropertyState property2 = tree2.getProperty(property1.getName());
-            assertEquals(property1 + "!=" + property2, property1, property2);
+            assertEquals(message, property1, property2);
         }
 
         for (Tree child1 : tree1.getChildren()) {



Mime
View raw message