I want to test saving and retrieving of files using Apache Jackrabbit. I am not sure if it's saving when I am not able to retrieve it later. The following is my code. My question is how do I retrieve the file that I have saved.
@Test
public void storeFile() throws Exception {
File file = getFile();
FileInputStream fileInputStream = new FileInputStream(file);
Repository repository = new TransientRepository();
Session session = repository.login(
new SimpleCredentials("username", "password".toCharArray()));
try {
logger.info("logged in as user '{}'", session.getUserID());
Node root = session.getRootNode();
// Store content
Node hello = root.addNode("userid_12");
Node world = hello.addNode("files");
logger.debug("setting fileInputStream");
world.getSession().getValueFactory().createBinary(fileInputStream);
session.save();
// Retrieve content
Node node = root.getNode("userid_12/files");
logger.info(node.getPath());
//how do I retrieve the file now?
}