use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiWeakReferenceProperty.
@Test
public void testGetMultiWeakReferenceProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.WEAKREFERENCES).when(property).getType();
doReturn(singletonList("value")).when(property).getValue(Type.WEAKREFERENCES);
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").isMultiWeakReference());
assertEquals("value", getOnlyElement(properties.get("name").asMultiWeakReference()));
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testMultiDateColumn.
@Test
public void testMultiDateColumn() {
Date first = new Date(4);
Date second = new Date(2);
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.DATES).when(value).getType();
doReturn(toFormattedDates(first, second)).when(value).getValue(Type.DATES);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals(asList(4L, 2L), remoteValue.asMultiDate());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testBinaryColumn.
@Test
public void testBinaryColumn() {
Blob blob = mock(Blob.class);
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.BINARY).when(value).getType();
doReturn(blob).when(value).getValue(Type.BINARY);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteBinaries binaries = mock(ContentRemoteBinaries.class);
doReturn("id").when(binaries).put(blob);
ContentRemoteResult result = createResult(binaries, row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals("id", remoteValue.asBinaryId());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testMultiUriColumn.
@Test
public void testMultiUriColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.URIS).when(value).getType();
doReturn(asList("a", "b")).when(value).getValue(Type.URIS);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals(asList("a", "b"), remoteValue.asMultiUri());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testPathProperty.
@Test
public void testPathProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.PATH).when(property).getType();
doReturn("value").when(property).getValue(Type.PATH);
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").isPath());
assertEquals("value", properties.get("name").asPath());
}
Aggregations