Author: skabashnyuk
Date: 2010-02-05 11:52:40 -0500 (Fri, 05 Feb 2010)
New Revision: 1706
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractTestAgent.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/NodeInfo.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/WorkerResult.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/AbstractWebDavTestAgent.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavTestAgent.java
Removed:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AvgResponceTimeTest.java
Log:
EXOJCR-395 : load test update
Copied:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java
(from rev 1697,
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AvgResponceTimeTest.java)
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java 2010-02-05
16:52:40 UTC (rev 1706)
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public abstract class AbstractAvgResponceTimeTest
+{
+
+ private final int iterationGrowingPoll;
+
+ private final int iterationTime;
+
+ private final int initialSize;
+
+ private final int readValue;
+
+ /**
+ * @param iterationGrowingPoll
+ * @param iterationTime
+ * @param initialSize
+ */
+ public AbstractAvgResponceTimeTest(int iterationGrowingPoll, int iterationTime, int
initialSize, int readValue)
+ {
+ super();
+ this.iterationGrowingPoll = iterationGrowingPoll;
+ this.iterationTime = iterationTime;
+ this.initialSize = initialSize;
+ this.readValue = readValue;
+ }
+
+ public void testResponce() throws Exception
+ {
+ final List<NodeInfo> nodesPath = new ArrayList<NodeInfo>();
+ //start from 1 thread
+ int threadCount = initialSize;
+
+ Random random = new Random();
+
+ while (true)
+ {
+
+ final List<WorkerResult> responceResults =
Collections.synchronizedList(new ArrayList<WorkerResult>());
+
+ ExecutorService threadPool = Executors.newFixedThreadPool(threadCount);
+ CountDownLatch startSignal = new CountDownLatch(1);
+ AbstractTestAgent[] testAgents = new AbstractTestAgent[threadCount];
+ //pool initialization
+ for (int i = 0; i < threadCount; i++)
+ {
+ testAgents[i] = getAgent(nodesPath, responceResults, startSignal, readValue,
random);
+ threadPool.execute(testAgents[i]);
+
+ }
+ responceResults.clear();
+ startSignal.countDown();//let all threads proceed
+
+ Thread.sleep(iterationTime);
+
+ threadPool.shutdown();
+ for (int i = 0; i < testAgents.length; i++)
+ {
+ testAgents[i].setShouldStop(true);
+ }
+ //wait 10 minutes
+ threadPool.awaitTermination(60 * 10, TimeUnit.SECONDS);
+ dumpResults(responceResults, threadCount);
+ threadCount += iterationGrowingPoll;
+ }
+ }
+
+ /**
+ * Create new agent
+ * @param nodesPath
+ * @param responceResults
+ * @param startSignal
+ * @param READ_VALUE
+ * @param random
+ * @return
+ */
+ protected abstract AbstractTestAgent getAgent(List<NodeInfo> nodesPath,
List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int readValue, Random random);
+
+ private void dumpResults(List<WorkerResult> responceResults, int threadCount)
+ {
+ long sum_read = 0;
+ long sum_write = 0;
+ long read = 0;
+ long write = 0;
+ for (WorkerResult workerResult : responceResults)
+ {
+
+ if (workerResult.isRead())
+ {
+ read++;
+ sum_read += workerResult.getResponceTime();
+ }
+ else
+ {
+ write++;
+ sum_write += workerResult.getResponceTime();
+ }
+ }
+ if ((read + write) > 0)
+ {
+ System.out.println(" ThreadCount= " + threadCount + " Read="
+ read + " Write=" + write + " value "
+ + (read * 100 / (read + write)) + " Avg read resp=" + (read > 0
? (sum_read / read) : 0)
+ + " Avg write resp=" + (write > 0 ? (sum_write / write) : 0));
+ }
+ responceResults.clear();
+ }
+}
Property changes on:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractTestAgent.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractTestAgent.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractTestAgent.java 2010-02-05
16:52:40 UTC (rev 1706)
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load;
+
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public abstract class AbstractTestAgent implements Runnable
+{
+
+ protected final Random random;
+
+ private final int readValue;
+
+ private final CountDownLatch startSignal;
+
+ private final List<NodeInfo> nodesPath;
+
+ private final List<WorkerResult> responceResults;
+
+ private boolean shouldStop = false;
+
+ /**
+ *
+ */
+ public AbstractTestAgent(List<NodeInfo> nodesPath, List<WorkerResult>
responceResults, CountDownLatch startSignal,
+ int readValue, Random random)
+ {
+ this.nodesPath = nodesPath;
+ this.responceResults = responceResults;
+ this.random = random;
+ this.startSignal = startSignal;
+ this.readValue = readValue;
+ }
+
+ /**
+ * Do read
+ * @return
+ */
+ public abstract List<WorkerResult> doRead(List<NodeInfo> nodesPath);
+
+ /**
+ * Do write
+ * @return
+ */
+ public abstract List<WorkerResult> doWrite(List<NodeInfo> nodesPath);
+
+ /**
+ * @see java.lang.Runnable#run()
+ */
+ public void run()
+ {
+ try
+ {
+ startSignal.await();
+ while (!shouldStop)
+ {
+ if (random.nextInt(100) > readValue)
+ {
+
+ responceResults.addAll(doWrite(nodesPath));
+ }
+ else
+ {
+ responceResults.addAll(doRead(nodesPath));
+ }
+ }
+ }
+ catch (InterruptedException e)
+ {
+ // exit
+ }
+ }
+
+ /**
+ * @return the shouldStop
+ */
+ protected boolean isShouldStop()
+ {
+ return shouldStop;
+ }
+
+ /**
+ * @param shouldStop the shouldStop to set
+ */
+ protected void setShouldStop(boolean shouldStop)
+ {
+ this.shouldStop = shouldStop;
+ }
+
+}
Property changes on:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractTestAgent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AvgResponceTimeTest.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AvgResponceTimeTest.java 2010-02-05
16:16:16 UTC (rev 1705)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AvgResponceTimeTest.java 2010-02-05
16:52:40 UTC (rev 1706)
@@ -1,350 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.cluster.load;
-
-import junit.framework.TestCase;
-
-import org.exoplatform.common.http.client.HTTPResponse;
-import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-import java.util.Timer;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
- *
- */
-public class AvgResponceTimeTest extends TestCase
-{
- /**
- * WebDav realm
- */
- private String WEBDAV_REALM = "eXo REST services";
-
- /**
- * WebDav path
- */
- private String WEBDAV_DEFAULT_PATH = "/rest/jcr/repository/production/";
-
- /**
- * 10 sec default sampling time.
- */
- private static final int SAMPLING_TIME = 14000;
-
- /**
- * 2min default time of work of one iteration.
- */
- private static final int ITERATION_TIME = 60 * 1000;
-
- /**
- * How much thread will be added on the next iteration.
- */
- private static final int ITERATION_GROWING_POLL = 5;
-
- /**
- * Number between 0 and 100 show % how many read operations.
- */
- private static final int READ_VALUE = 90;
-
- private static final Random random = new Random();
-
- private volatile static long l1FolderCount = 0;
-
- private static long lastCleanTime;
-
- /**
- * Statistic dumper task
- */
- private static final Timer STAT_TIMER = new Timer(true);
-
- public void testResponce() throws Exception
- {
- final List<NodeInfo> nodesPath = new ArrayList<NodeInfo>();
- //start from 1 thread
- int threadCount = 0;
- lastCleanTime = System.currentTimeMillis();
-
- while (true)
- {
-
- final List<WorkerResult> responceResults =
Collections.synchronizedList(new ArrayList<WorkerResult>());
- threadCount += ITERATION_GROWING_POLL;
- ExecutorService tp = Executors.newFixedThreadPool(threadCount);
- WorkerThread[] workedThread = new WorkerThread[threadCount];
- for (int i = 0; i < threadCount; i++)
- {
- workedThread[i] = new WorkerThread(nodesPath, responceResults);
- tp.execute(workedThread[i]);
-
- }
- responceResults.clear();
- System.out.println("Thread started " + threadCount);
- Thread.sleep(ITERATION_TIME);
-
- for (int i = 0; i < workedThread.length; i++)
- {
- workedThread[i].setShoudRun(false);
- }
- tp.shutdown();
- //wait 10 minutes
- tp.awaitTermination(60 * 10, TimeUnit.SECONDS);
- dumpResults(responceResults);
- responceResults.clear();
-
- }
- }
-
- public static void dumpResults(List<WorkerResult> responceResults)
- {
- long sum_read = 0;
- long sum_write = 0;
- long read = 0;
- long write = 0;
- for (WorkerResult workerResult : responceResults)
- {
-
- if (workerResult.isRead)
- {
- read++;
- sum_read += workerResult.responceTime;
- }
- else
- {
- write++;
- sum_write += workerResult.responceTime;
- }
- }
- if ((read + write) > 0)
- {
- System.out.println("Read=" + read + " Write=" + write +
" value " + (read * 100 / (read + write))
- + " Avg read resp=" + (read > 0 ? (sum_read / read) : 0) +
" Avg write resp="
- + (write > 0 ? (sum_write / write) : 0));
- //System.out.println(responceResults);
- }
- responceResults.clear();
- }
-
- private class NodeInfo
- {
- private final String path;
-
- private final long created;
-
- /**
- * @param path
- * @param created
- */
- public NodeInfo(String path, long created)
- {
- super();
- this.path = path;
- this.created = created;
- }
-
- }
-
- private class WorkerResult
- {
- private final boolean isRead;
-
- private final long responceTime;
-
- /**
- * @param isRead
- * @param responceTime
- */
- public WorkerResult(boolean isRead, long responceTime)
- {
- super();
- this.isRead = isRead;
- this.responceTime = responceTime;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString()
- {
- return "WorkerResult [isRead=" + isRead + ", responceTime="
+ responceTime + "]";
- }
-
- }
-
- private class WorkerThread implements Runnable
- {
-
- private final List<WorkerResult> responceResults;
-
- private final List<NodeInfo> nodesPath;
-
- private String l1FolderName;
-
- private long l2FolderCount;
-
- private boolean shoudRun;
-
- /**
- * @param nodesPath
- * @param resultsList
- */
- public WorkerThread(List<NodeInfo> nodesPath, List<WorkerResult>
responceResults)
- {
- this.nodesPath = nodesPath;
- this.responceResults = responceResults;
- this.shoudRun = true;
- }
-
- /**
- * @see java.lang.Runnable#run()
- */
- public void run()
- {
-
- while (shoudRun)
- {
- if (random.nextInt(100) > READ_VALUE)
- {
-
- doWrite();
- }
- else
- {
- doRead();
- }
- }
-
- }
-
- /**
- * @return the shoudRun
- */
- protected boolean isShoudRun()
- {
- return shoudRun;
- }
-
- /**
- * @param shoudRun the shoudRun to set
- */
- protected void setShoudRun(boolean shoudRun)
- {
- this.shoudRun = shoudRun;
- }
-
- private JCRWebdavConnection getNewConnection()
- {
- return new JCRWebdavConnection("192.168.0.129", 80, "root",
"exo", WEBDAV_REALM, WEBDAV_DEFAULT_PATH);
- }
-
- /**
- * Make write operation.
- */
- private void doWrite()
- {
- long start = 0;
- JCRWebdavConnection connection = null;
- try
- {
- connection = getNewConnection();
-
- if (l1FolderName == null || l2FolderCount == 100)
- {
- l1FolderName = "folder" + (l1FolderCount++);
- start = System.currentTimeMillis();
- connection.addDir(l1FolderName);
- l2FolderCount = 0;
- responceResults.add(new WorkerResult(false, System.currentTimeMillis() -
start));
- }
- String path = l1FolderName + "/" + "node" +
l2FolderCount++;
- start = System.currentTimeMillis();
- HTTPResponse response = connection.addNode(path,
("__the_data_in_nt+file__" + l2FolderCount).getBytes());
-
- if (response.getStatusCode() != 201)
- {
- System.out.println(Thread.currentThread().getName() + " : Can not add
(response code "
- + response.getStatusCode() + new String(response.getData()) + " )
node with path : " + path);
- }
- responceResults.add(new WorkerResult(false, System.currentTimeMillis() -
start));
- nodesPath.add(new NodeInfo(path, System.currentTimeMillis()));
- }
- catch (Exception e)
- {
- System.out.println(e.getLocalizedMessage());
- }
- finally
- {
- if (connection != null)
- {
- connection.stop();
- }
- }
-
- }
-
- /**
- * Make
- */
- private void doRead()
- {
- if (nodesPath.size() > 0)
- {
-
- String readNodePath = null;
- while (readNodePath == null)
- {
- NodeInfo nodeInfo = nodesPath.get(random.nextInt(nodesPath.size()));
- // if ((System.currentTimeMillis() - nodeInfo.created) >
30000)
- // {
- readNodePath = nodeInfo.path;
- // }
-
- }
- long start = System.currentTimeMillis();
- JCRWebdavConnection conn = getNewConnection();
- try
- {
- HTTPResponse response = conn.getNode(readNodePath);
- if (response.getStatusCode() != 200)
- {
- System.out.println("Can not get (response code " +
response.getStatusCode()
- + new String(response.getData()) + " ) node with path : "
+ readNodePath);
- }
-
- }
- catch (Exception e)
- {
- System.out.println(e.getLocalizedMessage());
- }
- finally
- {
- conn.stop();
- }
- responceResults.add(new WorkerResult(true, System.currentTimeMillis() -
start));
- }
- }
- }
-}
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/NodeInfo.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/NodeInfo.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/NodeInfo.java 2010-02-05
16:52:40 UTC (rev 1706)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+
+public class NodeInfo
+{
+ private final String path;
+
+ private final long created;
+
+ /**
+ * @param path
+ * @param created
+ */
+ public NodeInfo(String path, long created)
+ {
+ super();
+ this.path = path;
+ this.created = created;
+ }
+
+ /**
+ * @return the created
+ */
+ public long getCreated()
+ {
+ return created;
+ }
+
+ /**
+ * @return the path
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+}
\ No newline at end of file
Property changes on:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/NodeInfo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/WorkerResult.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/WorkerResult.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/WorkerResult.java 2010-02-05
16:52:40 UTC (rev 1706)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load;
+
+public class WorkerResult
+{
+
+ private final boolean isRead;
+
+ private final long responceTime;
+
+ /**
+ * @param isRead
+ * @param responceTime
+ * @param abstractAvgResponceTimeTest TODO
+ */
+ public WorkerResult(boolean isRead, long responceTime)
+ {
+ super();
+ this.isRead = isRead;
+ this.responceTime = responceTime;
+ }
+
+ /**
+ * @return the isRead
+ */
+ public boolean isRead()
+ {
+ return isRead;
+ }
+
+ /**
+ * @return the responceTime
+ */
+ public long getResponceTime()
+ {
+ return responceTime;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "WorkerResult [isRead=" + isRead + ", responceTime=" +
responceTime + "]";
+ }
+
+}
\ No newline at end of file
Property changes on:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/WorkerResult.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java 2010-02-05
16:52:40 UTC (rev 1706)
@@ -0,0 +1,300 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load.query;
+
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+import org.exoplatform.services.jcr.cluster.load.AbstractAvgResponceTimeTest;
+import org.exoplatform.services.jcr.cluster.load.AbstractTestAgent;
+import org.exoplatform.services.jcr.cluster.load.NodeInfo;
+import org.exoplatform.services.jcr.cluster.load.WorkerResult;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryResult;
+import javax.jcr.version.VersionException;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public class JcrQueryAvgResponceTimeTest extends JcrImplBaseTest
+{
+
+ /**
+ * 2min default time of work of one iteration.
+ */
+ private static final int ITERATION_TIME = 60 * 1000;
+
+ /**
+ * How much thread will be added on the next iteration.
+ */
+ private static final int ITERATION_GROWING_POLL = 5;
+
+ /**
+ * Number between 0 and 100 show % how many read operations.
+ */
+ private static final int READ_VALUE = 90;
+
+ private static final String[] words =
+ new String[]{"private", "branch", "final",
"string", "logging", "bottle", "property",
"node", "repository",
+ "exception", "cycle", "value", "index",
"meaning", "strange", "words", "hello",
"outline", "finest",
+ "basetest", "writer"};
+
+ public static final String FIELDNAME_COUNT = "count";
+
+ public static final String FIELDNAME_CONTENT = "Content";
+
+ public static final String FIELDNAME_STATISTIC = "Statistic";
+
+ public void testname() throws Exception
+ {
+ QueryAvgResponceTimeTest test =
+ new QueryAvgResponceTimeTest(repository, ITERATION_GROWING_POLL, ITERATION_TIME,
1, READ_VALUE);
+ test.testResponce();
+
+ }
+
+ private class QueryAvgResponceTimeTest extends AbstractAvgResponceTimeTest
+ {
+
+ private final RepositoryImpl repository;
+
+ /**
+ * @param iterationGrowingPoll
+ * @param iterationTime
+ * @param initialSize
+ * @param readValue
+ */
+ public QueryAvgResponceTimeTest(RepositoryImpl repository, int
iterationGrowingPoll, int iterationTime,
+ int initialSize, int readValue)
+ {
+ super(iterationGrowingPoll, iterationTime, initialSize, readValue);
+ this.repository = repository;
+ }
+
+ /**
+ * @see
org.exoplatform.services.jcr.cluster.load.AbstractAvgResponceTimeTest#getAgent(java.util.List,
java.util.List, java.util.concurrent.CountDownLatch, int, java.util.Random)
+ */
+ @Override
+ protected AbstractTestAgent getAgent(List<NodeInfo> nodesPath,
List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int readValue, Random random)
+ {
+ return new QueryTestAgent(repository, nodesPath, responceResults, startSignal,
readValue, random);
+ }
+
+ }
+
+ private class QueryTestAgent extends AbstractTestAgent
+ {
+ private final RepositoryImpl repository;
+
+ private UUID threadUUID;
+
+ /**
+ * @param repository
+ * @param nodesPath
+ * @param responceResults
+ * @param startSignal
+ * @param READ_VALUE
+ * @param random
+ */
+ public QueryTestAgent(RepositoryImpl repository, List<NodeInfo> nodesPath,
List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int readValue, Random random)
+ {
+ super(nodesPath, responceResults, startSignal, readValue, random);
+ this.threadUUID = UUID.randomUUID();
+ this.repository = repository;
+ initRoot();
+ }
+
+ /**
+ * @param repository
+ * @throws LoginException
+ * @throws NoSuchWorkspaceException
+ * @throws RepositoryException
+ * @throws ItemExistsException
+ * @throws PathNotFoundException
+ * @throws VersionException
+ * @throws ConstraintViolationException
+ * @throws LockException
+ * @throws AccessDeniedException
+ * @throws InvalidItemStateException
+ * @throws NoSuchNodeTypeException
+ */
+ private void initRoot()
+ {
+ try
+ {
+ CredentialsImpl credentials = new CredentialsImpl("admin",
"admin".toCharArray());
+ Session sessionLocal = repository.login(credentials, "ws");
+ // prepare nodes
+ Node wsRoot = sessionLocal.getRootNode();
+ Node threadNode = wsRoot.addNode("Thread" + threadUUID);
+ sessionLocal.save();
+ sessionLocal.logout();
+ sessionLocal = null;
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * @see
org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doRead(java.util.List)
+ */
+ @Override
+ public List<WorkerResult> doRead(List<NodeInfo> nodesPath)
+ {
+ List<WorkerResult> result = new ArrayList<WorkerResult>();
+ Session sessionLocal = null;
+ try
+ {
+ // login
+ CredentialsImpl credentials = new CredentialsImpl("admin",
"admin".toCharArray());
+ sessionLocal = repository.login(credentials, "ws");
+ // prepare nodes
+ int i = random.nextInt(words.length);
+ String word = words[i];
+ Query q =
+ sessionLocal.getWorkspace().getQueryManager().createQuery(
+ "SELECT * FROM nt:base WHERE " + FIELDNAME_CONTENT +
"='" + word + "'", Query.SQL);
+ long start = System.currentTimeMillis();
+ QueryResult res = q.execute();
+ long sqlsize = res.getNodes().getSize();
+ result.add(new WorkerResult(true, System.currentTimeMillis() - start));
+ //log.info(word + " found:" + sqlsize + " time=" +
(System.currentTimeMillis() - start));
+
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ }
+ finally
+ {
+ if (sessionLocal != null)
+ {
+ sessionLocal.logout();
+ sessionLocal = null;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @see
org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doWrite(java.util.List)
+ */
+ @Override
+ public List<WorkerResult> doWrite(List<NodeInfo> nodesPath)
+ {
+ List<WorkerResult> result = new ArrayList<WorkerResult>();
+ // get any word
+ int i = random.nextInt(words.length);
+ String word = words[i];
+
+ Session sessionLocal = null;
+ try
+ {
+ CredentialsImpl credentials = new CredentialsImpl("admin",
"admin".toCharArray());
+ sessionLocal = repository.login(credentials, "ws");
+ long start = System.currentTimeMillis();
+ Node threadNode = sessionLocal.getRootNode().getNode("Thread" +
threadUUID);
+ addCountent(threadNode, UUID.randomUUID(), word);
+ sessionLocal.save();
+ result.add(new WorkerResult(false, System.currentTimeMillis() - start));
+ //log.info(word + " time : " + (System.currentTimeMillis() -
start));
+ }
+ catch (Exception e1)
+ {
+ if (sessionLocal != null)
+ {
+ // discard session changes
+ try
+ {
+ sessionLocal.refresh(false);
+ }
+ catch (RepositoryException e)
+ {
+ log.error("An error occurs", e);
+ }
+ }
+ log.error("An error occurs", e1);
+ }
+ finally
+ {
+ if (sessionLocal != null)
+ {
+ sessionLocal.logout();
+ sessionLocal = null;
+ }
+ }
+ return result;
+ }
+
+ private void addCountent(Node testRoot, UUID nodePath, String content) throws
RepositoryException
+ {
+ String uuidPath = nodePath.toString();
+ Node l1 = addOrCreate(uuidPath.substring(0, 8), testRoot);
+ Node l2 = addOrCreate(uuidPath.substring(9, 13), l1);
+ Node l3 = addOrCreate(uuidPath.substring(14, 18), l2);
+ Node l4 = addOrCreate(uuidPath.substring(19, 23), l3);
+ Node l5 = addOrCreate(uuidPath.substring(24), l4);
+ l5.setProperty(FIELDNAME_CONTENT, content);
+ }
+
+ /**
+ * Gets or creates node
+ *
+ * @param name
+ * @param parent
+ * @return
+ * @throws RepositoryException
+ */
+ private Node addOrCreate(String name, Node parent) throws RepositoryException
+ {
+ if (parent.hasNode(name))
+ {
+ return parent.getNode(name);
+ }
+ return parent.addNode(name);
+ }
+ }
+}
Property changes on:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/AbstractWebDavTestAgent.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/AbstractWebDavTestAgent.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/AbstractWebDavTestAgent.java 2010-02-05
16:52:40 UTC (rev 1706)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load.webdav;
+
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
+import org.exoplatform.services.jcr.cluster.load.AbstractTestAgent;
+import org.exoplatform.services.jcr.cluster.load.NodeInfo;
+import org.exoplatform.services.jcr.cluster.load.WorkerResult;
+
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public abstract class AbstractWebDavTestAgent extends AbstractTestAgent
+{
+ /**
+ * WebDav realm
+ */
+ private static final String WEBDAV_REALM = "eXo REST services";
+
+ /**
+ * WebDav path
+ */
+ private static final String WEBDAV_DEFAULT_PATH =
"/rest/jcr/repository/production/";
+
+ /**
+ * @param nodesPath
+ * @param responceResults
+ * @param startSignal
+ * @param READ_VALUE
+ * @param random
+ */
+ public AbstractWebDavTestAgent(List<NodeInfo> nodesPath,
List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int READ_VALUE, Random random)
+ {
+ super(nodesPath, responceResults, startSignal, READ_VALUE, random);
+ }
+
+ protected JCRWebdavConnection getNewConnection()
+ {
+ return new JCRWebdavConnection("192.168.0.129", 80, "root",
"exo", WEBDAV_REALM, WEBDAV_DEFAULT_PATH);
+ }
+}
Property changes on:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/AbstractWebDavTestAgent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java 2010-02-05
16:52:40 UTC (rev 1706)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load.webdav;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.services.jcr.cluster.load.AbstractAvgResponceTimeTest;
+import org.exoplatform.services.jcr.cluster.load.AbstractTestAgent;
+import org.exoplatform.services.jcr.cluster.load.NodeInfo;
+import org.exoplatform.services.jcr.cluster.load.WorkerResult;
+
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public class WebDavAvgResponceTimeTest extends TestCase
+{
+
+ /**
+ * 2min default time of work of one iteration.
+ */
+ private static final int ITERATION_TIME = 60 * 1000;
+
+ /**
+ * How much thread will be added on the next iteration.
+ */
+ private static final int ITERATION_GROWING_POLL = 5;
+
+ /**
+ * Number between 0 and 100 show % how many read operations.
+ */
+ private static final int READ_VALUE = 90;
+
+ public void testWebDav() throws Exception
+ {
+ WebDavTest test = new WebDavTest(ITERATION_GROWING_POLL, ITERATION_TIME, 1,
READ_VALUE);
+ test.testResponce();
+ }
+
+ private class WebDavTest extends AbstractAvgResponceTimeTest
+ {
+ /**
+ * @param iterationGrowingPoll
+ * @param iterationTime
+ * @param initialSize
+ * @param readValue
+ */
+ public WebDavTest(int iterationGrowingPoll, int iterationTime, int initialSize, int
readValue)
+ {
+ super(iterationGrowingPoll, iterationTime, initialSize, readValue);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @see
org.exoplatform.services.jcr.cluster.load.AbstractAvgResponceTimeTest#getAgent(java.util.List,
java.util.List, java.util.concurrent.CountDownLatch, int, java.util.Random)
+ */
+ @Override
+ protected AbstractTestAgent getAgent(List<NodeInfo> nodesPath,
List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int readValue, Random random)
+ {
+ return new WebDavTestAgent(nodesPath, responceResults, startSignal, readValue,
random);
+ }
+
+ }
+}
Property changes on:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavTestAgent.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavTestAgent.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavTestAgent.java 2010-02-05
16:52:40 UTC (rev 1706)
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load.webdav;
+
+import org.exoplatform.common.http.client.HTTPResponse;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
+import org.exoplatform.services.jcr.cluster.load.NodeInfo;
+import org.exoplatform.services.jcr.cluster.load.WorkerResult;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public class WebDavTestAgent extends AbstractWebDavTestAgent
+{
+
+ private volatile static long l1FolderCount = 0;
+
+ private String l1FolderName;
+
+ private long l2FolderCount;
+
+ /**
+ * @param nodesPath
+ * @param responceResults
+ * @param startSignal
+ * @param READ_VALUE
+ * @param random
+ */
+ public WebDavTestAgent(List<NodeInfo> nodesPath, List<WorkerResult>
responceResults, CountDownLatch startSignal,
+ int READ_VALUE, Random random)
+ {
+ super(nodesPath, responceResults, startSignal, READ_VALUE, random);
+ }
+
+ /**
+ * @see
org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doRead(java.util.List)
+ */
+ @Override
+ public List<WorkerResult> doRead(List<NodeInfo> nodesPath)
+ {
+ List<WorkerResult> result = new ArrayList<WorkerResult>();
+ if (nodesPath.size() > 0)
+ {
+
+ String readNodePath = null;
+ while (readNodePath == null)
+ {
+ NodeInfo nodeInfo = nodesPath.get(random.nextInt(nodesPath.size()));
+ // if ((System.currentTimeMillis() - nodeInfo.created) >
30000)
+ // {
+ readNodePath = nodeInfo.getPath();
+ // }
+
+ }
+ long start = System.currentTimeMillis();
+ JCRWebdavConnection conn = getNewConnection();
+ try
+ {
+ HTTPResponse response = conn.getNode(readNodePath);
+ if (response.getStatusCode() != 200)
+ {
+ System.out.println("Can not get (response code " +
response.getStatusCode()
+ + new String(response.getData()) + " ) node with path : " +
readNodePath);
+ }
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getLocalizedMessage());
+ }
+ finally
+ {
+ conn.stop();
+ }
+
+ result.add(new WorkerResult(true, System.currentTimeMillis() - start));
+
+ }
+ return result;
+ }
+
+ /**
+ * @see
org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doWrite(java.util.List)
+ */
+ @Override
+ public List<WorkerResult> doWrite(List<NodeInfo> nodesPath)
+ {
+ List<WorkerResult> result = new ArrayList<WorkerResult>();
+ long start = 0;
+ JCRWebdavConnection connection = null;
+ try
+ {
+ connection = getNewConnection();
+
+ if (l1FolderName == null || l2FolderCount == 100)
+ {
+ l1FolderName = "folder" + (l1FolderCount++);
+ start = System.currentTimeMillis();
+ connection.addDir(l1FolderName);
+ l2FolderCount = 0;
+ result.add(new WorkerResult(false, System.currentTimeMillis() - start));
+ }
+ String path = l1FolderName + "/" + "node" +
l2FolderCount++;
+ start = System.currentTimeMillis();
+ HTTPResponse response = connection.addNode(path,
("__the_data_in_nt+file__" + l2FolderCount).getBytes());
+
+ if (response.getStatusCode() != 201)
+ {
+ System.out.println(Thread.currentThread().getName() + " : Can not add
(response code "
+ + response.getStatusCode() + new String(response.getData()) + " )
node with path : " + path);
+ }
+ result.add(new WorkerResult(false, System.currentTimeMillis() - start));
+ nodesPath.add(new NodeInfo(path, System.currentTimeMillis()));
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getLocalizedMessage());
+ }
+ finally
+ {
+ if (connection != null)
+ {
+ connection.stop();
+ }
+ }
+ return result;
+ }
+}
Property changes on:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavTestAgent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain