use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class AbstractWorkspaceReferenceableTest method setUp.
protected void setUp() throws Exception {
super.setUp();
// we assume referencing is supported by repository
NodeTypeManager ntMgr = superuser.getWorkspace().getNodeTypeManager();
// assert that this repository supports references
try {
NodeType referenceableNt = ntMgr.getNodeType(mixReferenceable);
if (referenceableNt == null) {
throw new NotExecutableException("Repository does not support Referencing: mixin nodetype '" + mixReferenceable + "' is missing.");
}
} catch (NoSuchNodeTypeException e) {
throw new NotExecutableException("Repository does not support Referencing: mixin nodetype '" + mixReferenceable + "' is missing.");
}
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class AbstractWorkspaceSameNameSibsTest method setUp.
protected void setUp() throws Exception {
super.setUp();
// we assume sameNameSibs is supported by repository
NodeTypeManager ntMgr = superuser.getWorkspace().getNodeTypeManager();
// make sure 'sameNameSibsTrue' nodetype is properly defined
try {
sameNameSibsTrueNodeType = ntMgr.getNodeType(getProperty(PROP_SAME_NAME_SIBS_TRUE_NODE_TYPE));
NodeDefinition[] childNodeDefs = sameNameSibsTrueNodeType.getDeclaredChildNodeDefinitions();
boolean isSameNameSibs = false;
for (int i = 0; i < childNodeDefs.length; i++) {
if (childNodeDefs[i].allowsSameNameSiblings()) {
isSameNameSibs = true;
break;
}
}
if (!isSameNameSibs) {
throw new NotExecutableException("Property 'sameNameSibsTrueNodeType' does not define a nodetype where sameNameSibs are allowed: '" + sameNameSibsTrueNodeType.getName() + "'");
}
} catch (NoSuchNodeTypeException e) {
fail("Property 'sameNameSibsTrueNodeType' does not define an existing nodetype: '" + sameNameSibsTrueNodeType + "'");
}
// make sure 'sameNameSibsFalse' nodetype is properly defined
try {
sameNameSibsFalseNodeType = ntMgr.getNodeType(getProperty(PROP_SAME_NAME_SIBS_FALSE_NODE_TYPE));
NodeDefinition[] childNodeDefs = sameNameSibsFalseNodeType.getDeclaredChildNodeDefinitions();
boolean isSameNameSibs = true;
for (int i = 0; i < childNodeDefs.length; i++) {
if (!childNodeDefs[i].allowsSameNameSiblings()) {
isSameNameSibs = false;
break;
}
}
if (isSameNameSibs) {
fail("Property 'sameNameSibsFalseNodeType' does define a nodetype where sameNameSibs are not allowed: '" + sameNameSibsFalseNodeType.getName() + "'");
}
} catch (NoSuchNodeTypeException e) {
fail("Property 'sameNameSibsFalseNodeType' does not define an existing nodetype: '" + sameNameSibsFalseNodeType + "'");
}
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class AbstractWorkspaceVersionableTest method setUp.
protected void setUp() throws Exception {
super.setUp();
// we assume versioning is supported by repository
NodeTypeManager ntMgr = superuser.getWorkspace().getNodeTypeManager();
// assert that this repository supports versioning
try {
NodeType versionableNt = ntMgr.getNodeType(mixVersionable);
if (versionableNt == null) {
throw new NotExecutableException("Repository does not support versioning: mixin nodetype '" + mixVersionable + "' is missing.");
}
} catch (NoSuchNodeTypeException e) {
throw new NotExecutableException("Repository does not support versioning: mixin nodetype '" + mixVersionable + "' is missing.");
}
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class DerefQueryLevel1Test method testDerefMultiPropWithNodeTest.
/**
* Test a deref query on a multi valued reference property with a node test.
* @throws NotExecutableException if the workspace does not have sufficient
* content.
*/
public void testDerefMultiPropWithNodeTest() throws RepositoryException, NotExecutableException {
Property refProp = PropertyUtil.searchMultivalProp(testRootNode, PropertyType.REFERENCE);
if (refProp == null) {
throw new NotExecutableException("Workspace does not contain a node with a multivalue reference property.");
}
Value[] targets = refProp.getValues();
Node[] targetNodes = new Node[targets.length];
for (int i = 0; i < targets.length; i++) {
targetNodes[i] = session.getNodeByUUID(targets[i].getString());
}
if (targetNodes.length == 0) {
throw new NotExecutableException("Reference property does not contain a value");
}
String nodeName = targetNodes[0].getName();
List<Node> resultNodes = new ArrayList<Node>();
for (int i = 0; i < targetNodes.length; i++) {
if (targetNodes[i].getName().equals(nodeName)) {
resultNodes.add(targetNodes[i]);
}
}
targetNodes = resultNodes.toArray(new Node[resultNodes.size()]);
String xpath = createStatement(refProp, nodeName);
executeDerefQuery(session, xpath, targetNodes);
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class DerefQueryLevel1Test method testDerefSinglePropWithNodeTest.
/**
* Test a deref query on a single valued reference property with a node test.
* @throws NotExecutableException if the workspace does not have sufficient
* content.
*/
public void testDerefSinglePropWithNodeTest() throws RepositoryException, NotExecutableException {
Property refProp = PropertyUtil.searchProp(session, testRootNode, PropertyType.REFERENCE, Boolean.FALSE);
if (refProp == null) {
throw new NotExecutableException("Workspace does not contain a node with a reference property.");
}
Node target = refProp.getNode();
String xpath = createStatement(refProp, target.getName());
executeDerefQuery(session, xpath, new Node[] { target });
}
Aggregations