assertEquals(content1, content2);
}
@Test
public void createBigDocument() {
ObjectId parentId = session.createObjectId(fixture.getTestRootId());
String folderName = UUID.randomUUID().toString();
String typeId = FixtureData.DOCUMENT_TYPE_ID.value();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.NAME, folderName);
properties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
String filename = UUID.randomUUID().toString();
String mimetype = "application/octet-stream";
final int size = 10 * 1024 * 1024; // 10 MiB
InputStream in = new InputStream() {
private int counter = -1;
@Override
public int read() throws IOException {
counter++;
if (counter >= size) {
return -1;
}
return '0' + (counter / 10);
}
};
ContentStream contentStream = session.getObjectFactory().createContentStream(filename, size, mimetype, in);
assertNotNull(contentStream);
long start = System.currentTimeMillis();
ObjectId id = session.createDocument(properties, parentId, contentStream, VersioningState.NONE);
long end = System.currentTimeMillis();
assertNotNull(id);
Document doc = (Document) session.getObject(id);