RemotePipeline rp = new HttpRemotePipeline("localhost", server.getPort(), "stage");
if(rp.getFile("id", new LocalDocumentID("file"))!=null) {
fail("Got non-null for non-existant document and non-existant file");
}
MemoryDocument testDoc = new MemoryDocument();
mc.getDocumentWriter().insert(testDoc);
if(rp.getFile(testDoc.getID().getID().toString(), new LocalDocumentID("file"))!=null) {
fail("Got non-null for non-existant file");
}
String content = "adsafgoaiuhgahgo\ndndasasddåäöäöåäöäas";
String fileName = "test.txt";
String content2 = "adsagagasdgarqRE13123AFg da\nndasdas";
String fileName2 = "test2.txt";
mc.getDocumentWriter().write(new DocumentFile<MemoryType>(testDoc.getID(), fileName, IOUtils.toInputStream(content, "UTF-8"), "stage"));
mc.getDocumentWriter().write(new DocumentFile<MemoryType>(testDoc.getID(), fileName2, IOUtils.toInputStream(content2, "UTF-8"), "stage"));
InputStream s = rp.getFile(fileName, testDoc.getID().getLocalDocumentID()).getStream();
if(s==null) {
fail("Did not get a file stream for file 1");
}
String fc = IOUtils.toString(s, "UTF-8");
if(!fc.equals(content)) {
fail("Content of file 1 did not match");
}
s = rp.getFile(fileName2, testDoc.getID().getLocalDocumentID()).getStream();
if(s==null) {
fail("Did not get a file stream for file 2");
}
if(!IOUtils.toString(s, "UTF-8").equals(content2)) {