jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1297544 - /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Date Tue, 06 Mar 2012 16:02:42 GMT
Author: mduerig
Date: Tue Mar  6 16:02:42 2012
New Revision: 1297544

URL: http://svn.apache.org/viewvc?rev=1297544&view=rev
Log:
large child node list tests

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java?rev=1297544&r1=1297543&r2=1297544&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Tue Mar  6 16:02:42 2012
@@ -59,7 +59,10 @@ import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.EventListener;
 import javax.jcr.observation.ObservationManager;
+import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.math.BigDecimal;
@@ -179,31 +182,94 @@ public class RepositoryTest {
 
         double sum = 0.0;
         long t = System.currentTimeMillis();
-        for (int i = 0; i < 1000000; i++) {
+        for (int i = 1; i <= 10000000; i++) {
             node.addNode("node" + i);
             if (i % 1000 == 0) {
                 node.getSession().save();
                 long dt = System.currentTimeMillis() - t;
                 sum += dt;
                 // number,time,average
-                System.out.println(i + "," + dt + "," + sum/(i + 1));
+                System.out.println(i + "," + dt + "," + sum/ i);
                 t = System.currentTimeMillis();
             }
         }
-        
-//        t = System.currentTimeMillis();
-//        Session session = getRepository().login();
-//        try {
-//            Node node2 = session.getNode(testPath);
-//            NodeIterator childNodes = node2.getNodes();
-//            while (childNodes.hasNext()) {
-//                Node child = childNodes.nextNode();
-//            }
-//        }
-//        finally {
-//            System.out.println(System.currentTimeMillis() - t);
-//            session.logout();
-//        }
+    }
+    
+    @Test
+    @Ignore("WIP")
+    public void largeFileList() throws RepositoryException, IOException {
+        Node node = getNode(testPath);
+
+        File image = new File("image.jpg");
+        System.out.println("Image: " + image.getAbsolutePath());
+        InputStream inStream = new BufferedInputStream(new FileInputStream(image));
+        Binary data = node.getSession().getValueFactory().createBinary(inStream);
+
+        double sum = 0.0;
+        long t = System.currentTimeMillis();
+        for (int i = 1; i <= 1000000; i++) {
+            Node file = node.addNode("file" + i, "nt:file");
+            Node content = file.addNode("jcr:content", "nt:resource");
+            content.setProperty("jcr:data", data);
+            if (i % 100 == 0) {
+                node.getSession().save();
+                long dt = System.currentTimeMillis() - t;
+                sum += dt;
+                // number,time,average
+                System.out.println(i + "," + dt + "," + sum/ i);
+                t = System.currentTimeMillis();
+            }
+        }
+
+        inStream.close();
+        data.dispose();
+    }
+    
+    @Test
+    @Ignore("WIP")
+    public void largeNodeFileList() throws RepositoryException, IOException {
+        Node node = getNode(testPath);
+
+        File image = new File("image.jpg");
+        System.out.println("Image: " + image.getAbsolutePath());
+        InputStream inStream = new BufferedInputStream(new FileInputStream(image));
+        Binary data = node.getSession().getValueFactory().createBinary(inStream);
+
+        double sum = 0.0;
+        long t = System.currentTimeMillis();
+        for (int i = 1; i <= 11000000; i++) {
+            if (i > 10000 && i <= 20000 ||
+                i > 100000 && i <= 110000 ||
+                i > 1000000 && i <= 1010000 ||
+                i > 10000000 && i <= 10010000)
+            {
+                Node file = node.addNode("file" + i, "nt:file");
+                Node content = file.addNode("jcr:content", "nt:resource");
+                content.setProperty("jcr:data", data);
+                if (i % 100 == 0) {
+                    node.getSession().save();
+                    long dt = System.currentTimeMillis() - t;
+                    sum += dt;
+                    // number,time,average
+                    System.out.println(i + "," + dt + "," + sum/ i + ",file");
+                    t = System.currentTimeMillis();
+                }
+            }
+            else {
+                node.addNode("node" + i);
+                if (i % 1000 == 0) {
+                    node.getSession().save();
+                    long dt = System.currentTimeMillis() - t;
+                    sum += dt;
+                    // number,time,average
+                    System.out.println(i + "," + dt + "," + sum/i + ",node") ;
+                    t = System.currentTimeMillis();
+                }
+            }
+        }
+
+        inStream.close();
+        data.dispose();
     }
 
     @Test



Mime
View raw message