Created
April 16, 2015 08:40
-
-
Save tomblench/80765deda730cc252636 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
replicator.start(); | |
Assert.assertEquals(Replicator.State.STARTED, replicator.getState()); | |
while(replicator.getState() != Replicator.State.COMPLETE) { | |
Thread.sleep(1000); | |
} | |
MutableDocumentRevision doc2 = doc1.mutableCopy(); | |
doc2.attachments.put("att2", new UnsavedFileAttachment(new File("/tmp/2"), "text/plain")); | |
datastore.updateDocumentFromRevision(doc2); | |
replicator.start(); | |
Assert.assertEquals(Replicator.State.STARTED, replicator.getState()); | |
while(replicator.getState() != Replicator.State.COMPLETE) { | |
Thread.sleep(1000); | |
} | |
System.out.println("done"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Tom, please try this gist: https://gist.github.com/JohnyMaldad/d248c63ed6c553461dfe