use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetBooleanProperty.
@Test
public void testGetBooleanProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.BOOLEAN).when(property).getType();
doReturn(true).when(property).getValue(Type.BOOLEAN);
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").isBoolean());
assertEquals(true, properties.get("name").asBoolean());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetMultiDecimalProperty.
@Test
public void testGetMultiDecimalProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.DECIMALS).when(property).getType();
doReturn(singletonList(BigDecimal.ONE)).when(property).getValue(Type.DECIMALS);
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").isMultiDecimal());
assertEquals(BigDecimal.ONE, getOnlyElement(properties.get("name").asMultiDecimal()));
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testNameProperty.
@Test
public void testNameProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.NAME).when(property).getType();
doReturn("value").when(property).getValue(Type.NAME);
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").isName());
assertEquals("value", properties.get("name").asName());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testGetDateProperty.
@Test
public void testGetDateProperty() {
Calendar calendar = Calendar.getInstance();
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.DATE).when(property).getType();
doReturn(ISO8601.format(calendar)).when(property).getValue(Type.DATE);
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").isDate());
assertEquals(calendar.getTimeInMillis(), properties.get("name").asDate().longValue());
}
use of org.apache.jackrabbit.oak.remote.RemoteValue in project jackrabbit-oak by apache.
the class ContentRemoteTreeTest method testUriProperty.
@Test
public void testUriProperty() {
PropertyState property = mock(PropertyState.class);
doReturn("name").when(property).getName();
doReturn(Type.URI).when(property).getType();
doReturn("value").when(property).getValue(Type.URI);
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").isUri());
assertEquals("value", properties.get("name").asUri());
}
Aggregations