jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r792849 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java
Date Fri, 10 Jul 2009 09:18:43 GMT
Author: thomasm
Date: Fri Jul 10 09:18:39 2009
New Revision: 792849

URL: http://svn.apache.org/viewvc?rev=792849&view=rev
Log:
JCR-2134 Data Store: avoid creating temporary files - improve test

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java?rev=792849&r1=792848&r2=792849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java
Fri Jul 10 09:18:39 2009
@@ -55,7 +55,13 @@
 
         Node root = superuser.getRootNode();
         ValueFactory vf = superuser.getValueFactory();
+
+        long time = System.currentTimeMillis();
         root.setProperty("p1", vf.createBinary(new RandomInputStream(1, STREAM_LENGTH)));
+        superuser.save();
+        long saveOne = System.currentTimeMillis() - time;
+        System.out.println("save one took " + saveOne);
+
         root.setProperty("p2", vf.createBinary(new RandomInputStream(1, STREAM_LENGTH)));
         superuser.save();
 
@@ -71,7 +77,7 @@
         }
 
         // copying a value should not stream the content
-        long time = System.currentTimeMillis();
+        time = System.currentTimeMillis();
         for (int i = 0; i < 100; i++) {
             Value v = root.getProperty("p1").getValue();
             root.setProperty("p3", v);
@@ -80,7 +86,8 @@
         time = System.currentTimeMillis() - time;
         // streaming 1 MB again and again takes about 4.3 seconds
         // on my computer; copying the data identifier takes about 16 ms
-        assertTrue("time: " + time, time < 100);
+        // here we test if copying 100 objects took less than saving 50 new objects
+        assertTrue("time: " + time, time < saveOne * 50);
 
     }
 



Mime
View raw message