Search in sources :

Example 26 with PropertyValue

use of org.apache.jackrabbit.oak.api.PropertyValue 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 27 with PropertyValue

use of org.apache.jackrabbit.oak.api.PropertyValue 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 28 with PropertyValue

use of org.apache.jackrabbit.oak.api.PropertyValue 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 29 with PropertyValue

use of org.apache.jackrabbit.oak.api.PropertyValue 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 30 with PropertyValue

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

Aggregations

PropertyValue (org.apache.jackrabbit.oak.api.PropertyValue)57 Test (org.junit.Test)28 ResultRow (org.apache.jackrabbit.oak.api.ResultRow)26 RemoteValue (org.apache.jackrabbit.oak.remote.RemoteValue)24 Tree (org.apache.jackrabbit.oak.api.Tree)5 ParseException (java.text.ParseException)4 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)4 ArrayList (java.util.ArrayList)3 Result (org.apache.jackrabbit.oak.api.Result)3 Date (java.util.Date)2 Blob (org.apache.jackrabbit.oak.api.Blob)2 LiteralImpl (org.apache.jackrabbit.oak.query.ast.LiteralImpl)2 StaticOperandImpl (org.apache.jackrabbit.oak.query.ast.StaticOperandImpl)2 FulltextQueryIndex (org.apache.jackrabbit.oak.spi.query.QueryIndex.FulltextQueryIndex)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 BigDecimal (java.math.BigDecimal)1 Calendar (java.util.Calendar)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 InvalidQueryException (javax.jcr.query.InvalidQueryException)1