Search in sources :

Example 21 with ResultRow

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

the class ContentRemoteResultTest method testUriColumn.

@Test
public void testUriColumn() {
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.URI).when(value).getType();
    doReturn("value").when(value).getValue(Type.URI);
    ResultRow row = mock(ResultRow.class);
    doReturn(value).when(row).getValue("column");
    ContentRemoteResult result = createResult(row);
    RemoteValue remoteValue = result.getColumnValue("column");
    assertEquals("value", remoteValue.asUri());
}
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 22 with ResultRow

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

the class ContentRemoteResultTest method testMultiDoubleColumn.

@Test
public void testMultiDoubleColumn() {
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.DOUBLES).when(value).getType();
    doReturn(asList(4.0, 2.0)).when(value).getValue(Type.DOUBLES);
    ResultRow row = mock(ResultRow.class);
    doReturn(value).when(row).getValue("column");
    ContentRemoteResult result = createResult(row);
    RemoteValue remoteValue = result.getColumnValue("column");
    assertEquals(asList(4.0, 2.0), remoteValue.asMultiDouble());
}
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 23 with ResultRow

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

the class ContentRemoteResultTest method testMultiWeakReferenceColumn.

@Test
public void testMultiWeakReferenceColumn() {
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.WEAKREFERENCES).when(value).getType();
    doReturn(asList("a", "b")).when(value).getValue(Type.WEAKREFERENCES);
    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.asMultiWeakReference());
}
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 24 with ResultRow

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

the class ContentRemoteResultTest method testMultiDecimalColumn.

@Test
public void testMultiDecimalColumn() {
    BigDecimal first = new BigDecimal(4);
    BigDecimal second = new BigDecimal(2);
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.DECIMALS).when(value).getType();
    doReturn(asList(first, second)).when(value).getValue(Type.DECIMALS);
    ResultRow row = mock(ResultRow.class);
    doReturn(value).when(row).getValue("column");
    ContentRemoteResult result = createResult(row);
    RemoteValue remoteValue = result.getColumnValue("column");
    assertEquals(asList(first, second), remoteValue.asMultiDecimal());
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) PropertyValue(org.apache.jackrabbit.oak.api.PropertyValue) RemoteValue(org.apache.jackrabbit.oak.remote.RemoteValue) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 25 with ResultRow

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

the class ContentRemoteResultTest method testNameColumn.

@Test
public void testNameColumn() {
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.NAME).when(value).getType();
    doReturn("value").when(value).getValue(Type.NAME);
    ResultRow row = mock(ResultRow.class);
    doReturn(value).when(row).getValue("column");
    ContentRemoteResult result = createResult(row);
    RemoteValue remoteValue = result.getColumnValue("column");
    assertEquals("value", remoteValue.asName());
}
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)

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