use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testColumnNotAvailable.
@Test(expected = IllegalArgumentException.class)
public void testColumnNotAvailable() {
ResultRow row = mock(ResultRow.class);
doThrow(IllegalArgumentException.class).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
result.getColumnValue("column");
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testMultiNameColumn.
@Test
public void testMultiNameColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.NAMES).when(value).getType();
doReturn(asList("a", "b")).when(value).getValue(Type.NAMES);
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.asMultiName());
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testStringColumn.
@Test
public void testStringColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.STRING).when(value).getType();
doReturn("value").when(value).getValue(Type.STRING);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals("value", remoteValue.asText());
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testDateColumn.
@Test
public void testDateColumn() {
Date now = new Date();
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.DATE).when(value).getType();
doReturn(toFormattedDate(now)).when(value).getValue(Type.DATE);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals(now.getTime(), remoteValue.asDate().longValue());
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testLongColumn.
@Test
public void testLongColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.LONG).when(value).getType();
doReturn(42L).when(value).getValue(Type.LONG);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals(42L, remoteValue.asLong().longValue());
}
Aggregations