Author: skabashnyuk
Date: 2010-02-08 08:26:28 -0500 (Mon, 08 Feb 2010)
New Revision: 1714
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java
Log:
EXOJCR-395 : load test update
Modified:
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 2010-02-08
10:31:50 UTC (rev 1713)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java 2010-02-08
13:26:28 UTC (rev 1714)
@@ -159,22 +159,46 @@
*/
private void initRoot()
{
- try
+ int maxAttempts = 10;
+ CredentialsImpl credentials = new CredentialsImpl("admin",
"admin".toCharArray());
+ for (int i = 0; i < maxAttempts; i++)
{
- 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;
+ boolean isSuccessful = false;
+ Session sessionLocal = null;
+ try
+ {
+
+ sessionLocal = repository.login(credentials, "ws");
+ // prepare nodes
+ Node wsRoot = sessionLocal.getRootNode();
+ Node threadNode = wsRoot.addNode("Thread" + threadUUID);
+ sessionLocal.save();
+ sessionLocal.logout();
+ sessionLocal = null;
+ isSuccessful = true;
+ }
+ catch (Exception e)
+ {
+ log.error("error on creating root attempt " + i + " from
" + maxAttempts);
+ //ignore
+ }
+ finally
+ {
+ if (sessionLocal != null)
+ {
+ try
+ {
+ sessionLocal.refresh(false);
+ sessionLocal.logout();
+ }
+ catch (RepositoryException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
}
- catch (Exception e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
}