use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiReferenceProperty.
@Test
public void testGetMultiReferenceProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.REFERENCES).when(property).getType();
doReturn(singletonList("value")).when(property).getValue(Type.REFERENCES);
Tree tree = mock(Tree.class);
doReturn(singletonList(property)).when(tree).getProperties();
Map<String, RemoteValue> properties = createTree(tree).getProperties();
assertTrue(properties.containsKey("name"));
assertTrue(properties.get("name").isMultiReference());
assertEquals("value", getOnlyElement(properties.get("name").asMultiReference()));
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiDoubleProperty.
@Test
public void testGetMultiDoubleProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.DOUBLES).when(property).getType();
doReturn(singletonList(4.2)).when(property).getValue(Type.DOUBLES);
Tree tree = mock(Tree.class);
doReturn(singletonList(property)).when(tree).getProperties();
Map<String, RemoteValue> properties = createTree(tree).getProperties();
assertTrue(properties.containsKey("name"));
assertTrue(properties.get("name").isMultiDouble());
assertEquals(4.2, getOnlyElement(properties.get("name").asMultiDouble()), 1e-9);
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testFilterPropertyOut.
@Test
public void testFilterPropertyOut() {
PropertyState fooProperty = mock(PropertyState.class);
doReturn("foo").when(fooProperty).getName();
doReturn(Type.BOOLEAN).when(fooProperty).getType();
doReturn(true).when(fooProperty).getValue(Type.BOOLEAN);
PropertyState barProperty = mock(PropertyState.class);
doReturn("bar").when(barProperty).getName();
doReturn(Type.BOOLEAN).when(barProperty).getType();
doReturn(true).when(barProperty).getValue(Type.BOOLEAN);
Tree tree = mock(Tree.class);
doReturn(asList(fooProperty, barProperty)).when(tree).getProperties();
ContentRemoteTree remoteTree = createTree(tree, new RemoteTreeFilters() {
@Override
public Set<String> getPropertyFilters() {
return newHashSet("-bar");
}
});
Map<String, RemoteValue> properties = remoteTree.getProperties();
assertTrue(properties.containsKey("foo"));
assertFalse(properties.containsKey("bar"));
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiLongProperty.
@Test
public void testGetMultiLongProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.LONGS).when(property).getType();
doReturn(singletonList(42L)).when(property).getValue(Type.LONGS);
Tree tree = mock(Tree.class);
doReturn(singletonList(property)).when(tree).getProperties();
Map<String, RemoteValue> properties = createTree(tree).getProperties();
assertTrue(properties.containsKey("name"));
assertTrue(properties.get("name").isMultiLong());
assertEquals(42L, getOnlyElement(properties.get("name").asMultiLong()).longValue());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiUriProperty.
@Test
public void testGetMultiUriProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.URIS).when(property).getType();
doReturn(singletonList("value")).when(property).getValue(Type.URIS);
Tree tree = mock(Tree.class);
doReturn(singletonList(property)).when(tree).getProperties();
Map<String, RemoteValue> properties = createTree(tree).getProperties();
assertTrue(properties.containsKey("name"));
assertTrue(properties.get("name").isMultiUri());
assertEquals("value", getOnlyElement(properties.get("name").asMultiUri()));
}
Aggregations