store.getRoot().getChildNode("test").getProperty("any"));
}
@Test
public void branch() throws CommitFailedException {
NodeStoreBranch branch = store.branch();
NodeBuilder rootBuilder = store.getBuilder(branch.getRoot());
NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
NodeBuilder newNodeBuilder = testBuilder.getChildBuilder("newNode");
testBuilder.removeNode("x");
CoreValue fortyTwo = store.getValueFactory().createValue(42);
newNodeBuilder.setProperty("n", fortyTwo);
// Assert changes are present in the builder
NodeState testState = rootBuilder.getNodeState().getChildNode("test");
assertNotNull(testState.getChildNode("newNode"));
assertNull(testState.getChildNode("x"));
assertEquals(fortyTwo, testState.getChildNode("newNode").getProperty("n").getValue());
// Assert changes are not yet present in the branch
testState = branch.getRoot().getChildNode("test");
assertNull(testState.getChildNode("newNode"));
assertNotNull(testState.getChildNode("x"));
branch.setRoot(rootBuilder.getNodeState());
// Assert changes are present in the branch
testState = branch.getRoot().getChildNode("test");
assertNotNull(testState.getChildNode("newNode"));
assertNull(testState.getChildNode("x"));
assertEquals(fortyTwo, testState.getChildNode("newNode").getProperty("n").getValue());
// Assert changes are not yet present in the trunk
testState = store.getRoot().getChildNode("test");
assertNull(testState.getChildNode("newNode"));
assertNotNull(testState.getChildNode("x"));
branch.merge();
// Assert changes are present in the trunk
testState = store.getRoot().getChildNode("test");
assertNotNull(testState.getChildNode("newNode"));
assertNull(testState.getChildNode("x"));