Advertisement
Guest User

Untitled

a guest
May 26th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public void test1() throws Exception {
  2. // NB replicator is a BasicReplicator object we created earlier
  3. MutableDocumentRevision doc = new MutableDocumentRevision();
  4. doc.body = DocumentBodyFactory.create("{\"hello\": \"world\"}".getBytes());
  5. doc.attachments.put("att1", new UnsavedFileAttachment(new File("/tmp/1"), "text/plain"));
  6. BasicDocumentRevision doc1 = datastore.createDocumentFromRevision(doc);
  7. MutableDocumentRevision doc2 = doc1.mutableCopy();
  8. doc2.attachments.put("att2", new UnsavedFileAttachment(new File("/tmp/2"), "text/plain"));
  9. datastore.updateDocumentFromRevision(doc2);
  10. replicator.start();
  11. Assert.assertEquals(Replicator.State.STARTED, replicator.getState());
  12. while(replicator.getState() != Replicator.State.COMPLETE) {
  13. Thread.sleep(1000);
  14. }
  15. System.out.println("done");
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement