use of javax.jcr.InvalidItemStateException in project jackrabbit-oak by apache.
the class MoveRemoveTest method moveExistingNodeRefreshParent.
@Test
public void moveExistingNodeRefreshParent() throws RepositoryException {
Session session = getAdminSession();
session.getRootNode().addNode("parent").addNode("new");
session.save();
Session session2 = createAdminSession();
Node n2 = session2.getNode("/parent/new");
Node n = session.getNode("/parent/new");
session.move("/parent", "/moved");
session.save();
session2.refresh(false);
try {
n2.getPath();
fail();
} catch (InvalidItemStateException e) {
}
session.getRootNode().addNode("parent").addNode("new");
session.save();
session2.refresh(false);
assertEquals("/parent/new", n2.getPath());
session2.logout();
}
use of javax.jcr.InvalidItemStateException in project jackrabbit-oak by apache.
the class MoveRemoveTest method removeExistingNode.
@Test
public void removeExistingNode() throws RepositoryException {
Session session = getAdminSession();
session.getRootNode().addNode("new");
session.save();
Node n = session.getNode("/new");
n.remove();
try {
n.getPath();
fail();
} catch (InvalidItemStateException e) {
}
session.getRootNode().addNode("new");
assertEquals("/new", n.getPath());
}
use of javax.jcr.InvalidItemStateException in project jackrabbit-oak by apache.
the class MoveRemoveTest method removeNewNode.
@Test
public void removeNewNode() throws RepositoryException {
Session session = getAdminSession();
session.getRootNode().addNode("new");
Node n = session.getNode("/new");
n.remove();
try {
n.getPath();
fail();
} catch (InvalidItemStateException e) {
}
session.getRootNode().addNode("new");
assertEquals("/new", n.getPath());
}
use of javax.jcr.InvalidItemStateException in project jackrabbit-oak by apache.
the class MoveRemoveTest method moveExistingNodeRefresh.
@Test
public void moveExistingNodeRefresh() throws RepositoryException {
Session session = getAdminSession();
session.getRootNode().addNode("new");
session.save();
Session session2 = createAdminSession();
Node n2 = session2.getNode("/new");
Node n = session.getNode("/new");
session.move("/new", "/moved");
session.save();
session2.refresh(false);
try {
n2.getPath();
fail();
} catch (InvalidItemStateException e) {
}
session.getRootNode().addNode("new");
session.save();
session2.refresh(false);
assertEquals("/new", n2.getPath());
session2.logout();
}
use of javax.jcr.InvalidItemStateException in project jackrabbit-oak by apache.
the class RepositoryTest method invalidItemStateExceptionOnRemovedNode.
@Test
public void invalidItemStateExceptionOnRemovedNode() throws Exception {
Session session = getAdminSession();
for (String parentPath : new String[] { "/", TEST_PATH }) {
Node parent = session.getNode(parentPath);
Node child = parent.addNode("child");
String childPath = child.getPath();
child.remove();
try {
child.getPath();
fail();
} catch (InvalidItemStateException expected) {
}
session.save();
try {
child.getPath();
fail();
} catch (InvalidItemStateException expected) {
}
parent.addNode("child");
assertEquals(childPath, child.getPath());
}
}
Aggregations