exo-jcr SVN: r878 - jcr/branches/1.12.0-JBC/component/core.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-26 06:46:36 -0500 (Thu, 26 Nov 2009)
New Revision: 878
Modified:
jcr/branches/1.12.0-JBC/component/core/pom.xml
Log:
EXOJCR-199: POM with exclusions
Modified: jcr/branches/1.12.0-JBC/component/core/pom.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/pom.xml 2009-11-26 11:33:24 UTC (rev 877)
+++ jcr/branches/1.12.0-JBC/component/core/pom.xml 2009-11-26 11:46:36 UTC (rev 878)
@@ -369,15 +369,15 @@
<exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
<exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
<exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
-
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCache.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCacheMetrics.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionDataManager.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
- <groupId>org.jibx</groupId>
- <artifactId>maven-jibx-plugin</artifactId>
+ <groupId>org.jibx</groupId> <artifactId>maven-jibx-plugin</artifactId>
<configuration>
<directory>src/main/resources</directory>
<includes>
@@ -569,10 +569,13 @@
</property>
</systemProperties>
<includes>
- <include>**/**/JBossCacheServiceTest__.java</include>
- <include>**/**/TestItem__.java</include>
- <include>**/**/LockCacheLoaderTest.java</include>
- <include>**/**/JBossCacheStorageConnectionTest.java</include>
+ <include>**/**/JDBCCacheLoaderTest_.java</include>
+ <include>**/**/JBossCacheStorageConnectionTest_.java</include>
+
+ <include>**/reading_/Test*.java</include>
+ <include>**/writing_/Test*.java</include>
+
+ <include>**/**/TestMoveNode.java</include>
</includes>
</configuration>
</plugin>
16 years, 5 months
exo-jcr SVN: r877 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/load/perf and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-26 06:33:24 -0500 (Thu, 26 Nov 2009)
New Revision: 877
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
Log:
EXOJCR-221: comments added, NodeImpl.hasNodes() improvements
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2009-11-26 11:13:27 UTC (rev 876)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2009-11-26 11:33:24 UTC (rev 877)
@@ -765,8 +765,26 @@
return data.getIdentifier().equals(Constants.ROOT_UUID);
}
+ /**
+ * Loads data
+ *
+ * @param data
+ * source item data
+ * @throws RepositoryException
+ * if errors occurs
+ */
abstract void loadData(ItemData data) throws RepositoryException;
+ /**
+ * Loads data.
+ *
+ * @param data
+ * source item data
+ * @param itemDefinitionData
+ * source item definition data
+ * @throws RepositoryException
+ * if errors occurs
+ */
abstract void loadData(ItemData data, ItemDefinitionData itemDefinitionData) throws RepositoryException;
/**
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-11-26 11:13:27 UTC (rev 876)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-11-26 11:33:24 UTC (rev 877)
@@ -156,7 +156,7 @@
* @param data
* Node data
* @param parent
- * Parent node data
+ * parent node data is used for simple calculation item definition
* @param session
* Session
* @throws RepositoryException
@@ -1254,7 +1254,7 @@
checkValid();
- return dataManager.getChildNodesData(nodeData()).size() > 0;
+ return dataManager.getChildNodesCount(nodeData()) > 0;
}
/**
@@ -1384,7 +1384,14 @@
}
/**
- * {@inheritDoc}
+ * Loads data.
+ *
+ * @param data
+ * source item data for load
+ * @param parent
+ * parent node data is used for simple calculation item definition
+ * @throws RepositoryException
+ * if error occurs
*/
private void loadData(ItemData data, NodeData parent) throws RepositoryException, InvalidItemStateException,
ConstraintViolationException
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java 2009-11-26 11:13:27 UTC (rev 876)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java 2009-11-26 11:33:24 UTC (rev 877)
@@ -19,7 +19,11 @@
import org.exoplatform.services.jcr.JcrAPIBaseTest;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.jcr.Node;
+import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
@@ -35,14 +39,16 @@
{
private static final String testName = "testRoot";
- private static final int sessionCount = 1;
+ private static final int sessionCount = 20;
- private static final int tryCount = 10;
+ private static final int tryCount = 5;
private Session[] sessions = new Session[sessionCount];
private GetNodesThread[] threads = new GetNodesThread[sessionCount];
+ private NodeIterator[][] nodes = new NodeIterator[sessionCount][tryCount];
+
public void testGetNodes() throws Exception
{
@@ -73,7 +79,7 @@
log.info("getting nodes...");
for (int i = 0; i < sessionCount; i++)
{
- threads[i] = new GetNodesThread(sessions[i]);
+ threads[i] = new GetNodesThread(sessions[i], i);
threads[i].start();
}
@@ -90,16 +96,19 @@
break;
}
- log.info("Memory used: " + (rt.totalMemory() - rt.freeMemory() - usedMemory) / 1024 + "Kb");
+ log.info("Memory used: " + (rt.totalMemory() - rt.freeMemory() - usedMemory) / 1024 / 1024 + "Mb");
}
private class GetNodesThread extends Thread
{
private final Session curSession;
- GetNodesThread(Session session)
+ private final int sessionNumber;
+
+ GetNodesThread(Session session, int sessionNumber)
{
this.curSession = session;
+ this.sessionNumber = sessionNumber;
}
@Override
@@ -114,9 +123,11 @@
long startTime = System.currentTimeMillis();
testRoot.getNodes();
log.info("Total time: " + (System.currentTimeMillis() - startTime) / 1000 + "s");
+
+ Thread.sleep(30000);
}
}
- catch (RepositoryException e)
+ catch (Exception e)
{
e.printStackTrace();
}
16 years, 5 months
exo-jcr SVN: r876 - in jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr: lab and 1 other directories.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-11-26 06:13:27 -0500 (Thu, 26 Nov 2009)
New Revision: 876
Added:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/AbstractRestartTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestLockCleanup.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestVersionHistory.java
Removed:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLockCleanupOnRestart.java
Log:
EXOJCR-199: Added restart test on Versioning and moved Lock properties cleanup.
Deleted: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLockCleanupOnRestart.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLockCleanupOnRestart.java 2009-11-26 11:04:06 UTC (rev 875)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLockCleanupOnRestart.java 2009-11-26 11:13:27 UTC (rev 876)
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2009 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.api.lock;
-
-import org.exoplatform.services.jcr.JcrAPIBaseTest;
-import org.exoplatform.services.jcr.impl.core.NodeImpl;
-import org.hsqldb.DatabaseManager;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-
-import javax.jcr.PathNotFoundException;
-
-/**
- * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
- * @version $Id$
- *
- */
-public class TestLockCleanupOnRestart extends JcrAPIBaseTest
-{
-
- /*
- * This test should be performed manually because it requires JCR tearDown and startup without
- * cleaning it's content. BEFORE TESTING UNCOMMENT TEST BODY and TEAR DOWN
- *
- * To check whether lock-properties are deleted as expected, first run:
- * >mvn clean test -Dtest=org.exoplatform.services.jcr.api.lock.TestLockCleanupOnRestart
- * then (without clean!) :
- * >mvn test -Dtest=org.exoplatform.services.jcr.api.lock.TestLockCleanupOnRestart
- */
-
- private static String testNodeName = "LockIt";
-
- public void testLockCleanUp() throws Exception
- {
-// log.info("/!\\ This test should be executed twice ('mvn clean test "
-// + "-Dtest=...' and then without 'clean') and separately from other tests /!\\");
-// NodeImpl node;
-// try
-// {
-// node = (NodeImpl)root.getNode(testNodeName);
-// log.info("Node \"/LockIt\" found, this is correct SECOND run.");
-// }
-// catch (PathNotFoundException e)
-// {
-// node = (NodeImpl)root.addNode(testNodeName);
-// node.addMixin("mix:lockable");
-// log.info("Node \"/LockIt\" not found, this is probably FIRST run. If not, "
-// + "ensure that \"clean\" is not invoked in \"maven test\"!");
-// }
-// session.save();
-// // locking the node with open-scoped deep lock.
-// // no exception should be thrown
-// try
-// {
-// node.lock(true, false);
-// // ok!
-// }
-// catch (Exception e)
-// {
-// fail("Unexpected exception" + e.getStackTrace());
-// }
- }
-
-// @Override
-// protected void tearDown() throws Exception
-// {
-// // super.tearDown in not invoked to prevent DB cleaning
-// // shutdown HSSQLDB :)
-// for (Object uri : DatabaseManager.getDatabaseURIs())
-// {
-// try
-// {
-// Connection c = DriverManager.getConnection("jdbc:hsqldb:" + uri.toString(), "sa", "");
-// c.createStatement().execute("SHUTDOWN");
-// }
-// catch (Throwable e)
-// {
-// }
-// }
-// }
-}
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/AbstractRestartTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/AbstractRestartTest.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/AbstractRestartTest.java 2009-11-26 11:13:27 UTC (rev 876)
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2009 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.lab.restart;
+
+import org.exoplatform.services.jcr.JcrAPIBaseTest;
+import org.hsqldb.DatabaseManager;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+import javax.jcr.PathNotFoundException;
+
+/**
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id$
+ *
+ */
+public abstract class AbstractRestartTest extends JcrAPIBaseTest
+{
+ protected boolean firstRun = true;
+
+ private final String runNodeName = "SecondRun";
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ try
+ {
+ root.getNode(runNodeName);
+ // node exists, it means than this is second run
+ firstRun = false;
+ }
+ catch (PathNotFoundException e)
+ {
+ root.addNode(runNodeName);
+ }
+ session.save();
+ if (firstRun)
+ {
+ log.info("/!\\ This is FIRST run");
+ }
+ else
+ {
+ log.info("/!\\ This is SECOND run");
+ }
+ }
+
+ public boolean isFirstRun()
+ {
+ return firstRun;
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ // super.tearDown in not invoked to prevent DB cleaning
+ // shutdown HSSQLDB :)
+ if (firstRun)
+ {
+ for (Object uri : DatabaseManager.getDatabaseURIs())
+ {
+ try
+ {
+ Connection c = DriverManager.getConnection("jdbc:hsqldb:" + uri.toString(), "sa", "");
+ c.createStatement().execute("SHUTDOWN");
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ }
+ else
+ {
+ super.tearDown();
+ }
+
+ }
+
+}
\ No newline at end of file
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/AbstractRestartTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestLockCleanup.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestLockCleanup.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestLockCleanup.java 2009-11-26 11:13:27 UTC (rev 876)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2009 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.lab.restart;
+
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+
+/**
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id$
+ *
+ */
+public class TestLockCleanup extends AbstractRestartTest
+{
+
+ /*
+ * This test should be performed manually because it requires JCR tearDown and startup without
+ * cleaning it's content.
+ *
+ * To check whether lock-properties are deleted as expected, first run:
+ * >mvn clean test -Dtest=org.exoplatform.services.jcr.lab.restart.TestLockCleanup
+ * then (without clean!) :
+ * >mvn test -Dtest=org.exoplatform.services.jcr.lab.restart.TestLockCleanup
+ */
+
+ private static String testNodeName = "LockIt";
+
+ public void testLockCleanUp() throws Exception
+ {
+ log.info("/!\\ This test should be executed twice ('mvn clean test "
+ + "-Dtest=...' and then without 'clean') and separately from other tests /!\\");
+ NodeImpl node;
+ if (!isFirstRun())
+ {
+ node = (NodeImpl)root.getNode(testNodeName);
+ log.info("Node \"/LockIt\" found, this is correct SECOND run.");
+ }
+ else
+ {
+ node = (NodeImpl)root.addNode(testNodeName);
+ node.addMixin("mix:lockable");
+ log.info("Node \"/LockIt\" not found, this is probably FIRST run. If not, "
+ + "ensure that \"clean\" is not invoked in \"maven test\"!");
+ }
+ session.save();
+ // locking the node with open-scoped deep lock.
+ // no exception should be thrown
+ try
+ {
+ node.lock(true, false);
+ // ok!
+ }
+ catch (Exception e)
+ {
+ fail("Unexpected exception" + e.getStackTrace());
+ }
+ }
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestLockCleanup.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestVersionHistory.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestVersionHistory.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestVersionHistory.java 2009-11-26 11:13:27 UTC (rev 876)
@@ -0,0 +1,268 @@
+/*
+ * Copyright (C) 2009 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.lab.restart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionHistory;
+
+/**
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id$
+ *
+ */
+public class TestVersionHistory extends AbstractRestartTest
+{
+
+ /*
+ * This test should be performed manually because it requires JCR tearDown and startup without
+ * cleaning it's content.
+ *
+ * For the first run:
+ * >mvn clean test -Dtest=org.exoplatform.services.jcr.lab.restart.TestVersionHistory
+ * then (without clean!) :
+ * >mvn test -Dtest=org.exoplatform.services.jcr.lab.restart.TestVersionHistory
+ */
+
+ private Node testVersionable = null;
+
+ public void testVersionHistory() throws Exception
+ {
+ if (isFirstRun())
+ {
+ // prepare phase
+ Node testRoot = root.addNode("testRoot");
+ testVersionable = testRoot.addNode("testVersionable", "nt:unstructured");
+ testVersionable.addMixin("mix:versionable");
+ root.save();
+
+ // testVersionable = versionableNode; // it's nt:folder
+
+ VersionHistory vHistory = testVersionable.getVersionHistory();
+
+ // Creating nodes: n1, n2
+ Node n1 = testVersionable.addNode("n1");
+ Node n2 = testVersionable.addNode("n2");
+ testVersionable.save();
+ Version ver1 = testVersionable.checkin(); // v1
+ vHistory.addVersionLabel(ver1.getName(), "ver.1", false);
+ testVersionable.checkout();
+
+ // sameNameSibs nodes
+ // Creating nodes: n1[2], n1[3], n1[4]
+ Node snsN1_2 = testVersionable.addNode("n1");
+ Node snsN1_3 = testVersionable.addNode("n1");
+ Node snsN1_4 = testVersionable.addNode("n1");
+
+ // Creating node: n3
+ Node n3 = testVersionable.addNode("n3");
+ testVersionable.save();
+ Version ver2 = testVersionable.checkin(); // v2
+ vHistory.addVersionLabel(ver2.getName(), "ver.2", false);
+ testVersionable.checkout();
+
+ // Creating node: n4
+ Node n4 = testVersionable.addNode("n4");
+ testVersionable.save();
+ Version ver3 = testVersionable.checkin(); // v3
+ vHistory.addVersionLabel(ver3.getName(), "ver.3", false);
+ vHistory.addVersionLabel(ver3.getName(), "version 3.0", false);
+ testVersionable.checkout();
+
+ // Creating node: n5
+ Node n5 = testVersionable.addNode("n5");
+ testVersionable.save();
+ Version ver4 = testVersionable.checkin(); // v4
+ vHistory.addVersionLabel(ver4.getName(), "ver.4", false);
+ testVersionable.checkout();
+
+ if (log.isDebugEnabled())
+ log.debug("===== init =====");
+ checkItemsExisted(new String[]{n1.getPath(), snsN1_2.getPath(), snsN1_3.getPath(), snsN1_4.getPath(),
+ n2.getPath(), n3.getPath(), n4.getPath(), n5.getPath()}, null);
+ checkVersionHistory(testVersionable, 4);
+
+ }
+ else
+ {
+ // test phase
+ Node testRoot = root.getNode("testRoot");
+ testVersionable = testRoot.getNode("testVersionable");
+ VersionHistory vHistory = testVersionable.getVersionHistory();
+ Node n1 = testVersionable.getNode("n1");
+ Node n2 = testVersionable.getNode("n2");
+ Node n3 = testVersionable.getNode("n3");
+ Node n4 = testVersionable.getNode("n4");
+ Node n5 = testVersionable.getNode("n5");
+
+ Node snsN1_2 = testVersionable.getNode("n1[2]");
+ Node snsN1_3 = testVersionable.getNode("n1[3]");
+ Node snsN1_4 = testVersionable.getNode("n1[4]");
+
+ Version ver1 = vHistory.getVersionByLabel("ver.1");
+
+ // removing nodes: n2, n4
+ n2.remove();
+ n4.remove();
+ testVersionable.save();
+ if (log.isDebugEnabled())
+ log.debug("===== ver.1 before restore =====");
+ checkItemsExisted(new String[]{n1.getPath(), snsN1_2.getPath(), snsN1_3.getPath(), snsN1_4.getPath(),
+ n3.getPath(), n5.getPath()}, new String[]{n2.getPath(), n4.getPath()});
+ checkVersionHistory(testVersionable, 4);
+
+ // RESTORE ver.1 and n1, n2 will be restored
+ testVersionable.restore(ver1, true);
+ if (log.isDebugEnabled())
+ log.debug("===== ver.1 after restore =====");
+ checkItemsExisted(new String[]{n1.getPath(), n2.getPath()}, new String[]{snsN1_2.getPath(), snsN1_3.getPath(),
+ snsN1_4.getPath(), n3.getPath(), n4.getPath(), n5.getPath()});
+ checkVersionHistory(testVersionable, 4);
+
+ }
+ }
+
+ protected void checkVersionHistory(Node versionable, int versionCount) throws RepositoryException
+ {
+
+ VersionHistory vHistory = versionable.getVersionHistory();
+ Version rootVersion = vHistory.getRootVersion();
+ if (log.isDebugEnabled())
+ log.debug("rootVersion " + rootVersion.getPath());
+ Version baseVersion = versionable.getBaseVersion();
+ if (log.isDebugEnabled())
+ log.debug("baseVersion " + baseVersion.getPath());
+
+ BaseVersionFinder baseVersionFinder = new BaseVersionFinder(baseVersion);
+
+ List<Value> refs = traverseVersionSubTree(rootVersion, baseVersionFinder, vHistory, " --");
+ if (refs.size() != versionCount)
+ {
+ fail("Version history contains not all versions for node " + versionable.getPath() + ", expected:"
+ + versionCount + " was:" + refs.size());
+ }
+ if (!baseVersionFinder.isBaseVersionFound())
+ {
+ fail("Base version not founded in version history tree for node " + versionable.getPath()
+ + ", but exists if call versionable.getBaseVersion() " + baseVersion.getPath());
+ }
+ }
+
+ class BaseVersionFinder
+ {
+
+ private Version baseVersion = null;
+
+ private boolean baseVersionFound = false;
+
+ BaseVersionFinder(Version baseVersion)
+ {
+ this.baseVersion = baseVersion;
+ }
+
+ public Version getBaseVersion()
+ {
+ return baseVersion;
+ }
+
+ public boolean check(Version someVersion) throws RepositoryException
+ {
+
+ if (baseVersionFound)
+ return false;
+
+ baseVersionFound = baseVersion.isSame(someVersion);
+ return baseVersionFound;
+ }
+
+ public boolean isBaseVersionFound()
+ {
+ return baseVersionFound;
+ }
+ }
+
+ protected List<Value> traverseVersionSubTree(Version ver, BaseVersionFinder baseVersionFinder,
+ VersionHistory vHistory, String outPrefix) throws RepositoryException
+ {
+
+ List<Value> successorsRefs = new ArrayList<Value>();
+ String vlInfo = "";
+ String[] versionLabels = vHistory.getVersionLabels(ver);
+ for (String vl : versionLabels)
+ {
+ vlInfo += (vlInfo.length() > 0 ? ", " + vl : vl);
+ }
+ if (baseVersionFinder.check(ver))
+ {
+ // this is a base version
+ vlInfo = (vlInfo.length() > 0 ? " [" + vlInfo + "]" : "") + " >>>Base version<<< ";
+ }
+ else
+ {
+ vlInfo = (vlInfo.length() > 0 ? " [" + vlInfo + "]" : "");
+ }
+ if (log.isDebugEnabled())
+ log.debug(outPrefix + " " + ver.getName() + vlInfo);
+ Value[] versionSuccessors = getSucessors(ver);
+ if (versionSuccessors != null)
+ {
+ for (Value sv : versionSuccessors)
+ {
+ Version successor = (Version)session.getNodeByUUID(sv.getString());
+ if (successor != null)
+ {
+ successorsRefs.add(sv);
+ List<Value> successorSuccessors =
+ traverseVersionSubTree(successor, baseVersionFinder, vHistory, " " + outPrefix);
+ if (successorSuccessors != null)
+ {
+ successorsRefs.addAll(successorSuccessors);
+ }
+ }
+ else
+ {
+ fail("No item for successor UUID " + sv.getString());
+ }
+ }
+ }
+ return successorsRefs;
+ }
+
+ protected Value[] getSucessors(Version ver) throws RepositoryException
+ {
+ try
+ {
+ Property successors = ver.getProperty("jcr:successors");
+ return successors.getValues();
+ }
+ catch (PathNotFoundException e)
+ {
+ // fail("Property jcr:successors must exists for " + vp);
+ return null;
+ }
+ }
+
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/lab/restart/TestVersionHistory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
16 years, 5 months
exo-jcr SVN: r875 - jcr/branches/1.12.0-JBC.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-26 06:04:06 -0500 (Thu, 26 Nov 2009)
New Revision: 875
Modified:
jcr/branches/1.12.0-JBC/pom.xml
Log:
EXOJCR-199 : The dependency to core kernal ws was changed in ./branche/1.12.0-JBC was changed.
Modified: jcr/branches/1.12.0-JBC/pom.xml
===================================================================
--- jcr/branches/1.12.0-JBC/pom.xml 2009-11-26 10:38:26 UTC (rev 874)
+++ jcr/branches/1.12.0-JBC/pom.xml 2009-11-26 11:04:06 UTC (rev 875)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform</groupId>
<artifactId>foundation-parent</artifactId>
- <version>3-SNAPSHOT</version>
+ <version>3</version>
</parent>
<groupId>org.exoplatform.jcr</groupId>
@@ -38,9 +38,9 @@
<properties>
<exo.product.name>exo-jcr</exo.product.name>
<exo.product.specification>1.12</exo.product.specification>
- <org.exoplatform.kernel.version>2.2.0-Beta03-SNAPSHOT</org.exoplatform.kernel.version>
- <org.exoplatform.core.version>2.3.0-Beta03-SNAPSHOT</org.exoplatform.core.version>
- <org.exoplatform.ws.version>2.1.0-Beta03-SNAPSHOT</org.exoplatform.ws.version>
+ <org.exoplatform.kernel.version>2.2.0-Beta04</org.exoplatform.kernel.version>
+ <org.exoplatform.core.version>2.3.0-Beta04</org.exoplatform.core.version>
+ <org.exoplatform.ws.version>2.1.0-Beta04</org.exoplatform.ws.version>
</properties>
<scm>
16 years, 5 months
exo-jcr SVN: r874 - kernel/trunk.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2009-11-26 05:38:26 -0500 (Thu, 26 Nov 2009)
New Revision: 874
Added:
kernel/trunk/exo.kernel.component.ext.cache/
Log:
EXOJCR-268 exo.kernel.component.ext.cache project added
16 years, 5 months
exo-jcr SVN: r873 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/access.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-11-26 05:06:23 -0500 (Thu, 26 Nov 2009)
New Revision: 873
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccess.java
Log:
EXOJCR-12 : port of test from 1.10.x 1.11.x
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccess.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccess.java 2009-11-26 08:32:25 UTC (rev 872)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccess.java 2009-11-26 10:06:23 UTC (rev 873)
@@ -250,6 +250,41 @@
}
/**
+ * tests child-parent permission inheritance
+ *
+ * @throws Exception
+ */
+ public void testPermissionInheritance1() throws Exception
+ {
+ NodeImpl node = (NodeImpl)accessTestRoot.addNode("testPermissionInheritance");
+ node.addMixin("exo:owneable");
+ node.addMixin("exo:privilegeable");
+
+ // change permission
+ HashMap<String, String[]> perm = new HashMap<String, String[]>();
+ perm.put("exo1", new String[]{PermissionType.ADD_NODE, PermissionType.READ});
+ node.setPermissions(perm);
+ NodeImpl node1 = (NodeImpl)node.addNode("node1");
+ assertEquals(node.getACL(), node1.getACL());
+ // add grandchild node and test if acl is equal to grandparent
+ NodeImpl node2 = (NodeImpl)node1.addNode("node1");
+ assertEquals(node.getACL(), node2.getACL());
+ NodeImpl node3 = (NodeImpl)node1.addNode("node3");
+ session.save();
+ assertEquals(node3.getACL(), node1.getACL());
+ perm.put("exo2", new String[]{PermissionType.ADD_NODE, PermissionType.READ});
+ assertEquals(node3.getACL(), node.getACL());
+ node.setPermissions(perm);
+ session.save();
+ node1 = (NodeImpl)node.getNode("node1");
+ node3 = (NodeImpl)node1.getNode("node3");
+
+ assertEquals(node3.getACL(), node.getACL());
+ assertEquals(((ExtendedNode)node.getNode("node1")).getACL(), node.getACL());
+ assertEquals(((ExtendedNode)node.getNode("node1/node3")).getACL(), node.getACL());
+ }
+
+ /**
* tests session.checkPermission() method
*
* @throws Exception
16 years, 5 months
exo-jcr SVN: r872 - jcr/branches/1.12.0-JBC/component/core.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-11-26 03:32:25 -0500 (Thu, 26 Nov 2009)
New Revision: 872
Modified:
jcr/branches/1.12.0-JBC/component/core/pom.xml
Log:
EXOJCR-199 : excluded TestLinkedWorkspaceStorageCache
Modified: jcr/branches/1.12.0-JBC/component/core/pom.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/pom.xml 2009-11-25 17:03:04 UTC (rev 871)
+++ jcr/branches/1.12.0-JBC/component/core/pom.xml 2009-11-26 08:32:25 UTC (rev 872)
@@ -352,6 +352,7 @@
<exclude>org/exoplatform/services/jcr/**/TestErrorMultithreading.java</exclude>
<exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
<exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCache.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceManagement.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestRepositoryManagement.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestSaveConfiguration.java</exclude>
16 years, 5 months
exo-jcr SVN: r871 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-11-25 12:03:04 -0500 (Wed, 25 Nov 2009)
New Revision: 871
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
Log:
EXOJCR-243: Added functionality in transactions
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2009-11-25 16:58:20 UTC (rev 870)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2009-11-25 17:03:04 UTC (rev 871)
@@ -18,10 +18,13 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.session;
+import org.exoplatform.services.jcr.dataflow.ChangesLogIterator;
import org.exoplatform.services.jcr.dataflow.DataManager;
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
+import org.exoplatform.services.jcr.dataflow.LockPlainChangesLogImpl;
import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
@@ -30,6 +33,7 @@
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.LocalWorkspaceDataManagerStub;
+import org.exoplatform.services.jcr.observation.ExtendedEvent;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.transaction.TransactionException;
@@ -268,7 +272,35 @@
*/
public LockData getLockData(String identifier) throws RepositoryException
{
- return storageDataManager.getLockData(identifier);
+ LockData lockData = null;
+ if (txStarted())
+ {
+ // This is a transaction. Check if the node was locked inside this transaction
+ ChangesLogIterator changesLogIterator = transactionLog.getLogIterator();
+ while (changesLogIterator.hasNextLog())
+ {
+ PlainChangesLog plainChangesLog = changesLogIterator.nextLog();
+ if (plainChangesLog.getEventType() == ExtendedEvent.LOCK)
+ {
+ if (((LockPlainChangesLogImpl)plainChangesLog).getLockData().getNodeIdentifier().equals(identifier))
+ {
+ lockData = ((LockPlainChangesLogImpl)plainChangesLog).getLockData();
+ }
+ }
+ else if (plainChangesLog.getEventType() == ExtendedEvent.UNLOCK)
+ {
+ if (plainChangesLog.getSize() == 2)
+ {
+ ItemState itemState = plainChangesLog.getAllStates().get(0);
+ if (itemState.getData().getParentIdentifier().equals(identifier))
+ {
+ lockData = null;
+ }
+ }
+ }
+ }
+ }
+ return lockData == null ? storageDataManager.getLockData(identifier) : lockData;
}
/**
16 years, 5 months
exo-jcr SVN: r870 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-25 11:58:20 -0500 (Wed, 25 Nov 2009)
New Revision: 870
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-203: ordering of child nodes by orderNumb
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-25 16:29:28 UTC (rev 869)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-25 16:58:20 UTC (rev 870)
@@ -39,6 +39,8 @@
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -77,7 +79,18 @@
private boolean batchStarted = false;
private boolean isCommited = false;
+
+ class NodesOrderComparator<N extends NodeData> implements Comparator<NodeData> {
+ /**
+ * {@inheritDoc}
+ */
+ public int compare(NodeData n1, NodeData n2)
+ {
+ return n1.getOrderNumber() - n2.getOrderNumber();
+ }
+ }
+
/**
* JBossCacheStorageConnection constructor.
*
@@ -372,6 +385,9 @@
// throw new RepositoryException("FATAL Get child Nodes: parent not found " + parent.getQPath().getAsString());
}
+ // TODO We have to order childs by orderNumber, as JBC returns childs in any order
+ Collections.sort(childs, new NodesOrderComparator<NodeData>());
+
return childs;
}
16 years, 5 months
exo-jcr SVN: r869 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-25 11:29:28 -0500 (Wed, 25 Nov 2009)
New Revision: 869
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-199: remove perviousData from parent child list updated
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-25 16:18:09 UTC (rev 868)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-25 16:29:28 UTC (rev 869)
@@ -659,19 +659,29 @@
// remove node form old parent child list
// TODO node may me renamed before (using update) so name in list of parent may link to another node
// may be there is sence left node without linking in list of parent child nodes. (check it in update)
- Node<Serializable, Object> cNode =
- prevParent
- .getChild(makeChildNodeFqn(prevData.getQPath().getEntries()[prevData.getQPath().getEntries().length - 1]));
- if (cNode != null)
+ Fqn<String> prevPath =
+ makeChildNodeFqn(prevData.getQPath().getEntries()[prevData.getQPath().getEntries().length - 1]);
+ Node<Serializable, Object> prevNameNode = prevParent.getChild(prevPath);
+ if (prevNameNode != null)
{
- if (!((String)cNode.get(ITEM_ID)).equals(prevData.getIdentifier()))
+ String prevNameNodeId = (String)prevNameNode.get(ITEM_ID);
+ if (prevNameNodeId != null)
{
- LOG.warn(" Node was updated before " + prevData.getQPath());
+ if (prevNameNodeId.equals(data.getIdentifier()))
+ {
+ // it's same-name siblings re-ordering, delete previous child
+ if (!prevParent.removeChild(prevPath))
+ {
+ if (!prevParent.removeChild(prevNameNode.getFqn().getLastElement()))
+ throw new RepositoryException("FATAL Node was not removed from list of parent node "
+ + prevData.getQPath().getAsString() + ". Node " + data.getQPath().getAsString());
+ }
+ } // else ok
}
- else if (!prevParent.removeChild(cNode.getFqn().getLastElement()))
+ else
{
- throw new RepositoryException("FATAL Node was not removed from list of parent node "
- + prevData.getQPath().getAsString() + ". Node " + data.getQPath().getAsString());
+ throw new RepositoryException("FATAL Child Node extists but ITEM_ID is empty " + prevNameNode.getFqn()
+ + ". Rename of " + data.getQPath().getAsString());
}
}
else
16 years, 5 months