use of org.apache.jackrabbit.oak.remote.RemoteTreeFilters in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetChildrenWithStart.
@Test
public void testGetChildrenWithStart() {
Tree foo = mock(Tree.class);
doReturn("foo").when(foo).getName();
Tree bar = mock(Tree.class);
doReturn("bar").when(bar).getName();
Tree tree = mock(Tree.class);
doReturn(asList(foo, bar)).when(tree).getChildren();
ContentRemoteTree remoteTree = createTree(tree, new RemoteTreeFilters() {
@Override
public int getChildrenStart() {
return 1;
}
});
Map<String, RemoteTree> children = remoteTree.getChildren();
assertFalse(children.containsKey("foo"));
assertTrue(children.containsKey("bar"));
}
use of org.apache.jackrabbit.oak.remote.RemoteTreeFilters in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetChildrenWithNegativeStart.
@Test
public void testGetChildrenWithNegativeStart() {
Tree foo = mock(Tree.class);
doReturn("foo").when(foo).getName();
Tree bar = mock(Tree.class);
doReturn("bar").when(bar).getName();
Tree tree = mock(Tree.class);
doReturn(asList(foo, bar)).when(tree).getChildren();
ContentRemoteTree remoteTree = createTree(tree, new RemoteTreeFilters() {
@Override
public int getChildrenStart() {
return -1;
}
});
Map<String, RemoteTree> children = remoteTree.getChildren();
assertTrue(children.containsKey("foo"));
assertTrue(children.containsKey("bar"));
}
use of org.apache.jackrabbit.oak.remote.RemoteTreeFilters in project jackrabbit-oak by apache.
the class ContentRemoteSessionTest method testReadNonExistingTree.
@Test
public void testReadNonExistingTree() throws Exception {
Tree tree = mock(Tree.class);
when(tree.exists()).thenReturn(false);
Root root = mock(Root.class);
when(root.getTree(anyString())).thenReturn(tree);
ContentRemoteRevision revision = mock(ContentRemoteRevision.class);
doReturn(root).when(revision).getRoot();
assertNull(createSession().readTree(revision, "/", new RemoteTreeFilters()));
}
use of org.apache.jackrabbit.oak.remote.RemoteTreeFilters in project jackrabbit-oak by apache.
the class ContentRemoteSessionTest method testReadExistingTree.
@Test
public void testReadExistingTree() throws Exception {
Tree tree = mock(Tree.class);
when(tree.exists()).thenReturn(true);
Root root = mock(Root.class);
when(root.getTree(anyString())).thenReturn(tree);
ContentRemoteRevision revision = mock(ContentRemoteRevision.class);
doReturn(root).when(revision).getRoot();
assertNotNull(createSession().readTree(revision, "/", new RemoteTreeFilters()));
}
use of org.apache.jackrabbit.oak.remote.RemoteTreeFilters in project jackrabbit-oak by apache.
the class ContentRemoteSessionTest method testReadTreeWithNullPath.
@Test(expected = IllegalArgumentException.class)
public void testReadTreeWithNullPath() throws Exception {
ContentRemoteRevision revision = mock(ContentRemoteRevision.class);
createSession().readTree(revision, null, new RemoteTreeFilters());
}
Aggregations