Search in sources :

Example 6 with RemoteValue

use of org.apache.jackrabbit.oak.remote.RemoteValue 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());
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) PropertyValue(org.apache.jackrabbit.oak.api.PropertyValue) RemoteValue(org.apache.jackrabbit.oak.remote.RemoteValue) Date(java.util.Date) Test(org.junit.Test)

Example 7 with RemoteValue

use of org.apache.jackrabbit.oak.remote.RemoteValue 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());
}
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 8 with RemoteValue

use of org.apache.jackrabbit.oak.remote.RemoteValue 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 9 with RemoteValue

use of org.apache.jackrabbit.oak.remote.RemoteValue 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 10 with RemoteValue

use of org.apache.jackrabbit.oak.remote.RemoteValue 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)

Aggregations

RemoteValue (org.apache.jackrabbit.oak.remote.RemoteValue)52 Test (org.junit.Test)52 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)28 Tree (org.apache.jackrabbit.oak.api.Tree)28 RemoteTree (org.apache.jackrabbit.oak.remote.RemoteTree)28 PropertyValue (org.apache.jackrabbit.oak.api.PropertyValue)24 ResultRow (org.apache.jackrabbit.oak.api.ResultRow)24 Blob (org.apache.jackrabbit.oak.api.Blob)6 RemoteTreeFilters (org.apache.jackrabbit.oak.remote.RemoteTreeFilters)4 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)2 InputStream (java.io.InputStream)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 Set (java.util.Set)2 BigDecimal (java.math.BigDecimal)1