use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiTextProperty.
@Test
public void testGetMultiTextProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.STRINGS).when(property).getType();
doReturn(singletonList("value")).when(property).getValue(Type.STRINGS);
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").isMultiText());
assertEquals("value", getOnlyElement(properties.get("name").asMultiText()));
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testTextProperty.
@Test
public void testTextProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.STRING).when(property).getType();
doReturn("value").when(property).getValue(Type.STRING);
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").isText());
assertEquals("value", properties.get("name").asText());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testFilterPropertyIn.
@Test
public void testFilterPropertyIn() {
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("foo");
}
});
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 ContentRemoteResultTest method testWeakReferenceColumn.
@Test
public void testWeakReferenceColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.WEAKREFERENCE).when(value).getType();
doReturn("value").when(value).getValue(Type.WEAKREFERENCE);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals("value", remoteValue.asWeakReference());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testWeakReferenceProperty.
@Test
public void testWeakReferenceProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.WEAKREFERENCE).when(property).getType();
doReturn("value").when(property).getValue(Type.WEAKREFERENCE);
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").isWeakReference());
assertEquals("value", properties.get("name").asWeakReference());
}
Aggregations