use of org.apache.jackrabbit.oak.remote.RemoteTree in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetChildrenWithSlicing.
@Test
public void testGetChildrenWithSlicing() {
Tree foo = mock(Tree.class);
doReturn("foo").when(foo).getName();
Tree bar = mock(Tree.class);
doReturn("bar").when(bar).getName();
Tree baz = mock(Tree.class);
doReturn("baz").when(baz).getName();
Tree tree = mock(Tree.class);
doReturn(asList(foo, bar, baz)).when(tree).getChildren();
ContentRemoteTree remoteTree = createTree(tree, new RemoteTreeFilters() {
@Override
public int getChildrenStart() {
return 1;
}
@Override
public int getChildrenCount() {
return 1;
}
});
Map<String, RemoteTree> children = remoteTree.getChildren();
assertFalse(children.containsKey("foo"));
assertTrue(children.containsKey("bar"));
assertFalse(children.containsKey("baz"));
}
use of org.apache.jackrabbit.oak.remote.RemoteTree in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetChildrenWithExcludeFilters.
@Test
public void testGetChildrenWithExcludeFilters() {
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 Set<String> getNodeFilters() {
return newHashSet("-bar");
}
});
Map<String, RemoteTree> children = remoteTree.getChildren();
assertTrue(children.containsKey("foo"));
assertFalse(children.containsKey("bar"));
}
use of org.apache.jackrabbit.oak.remote.RemoteTree in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetChildrenWithCount.
@Test
public void testGetChildrenWithCount() {
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 getChildrenCount() {
return 1;
}
});
Map<String, RemoteTree> children = remoteTree.getChildren();
assertTrue(children.containsKey("foo"));
assertFalse(children.containsKey("bar"));
}
use of org.apache.jackrabbit.oak.remote.RemoteTree in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetChildrenMaxDepth.
@Test
public void testGetChildrenMaxDepth() {
Tree child = mock(Tree.class);
doReturn("child").when(child).getName();
Tree tree = mock(Tree.class);
doReturn(asList(child)).when(tree).getChildren();
Map<String, RemoteTree> children = createTree(tree).getChildren();
assertTrue(children.containsKey("child"));
assertNull(children.get("child"));
}
use of org.apache.jackrabbit.oak.remote.RemoteTree in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetChildrenWithSlicingAndFiltering.
@Test
public void testGetChildrenWithSlicingAndFiltering() {
Tree bar = mock(Tree.class);
doReturn("bar").when(bar).getName();
Tree foo = mock(Tree.class);
doReturn("foo").when(foo).getName();
Tree baz = mock(Tree.class);
doReturn("baz").when(baz).getName();
Tree tree = mock(Tree.class);
doReturn(asList(bar, foo, baz)).when(tree).getChildren();
ContentRemoteTree remoteTree = createTree(tree, new RemoteTreeFilters() {
@Override
public Set<String> getNodeFilters() {
return Sets.newHashSet("ba*");
}
@Override
public int getChildrenStart() {
return 1;
}
@Override
public int getChildrenCount() {
return 1;
}
});
Map<String, RemoteTree> children = remoteTree.getChildren();
assertFalse(children.containsKey("bar"));
assertFalse(children.containsKey("foo"));
assertFalse(children.containsKey("baz"));
}
Aggregations