use of org.apache.jackrabbit.oak.api.ResultRow 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.api.ResultRow 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.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testDoubleColumn.
@Test
public void testDoubleColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.DOUBLE).when(value).getType();
doReturn(4.2).when(value).getValue(Type.DOUBLE);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals(4.2, remoteValue.asDouble().doubleValue(), 1e-5);
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testDecimalColumn.
@Test
public void testDecimalColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.DECIMAL).when(value).getType();
doReturn(BigDecimal.ONE).when(value).getValue(Type.DECIMAL);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals(BigDecimal.ONE, remoteValue.asDecimal());
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testSelectorNotAvailable.
@Test(expected = IllegalArgumentException.class)
public void testSelectorNotAvailable() {
ResultRow row = mock(ResultRow.class);
doThrow(IllegalArgumentException.class).when(row).getPath("selector");
createResult(row).getSelectorPath("selector");
}
Aggregations