return new File(directory, relativePath);
}
public void testContent( Node federatedNode,
String childName ) throws Exception {
Session session = (Session)federatedNode.getSession();
String path = federatedNode.getPath() + "/" + childName;
Node files = session.getNode(path);
assertThat(files.getName(), is(childName));
assertThat(files.getPrimaryNodeType().getName(), is("nt:folder"));
Node dir1 = session.getNode(path + "/dir1");
Node dir2 = session.getNode(path + "/dir2");
Node dir3 = session.getNode(path + "/dir3");
Node simpleJson = session.getNode(path + "/dir3/simple.json");
Node simpleText = session.getNode(path + "/dir3/simple.txt");
assertFolder(dir1, getTestFile("dir1"));
assertFolder(dir2, getTestFile("dir2"));
assertFolder(dir3, getTestFile("dir3"));
assertFile(simpleJson, getTestFile("dir3/simple.json"));
assertFile(simpleText, getTestFile("dir3/simple.txt"));
// Look up a node by identifier ...
String externalNodeId = simpleJson.getIdentifier();
Node simpleJson2 = session.getNodeByIdentifier(externalNodeId);
assertFile(simpleJson2, getTestFile("dir3/simple.json"));
// Look up the node again by path ...
Node simpleJson3 = session.getNode(path + "/dir3/simple.json");
assertFile(simpleJson3, getTestFile("dir3/simple.json"));
// Look for a node that isn't there ...
try {
session.getNode(path + "/dir3/non-existant.oops");
fail("Should not have been able to find a non-existing file");
} catch (PathNotFoundException e) {
// expected
}
}