Collision { boolean isConflicting() throws DocumentStoreException { if (document.getLocalBranchCommits().contains(theirRev) && !startRevisions.isRevisionNewer(theirRev)) { return false; } if (document.getDeleted().containsKey(theirRev)) { return true; } for (Map.Entry<Key, Operation> entry : ourOp.getChanges().entrySet()) { String name = entry.getKey().getName(); if (NodeDocument.isDeletedEntry(name)) { return true; } if (isPropertyName(name)) { if (document.getValueMap(name).containsKey(theirRev)) { return true; } } } return false; } Collision(@NotNull NodeDocument document,
              @NotNull Revision theirRev,
              @NotNull UpdateOp ourOp,
              @NotNull Revision ourRev,
              @NotNull RevisionContext context,
              @NotNull RevisionVector startRevisions);   }
@Test public void isConflicting() throws CommitFailedException { DocumentNodeStore ns = newBuilder() .setAsyncDelay(0).getNodeStore(); DocumentStore store = ns.getDocumentStore(); String id = Utils.getIdFromPath("/test"); NodeBuilder b = ns.getRoot().builder(); b.child("test").setProperty("p", "a"); Revision r1 = merge(ns, b).getRevision(ns.getClusterId()); assertNotNull(r1); NodeDocument doc = getDocument(store, id); Revision c = ns.newRevision(); UpdateOp op = new UpdateOp(id, true); NodeDocument.setDeleted(op, c, false); Collision col = newCollision(doc, r1, op, c, ns); assertTrue(col.isConflicting()); op = new UpdateOp(id, false); op.setMapEntry("p", c, "b"); col = newCollision(doc, r1, op, c, ns); assertTrue(col.isConflicting()); b = ns.getRoot().builder(); b.child("test").setProperty("p", "b"); Revision r2 = merge(ns, b).getRevision(ns.getClusterId()); assertNotNull(r2); doc = getDocument(store, id); c = ns.newRevision(); op = new UpdateOp(id, false); op.setDelete(true); NodeDocument.setDeleted(op, c, true); col = newCollision(doc, r2, op, c, ns); assertTrue(col.isConflicting()); op = new UpdateOp(id, false); op.setMapEntry("p", c, "c"); col = newCollision(doc, r2, op, c, ns); assertTrue(col.isConflicting()); op = new UpdateOp(id, false); op.setMapEntry("q", c, "a"); col = newCollision(doc, r2, op, c, ns); assertFalse(col.isConflicting()); b = ns.getRoot().builder(); b.child("test").remove(); Revision r3 = merge(ns, b).getRevision(ns.getClusterId()); assertNotNull(r3); doc = getDocument(store, id); c = ns.newRevision(); op = new UpdateOp(id, false); op.setDelete(true); NodeDocument.setDeleted(op, c, true); col = newCollision(doc, r3, op, c, ns); assertTrue(col.isConflicting()); op = new UpdateOp(id, false); op.setMapEntry("p", c, "d"); col = newCollision(doc, r3, op, c, ns); assertTrue(col.isConflicting()); }