Search in sources :

Example 16 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class ContentRemoteResultTest method testMultiLongColumn.

@Test
public void testMultiLongColumn() {
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.LONGS).when(value).getType();
    doReturn(asList(4L, 2L)).when(value).getValue(Type.LONGS);
    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.asMultiLong());
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) PropertyValue(org.apache.jackrabbit.oak.api.PropertyValue) RemoteValue(org.apache.jackrabbit.oak.remote.RemoteValue) Test(org.junit.Test)

Example 17 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class ContentRemoteResultTest method testMultiPathColumn.

@Test
public void testMultiPathColumn() {
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.PATHS).when(value).getType();
    doReturn(asList("a", "b")).when(value).getValue(Type.PATHS);
    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.asMultiPath());
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) PropertyValue(org.apache.jackrabbit.oak.api.PropertyValue) RemoteValue(org.apache.jackrabbit.oak.remote.RemoteValue) Test(org.junit.Test)

Example 18 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class ContentRemoteResultTest method testMultiReferenceColumn.

@Test
public void testMultiReferenceColumn() {
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.REFERENCES).when(value).getType();
    doReturn(asList("a", "b")).when(value).getValue(Type.REFERENCES);
    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.asMultiReference());
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) PropertyValue(org.apache.jackrabbit.oak.api.PropertyValue) RemoteValue(org.apache.jackrabbit.oak.remote.RemoteValue) Test(org.junit.Test)

Example 19 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class ContentRemoteResultTest method testPathColumn.

@Test
public void testPathColumn() {
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.PATH).when(value).getType();
    doReturn("value").when(value).getValue(Type.PATH);
    ResultRow row = mock(ResultRow.class);
    doReturn(value).when(row).getValue("column");
    ContentRemoteResult result = createResult(row);
    RemoteValue remoteValue = result.getColumnValue("column");
    assertEquals("value", remoteValue.asPath());
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) PropertyValue(org.apache.jackrabbit.oak.api.PropertyValue) RemoteValue(org.apache.jackrabbit.oak.remote.RemoteValue) Test(org.junit.Test)

Example 20 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class ContentRemoteResultTest method testSelector.

@Test
public void testSelector() {
    ResultRow row = mock(ResultRow.class);
    doReturn("path").when(row).getPath("selector");
    assertEquals("path", createResult(row).getSelectorPath("selector"));
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) Test(org.junit.Test)

Aggregations

ResultRow (org.apache.jackrabbit.oak.api.ResultRow)41 Test (org.junit.Test)29 PropertyValue (org.apache.jackrabbit.oak.api.PropertyValue)26 RemoteValue (org.apache.jackrabbit.oak.remote.RemoteValue)24 Result (org.apache.jackrabbit.oak.api.Result)12 Tree (org.apache.jackrabbit.oak.api.Tree)4 ParseException (java.text.ParseException)3 Root (org.apache.jackrabbit.oak.api.Root)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Iterator (java.util.Iterator)2 NoSuchElementException (java.util.NoSuchElementException)2 Nonnull (javax.annotation.Nonnull)2 NodeIterator (javax.jcr.NodeIterator)2 RowIterator (javax.jcr.query.RowIterator)2 Blob (org.apache.jackrabbit.oak.api.Blob)2 PrefetchOptions (org.apache.jackrabbit.oak.jcr.query.PrefetchIterator.PrefetchOptions)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 BigDecimal (java.math.BigDecimal)1 HashSet (java.util.HashSet)1