Skip to content

Instantly share code, notes, and snippets.

View jlliarte's full-sized avatar

jlliarte jlliarte

View GitHub Profile
public void test1() throws Exception {
// NB replicator is a BasicReplicator object we created earlier
MutableDocumentRevision doc = new MutableDocumentRevision();
doc.body = DocumentBodyFactory.create("{\"hello\": \"world\"}".getBytes());
doc.attachments.put("att1", new UnsavedFileAttachment(new File("/tmp/1"), "text/plain"));
BasicDocumentRevision doc1 = datastore.createDocumentFromRevision(doc);
MutableDocumentRevision doc2 = doc1.mutableCopy();
doc2.attachments.put("att2", new UnsavedFileAttachment(new File("/tmp/2"), "text/plain"));
datastore.updateDocumentFromRevision(doc2);
replicator.start();