[exo-jcr-commits] exo-jcr SVN: r781 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Nov 19 10:56:17 EST 2009


Author: areshetnyak
Date: 2009-11-19 10:56:16 -0500 (Thu, 19 Nov 2009)
New Revision: 781

Modified:
   jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
Log:
EXOJCR-203 : The test JBossCacheStorageConnectionTest was changed.

Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java	2009-11-19 15:32:09 UTC (rev 780)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java	2009-11-19 15:56:16 UTC (rev 781)
@@ -35,6 +35,7 @@
 import java.io.Serializable;
 import java.util.List;
 
+import javax.jcr.InvalidItemStateException;
 import javax.jcr.ItemExistsException;
 import javax.jcr.lock.LockException;
 
@@ -643,7 +644,7 @@
          
          conn.commit();
          
-         fail("The node jcr:system shouldnot be save");
+         fail("The node jcr:system should not be save");
       } catch (ItemExistsException e) {
          //ok
       }
@@ -671,9 +672,70 @@
          
          conn.commit();
          
-         fail("The property (/jcr:primaryType) shouldnot be save");
+         fail("The property (/jcr:primaryType) should not be save");
       } catch (ItemExistsException e) {
          //ok
       }
    }
+   
+   public void testDeleteNodeFail() throws Exception
+   {
+      // add root (/)
+      conn.add(new TransientNodeData(Constants.ROOT_PATH, Constants.ROOT_UUID, 1, Constants.NT_UNSTRUCTURED,
+               new InternalQName[0], 0, null, new AccessControlList()));
+
+      // add node (/node)
+      String node1id = "1";
+      QPath node1path = QPath.parse("[]:1[]node:1");
+      conn.add(new TransientNodeData(node1path, node1id, 1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
+               Constants.ROOT_UUID, new AccessControlList()));
+
+      // add /jcr:system
+      conn.add(new TransientNodeData(Constants.JCR_SYSTEM_PATH, Constants.SYSTEM_UUID, 1, Constants.NT_UNSTRUCTURED,
+               new InternalQName[0], 0, Constants.ROOT_UUID, new AccessControlList()));
+
+      // delete /node
+      conn.delete(new TransientNodeData(node1path, node1id, 1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
+               Constants.ROOT_UUID, new AccessControlList()));
+      
+      try {
+         // delete node /node twice 
+         conn.delete(new TransientNodeData(node1path, node1id, 1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
+                  Constants.ROOT_UUID, new AccessControlList()));
+         
+         conn.commit();
+         
+         fail("The node (/node) should not be delete");
+      } catch (InvalidItemStateException e) {
+         //ok
+      }
+   }
+   
+   public void testDeletePropertyFail() throws Exception
+   {
+      // add root (/)
+      conn.add(new TransientNodeData(Constants.ROOT_PATH, Constants.ROOT_UUID, 1, Constants.NT_UNSTRUCTURED,
+               new InternalQName[0], 0, null, new AccessControlList()));
+
+      // add property (/jcr:primaryType)
+      String propId1 = "1";
+      conn.add(new TransientPropertyData(QPath.makeChildPath(Constants.ROOT_PATH, Constants.JCR_PRIMARYTYPE), propId1,
+               1, 1, Constants.ROOT_UUID, false));
+
+      // delete /jcr:primaryType
+      conn.delete(new TransientPropertyData(QPath.makeChildPath(Constants.ROOT_PATH, Constants.JCR_PRIMARYTYPE),
+               propId1, 1, 1, Constants.ROOT_UUID, false));
+
+      try {
+         // delete /jcr:primaryType twice 
+         conn.delete(new TransientPropertyData(QPath.makeChildPath(Constants.ROOT_PATH, Constants.JCR_PRIMARYTYPE),
+                  propId1, 1, 1, Constants.ROOT_UUID, false));
+         
+         conn.commit();
+         
+         fail("The property (/jcr:primaryType) should not be delete");
+      } catch (InvalidItemStateException e) {
+         //ok
+      }
+   }
 }



More information about the exo-jcr-commits mailing list