[exo-jcr-commits] exo-jcr SVN: r1455 - in jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster: test and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Jan 18 03:39:04 EST 2010
Author: skabashnyuk
Date: 2010-01-18 03:39:04 -0500 (Mon, 18 Jan 2010)
New Revision: 1455
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestLoadIndexerWriterWithModes.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQueryWithModes.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/prepare/TestLoadIndexerWriterWithModes.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestLoadIndexerWriterWithModes.java 2010-01-17 15:12:24 UTC (rev 1454)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestLoadIndexerWriterWithModes.java 2010-01-18 08:39:04 UTC (rev 1455)
@@ -45,7 +45,7 @@
private volatile boolean stop = false;
- private int threadCount = 1;
+ private int threadCount = 20;
// private int threadCount = 50;
@@ -60,34 +60,42 @@
public void testWrite() throws Exception
{
- System.out.println("Skip (y/n) :");
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- String line = reader.readLine();
- if (!line.equals("y"))
+ try
{
- log.info("Creating threads...");
- for (int i = 0; i < threadCount; i++)
+ System.out.println("Skip (y/n) :");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+ String line = reader.readLine();
+ if (!line.equals("y"))
{
- // create new thread and start it
- new Thread(new WriterTask(i)).start();
- log.info("Thread#" + i + " created and started.");
+ log.info("Creating threads...");
+ for (int i = 0; i < threadCount; i++)
+ {
+ // create new thread and start it
+ new Thread(new WriterTask(i)).start();
+ log.info("Thread#" + i + " created and started.");
+ }
+ startSignal.countDown();
+ // wait 5 minutes
+ try
+ {
+ Thread.sleep(60000 * 500);
+ }
+ catch (InterruptedException e)
+ {
+ log.error(e);
+ }
+
+ stop = true;
}
- startSignal.countDown();
- // wait 5 minutes
- try
+ else
{
- Thread.sleep(60000 * 5);
+ log.info("Wait for data");
}
- catch (InterruptedException e)
- {
- log.error(e);
- }
-
- stop = true;
}
- else
+ catch (Exception e)
{
- log.info("Wait for data");
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
doneSignal.await();
@@ -132,34 +140,39 @@
startSignal.await();
while (!stop)
{
- long time = System.currentTimeMillis();
- // get any word
- int i = random.nextInt(words.length);
- String word = words[i] + id; // "hello12" if thread#12 is creating it
- // update statistic
- updateStatistic(word);
- // add actual node
- createTree().addNode(word);
- sessionLocal.save();
- System.out.println(Thread.currentThread() + " time : " + (System.currentTimeMillis() - time));
-
try
{
- Thread.sleep(300);
+
+ long time = System.currentTimeMillis();
+ // get any word
+ int i = random.nextInt(words.length);
+ String word = words[i] + id; // "hello12" if thread#12 is creating it
+ // update statistic
+ updateStatistic(word);
+ // add actual node
+ createTree().addNode(word);
+ sessionLocal.save();
+ log.info(Thread.currentThread() + " time : " + (System.currentTimeMillis() - time));
+
+ // try
+ // {
+ // Thread.sleep(300);
+ // }
+ // catch (InterruptedException e)
+ // {
+ // }
}
- catch (InterruptedException e)
+ catch (Exception e)
{
+ log.error("An unexpected error happens", e);
}
}
}
- catch (Exception e)
+ catch (InterruptedException e)
{
- log.error("An unexpected error happens", e);
- }
- finally
- {
doneSignal.countDown();
}
+
}
/**
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQueryWithModes.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQueryWithModes.java 2010-01-17 15:12:24 UTC (rev 1454)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQueryWithModes.java 2010-01-18 08:39:04 UTC (rev 1455)
@@ -107,9 +107,10 @@
*/
public void run()
{
- try
+
+ while (!stop)
{
- while (!stop)
+ try
{
Node threadNode = getRandomChild(rootLocal, "Thread*");
if (threadNode != null)
@@ -135,22 +136,22 @@
Query q =
qman.createQuery("SELECT * FROM nt:base WHERE jcr:path LIKE '" + contentNode.getPath()
+ "/%' and fn:name() = '" + word + "'", Query.SQL);
+ long time = System.currentTimeMillis();
QueryResult res = q.execute();
long sqlsize = res.getNodes().getSize();
- log.info("Exp: " + count + "\t found:" + sqlsize);
+ log.info("Exp: " + count + "\t found:" + sqlsize + " time=" + (System.currentTimeMillis() - time));
}
}
}
-
+ catch (RepositoryException e)
+ {
+ log.error(e);
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ }
}
- catch (RepositoryException e)
- {
- log.error(e);
- }
- catch (Exception e)
- {
- log.error(e);
- }
}
More information about the exo-jcr-commits
mailing list