use of javax.jcr.InvalidItemStateException in project jackrabbit by apache.
the class ConcurrentAddRemovePropertyTest method testAddSameName.
public void testAddSameName() throws Exception {
Node n = testRootNode.addNode(nodeName1);
superuser.save();
n.setProperty(propertyName1, "foo");
session.getNode(testRoot).getNode(nodeName1).setProperty(propertyName1, "bar");
superuser.save();
try {
session.save();
} catch (InvalidItemStateException e) {
fail("must not throw InvalidItemStateException");
}
assertEquals("bar", n.getProperty(propertyName1).getString());
}
use of javax.jcr.InvalidItemStateException in project jackrabbit by apache.
the class ConcurrentAddRemovePropertyTest method testRemoveSameName.
public void testRemoveSameName() throws Exception {
Node n = testRootNode.addNode(nodeName1);
n.setProperty(propertyName1, "foo");
superuser.save();
n.getProperty(propertyName1).remove();
session.getNode(testRoot).getNode(nodeName1).getProperty(propertyName1).remove();
superuser.save();
try {
session.save();
} catch (InvalidItemStateException e) {
fail("must not throw InvalidItemStateException");
}
}
use of javax.jcr.InvalidItemStateException in project jackrabbit by apache.
the class ConcurrentCyclicMoveTest method testConcurrentSessionMove.
public void testConcurrentSessionMove() throws RepositoryException {
testRootPath = testRootNode.getPath();
Node aa = testRootNode.addNode("a").addNode("aa");
Node b = testRootNode.addNode("b");
testRootNode.getSession().save();
String aaId = aa.getIdentifier();
String bId = b.getIdentifier();
Session session1 = getHelper().getReadWriteSession();
Session session2 = getHelper().getReadWriteSession();
// results in /b/a/aa
session1.move(testRootPath + "/a", testRootPath + "/b/a");
assertEquals(testRootPath + "/b/a/aa", session1.getNodeByIdentifier(aaId).getPath());
// results in a/aa/b
session2.move(testRootPath + "/b", testRootPath + "/a/aa/b");
assertEquals(testRootPath + "/a/aa/b", session2.getNodeByIdentifier(bId).getPath());
session1.save();
try {
session2.getNodeByIdentifier(bId).getPath();
fail("It should not be possible to access a cyclic path");
} catch (InvalidItemStateException expected) {
}
try {
session2.save();
fail("Save should have failed. Possible cyclic persistent path created.");
} catch (InvalidItemStateException expected) {
}
}
use of javax.jcr.InvalidItemStateException in project jackrabbit by apache.
the class ConcurrentMixinModificationTest method testMixin.
public void testMixin() throws Exception {
Node n = testRootNode.addNode(nodeName1);
superuser.save();
n.addMixin(mixReferenceable);
session.getNode(testRoot).getNode(nodeName1).addMixin(mixLockable);
superuser.save();
try {
session.save();
fail("InvalidItemStateException expected");
} catch (InvalidItemStateException e) {
// expected
}
}
use of javax.jcr.InvalidItemStateException in project jackrabbit by apache.
the class ConcurrentModificationWithSNSTest method testSNSNotAllowed.
public void testSNSNotAllowed() throws Exception {
cleanUpTestRoot(superuser);
Node f = testRootNode.addNode("folder", "nt:folder");
superuser.save();
f.addNode("A", "nt:folder");
session.getNode(f.getPath()).addNode("A", "nt:folder");
superuser.save();
try {
session.save();
fail("InvalidItemStateException expected");
} catch (InvalidItemStateException e) {
// expected
}
}
Aggregations