[exo-jcr-commits] exo-jcr SVN: r1432 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Jan 16 07:06:02 EST 2010


Author: skabashnyuk
Date: 2010-01-16 07:06:01 -0500 (Sat, 16 Jan 2010)
New Revision: 1432

Modified:
   jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQuery.java
Log:
EXOJCR-331 : test update

Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQuery.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQuery.java	2010-01-16 11:17:40 UTC (rev 1431)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQuery.java	2010-01-16 12:06:01 UTC (rev 1432)
@@ -18,12 +18,12 @@
  */
 package org.exoplatform.services.jcr.lab.cluster.test;
 
-import junit.framework.AssertionFailedError;
-
 import org.exoplatform.services.jcr.JcrAPIBaseTest;
 import org.exoplatform.services.jcr.core.CredentialsImpl;
 import org.exoplatform.services.jcr.impl.core.SessionImpl;
 import org.exoplatform.services.jcr.lab.cluster.prepare.TestLoadIndexerWriter;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
 
 import java.util.Random;
 
@@ -41,10 +41,13 @@
  */
 public class TestLoadIndexerQuery extends JcrAPIBaseTest
 {
+
+   private Log log = ExoLogger.getLogger(TestLoadIndexerQuery.class);
+
    private boolean stop = false;
-   
-   private int threadCount = 1;
 
+   private int threadCount = 20;
+
    public void testQuery() throws RepositoryException
    {
       log.info("Creating threads...");
@@ -58,7 +61,7 @@
       // wait 4 minutes
       try
       {
-         Thread.sleep(60000 * 4);
+         Thread.sleep(60000 * 4000);
       }
       catch (InterruptedException e)
       {
@@ -99,6 +102,7 @@
                if (threadNode != null)
                {
                   Node statisticNode = threadNode.getNode(TestLoadIndexerWriter.STATISTIC);
+                  Node contentNode = threadNode.getNode(TestLoadIndexerWriter.CONTENT);
                   Node wordNode = getRandomChild(statisticNode, "*");
                   if (wordNode != null)
                   {
@@ -112,21 +116,15 @@
                      catch (InterruptedException e1)
                      {
                      }
-                     
+
                      QueryManager qman = sessionLocal.getWorkspace().getQueryManager();
 
-                     Query q = qman.createQuery("SELECT * FROM nt:base WHERE fn:name() = '" + word + "'", Query.SQL);
+                     Query q =
+                        qman.createQuery("SELECT * FROM nt:base WHERE jcr:path LIKE '" + contentNode.getPath()
+                           + "/%' and fn:name() = '" + word + "'", Query.SQL);
                      QueryResult res = q.execute();
                      long sqlsize = res.getNodes().getSize();
-                     try
-                     {
-                        assertTrue("Exp: "+count+"\t found:"+sqlsize, sqlsize >= count);
-                        System.out.println("+("+sqlsize+")");
-                     }
-                     catch (AssertionFailedError e)
-                     {
-                        System.out.println("-"+e.getMessage());
-                     }
+                     log.info("Exp: " + count + "\t found:" + sqlsize);
                   }
                }
             }
@@ -136,6 +134,11 @@
          {
             log.error(e);
          }
+         catch (Exception e)
+         {
+            log.error(e);
+         }
+
       }
 
       private Node getRandomChild(Node parent, String pattern) throws RepositoryException



More information about the exo-jcr-commits mailing list