use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiPathProperty.
@Test
public void testGetMultiPathProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.PATHS).when(property).getType();
doReturn(singletonList("value")).when(property).getValue(Type.PATHS);
Tree tree = mock(Tree.class);
doReturn(singletonList(property)).when(tree).getProperties();
Map<String, RemoteValue> properties = createTree(tree).getProperties();
assertTrue(properties.containsKey("name"));
assertTrue(properties.get("name").isMultiPath());
assertEquals("value", getOnlyElement(properties.get("name").asMultiPath()));
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testDecimalProperty.
@Test
public void testDecimalProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.DECIMAL).when(property).getType();
doReturn(BigDecimal.ONE).when(property).getValue(Type.DECIMAL);
Tree tree = mock(Tree.class);
doReturn(singletonList(property)).when(tree).getProperties();
Map<String, RemoteValue> properties = createTree(tree).getProperties();
assertTrue(properties.containsKey("name"));
assertTrue(properties.get("name").isDecimal());
assertEquals(BigDecimal.ONE, properties.get("name").asDecimal());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiBooleanProperty.
@Test
public void testGetMultiBooleanProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.BOOLEANS).when(property).getType();
doReturn(singletonList(true)).when(property).getValue(Type.BOOLEANS);
Tree tree = mock(Tree.class);
doReturn(singletonList(property)).when(tree).getProperties();
Map<String, RemoteValue> properties = createTree(tree).getProperties();
assertTrue(properties.containsKey("name"));
assertTrue(properties.get("name").isMultiBoolean());
assertEquals(true, getOnlyElement(properties.get("name").asMultiBoolean()));
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetBinaryProperty.
@Test
public void testGetBinaryProperty() {
InputStream stream = mock(InputStream.class);
Blob blob = mock(Blob.class);
doReturn(stream).when(blob).getNewStream();
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.BINARY).when(property).getType();
doReturn(blob).when(property).getValue(Type.BINARY);
Tree tree = mock(Tree.class);
doReturn(singletonList(property)).when(tree).getProperties();
ContentRemoteTree remoteTree = createTree(tree, new RemoteTreeFilters() {
@Override
public long getBinaryThreshold() {
return Long.MAX_VALUE;
}
});
Map<String, RemoteValue> properties = remoteTree.getProperties();
assertTrue(properties.containsKey("name"));
assertTrue(properties.get("name").isBinary());
assertEquals(stream, properties.get("name").asBinary().get());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiBinaryIdProperty.
@Test
public void testGetMultiBinaryIdProperty() {
Blob blob = mock(Blob.class);
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.BINARIES).when(property).getType();
doReturn(singletonList(blob)).when(property).getValue(Type.BINARIES);
Tree tree = mock(Tree.class);
doReturn(singletonList(property)).when(tree).getProperties();
ContentRemoteBinaries binaries = mock(ContentRemoteBinaries.class);
doReturn("id").when(binaries).put(blob);
Map<String, RemoteValue> properties = createTree(tree, binaries).getProperties();
assertTrue(properties.containsKey("name"));
assertTrue(properties.get("name").isMultiBinaryId());
assertEquals("id", getOnlyElement(properties.get("name").asMultiBinaryId()));
}
Aggregations