use of org.apache.jackrabbit.oak.spi.commit.ThreeWayConflictHandler in project jackrabbit-oak by apache.
the class ThreeWayConflictHandlerTest method deleteDeletedProperty.
@Test
public void deleteDeletedProperty() throws Exception {
AtomicBoolean called = new AtomicBoolean(false);
ThreeWayConflictHandler handler = new ErrorThreeWayConflictHandler() {
@Override
public Resolution deleteDeletedProperty(NodeBuilder parent, PropertyState base) {
called.set(true);
assertEquals("base", base.getValue(STRING));
return Resolution.IGNORED;
}
};
ContentRepository repo = newRepo(handler);
Root root = login(repo);
setup(root);
Root ourRoot = login(repo);
Root theirRoot = login(repo);
theirRoot.getTree("/c").removeProperty("p");
ourRoot.getTree("/c").removeProperty("p");
theirRoot.commit();
ourRoot.commit();
assertTrue(called.get());
}
use of org.apache.jackrabbit.oak.spi.commit.ThreeWayConflictHandler in project jackrabbit-oak by apache.
the class ThreeWayConflictHandlerTest method addExistingProperty.
@Test
public void addExistingProperty() throws Exception {
AtomicBoolean called = new AtomicBoolean(false);
ThreeWayConflictHandler handler = new ErrorThreeWayConflictHandler() {
@Override
public Resolution addExistingProperty(NodeBuilder parent, PropertyState ours, PropertyState theirs) {
called.set(true);
assertEquals("ours", ours.getValue(STRING));
assertEquals("theirs", theirs.getValue(STRING));
return Resolution.IGNORED;
}
};
ContentRepository repo = newRepo(handler);
Root root = login(repo);
setup(root);
Root ourRoot = login(repo);
Root theirRoot = login(repo);
theirRoot.getTree("/c").setProperty("p0", "theirs");
ourRoot.getTree("/c").setProperty("p0", "ours");
theirRoot.commit();
ourRoot.commit();
assertTrue(called.get());
}
use of org.apache.jackrabbit.oak.spi.commit.ThreeWayConflictHandler in project jackrabbit-oak by apache.
the class ThreeWayConflictHandlerTest method deleteChangedProperty.
@Test
public void deleteChangedProperty() throws Exception {
AtomicBoolean called = new AtomicBoolean(false);
ThreeWayConflictHandler handler = new ErrorThreeWayConflictHandler() {
@Override
public Resolution deleteChangedProperty(NodeBuilder parent, PropertyState theirs, PropertyState base) {
called.set(true);
assertEquals("theirs", theirs.getValue(STRING));
assertEquals("base", base.getValue(STRING));
return Resolution.IGNORED;
}
};
ContentRepository repo = newRepo(handler);
Root root = login(repo);
setup(root);
Root ourRoot = login(repo);
Root theirRoot = login(repo);
theirRoot.getTree("/c").setProperty("p", "theirs");
ourRoot.getTree("/c").removeProperty("p");
theirRoot.commit();
ourRoot.commit();
assertTrue(called.get());
}
Aggregations