首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >杰克兔Oak合并未保存更改

杰克兔Oak合并未保存更改
EN

Stack Overflow用户
提问于 2017-08-09 21:35:45
回答 1查看 67关注 0票数 2

我刚开始查看Jackrabbit 1.7.5,我无法保存我的更改--这个测试在最后一个断言中失败了:

代码语言:javascript
复制
public class JCRTest {

@Test
public void testCommit() throws CommitFailedException {
    final NodeStore ns = new MemoryNodeStore();
    final String imagesFolder = "images";
    NodeState rootState = ns.getRoot();

    //newly created store does not have nodes
    assertThat(rootState.getChildNode(imagesFolder).exists(), is(equalTo(false)));

    NodeBuilder rootBuilder = rootState.builder();
    //adding a node called 'images'
    rootBuilder.child(imagesFolder);

    //it is still not going to be shown since we are working in our own 'state'
    assertThat(rootState.getChildNode(imagesFolder).exists(), is(equalTo(false)));

    //merging the changes into root
    ns.merge(rootBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);

    //expecting to see the 'images' folder
    assertThat(rootState.getChildNode(imagesFolder).exists(), is(equalTo(true)));
}
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-10 05:43:46

NodeState (测试中的rootState)是存储库的快照。合并更改后,您需要再次获得存储库的头(即在断言之前再次执行rootState = ns.getRoot() )。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45592284

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档