Package org.apache.jackrabbit.oak.plugins.memory

Examples of org.apache.jackrabbit.oak.plugins.memory.PropertyBuilder.assignFrom()


    @Test
    public void testAssignFromLong() {
        PropertyState source = LongPropertyState.createLongProperty("foo", 42L);
        PropertyBuilder builder = PropertyBuilder.scalar(Type.STRING);
        builder.assignFrom(source);
        assertEquals(StringPropertyState.stringProperty("foo", "42"),
                builder.getPropertyState());
    }

    @Test
View Full Code Here


    @Test
    public void testAssignFromString() {
        PropertyState source = StringPropertyState.stringProperty("foo", "42");
        PropertyBuilder builder = PropertyBuilder.scalar(Type.LONG);
        builder.assignFrom(source);
        assertEquals(LongPropertyState.createLongProperty("foo", 42L),
                builder.getPropertyState());
    }

    @Test
View Full Code Here

    @Test
    public void testAssignFromDate() {
        String date = "1970-01-01T00:00:00.000Z";
        PropertyState source = GenericPropertyState.dateProperty("foo", date);
        PropertyBuilder builder = PropertyBuilder.scalar(Type.DATE);
        builder.assignFrom(source);
        assertEquals(source, builder.getPropertyState());
    }

    @Test(expected = NumberFormatException.class)
    public void testAssignFromStringNumberFormatException() {
View Full Code Here

    @Test(expected = NumberFormatException.class)
    public void testAssignFromStringNumberFormatException() {
        PropertyState source = StringPropertyState.stringProperty("foo", "bar");
        PropertyBuilder builder = PropertyBuilder.scalar(Type.LONG);
        builder.assignFrom(source);
    }

    @Test
    public void testAssignFromLongs() {
        PropertyState source = MultiLongPropertyState.createLongProperty("foo", Arrays.asList(1L, 2L, 3L));
View Full Code Here

    @Test
    public void testAssignFromLongs() {
        PropertyState source = MultiLongPropertyState.createLongProperty("foo", Arrays.asList(1L, 2L, 3L));
        PropertyBuilder builder = PropertyBuilder.scalar(Type.STRING);
        builder.assignFrom(source);
        assertEquals(MultiStringPropertyState.stringProperty("foo", Arrays.asList("1", "2", "3")),
                builder.getPropertyState());
    }

    @Test
View Full Code Here

    @Test
    public void testAssignFromStrings() {
        PropertyState source = MultiStringPropertyState.stringProperty("foo", Arrays.asList("1", "2", "3"));
        PropertyBuilder builder = PropertyBuilder.scalar(Type.LONG);
        builder.assignFrom(source);
        assertEquals(MultiLongPropertyState.createLongProperty("foo", Arrays.asList(1L, 2L, 3L)),
                builder.getPropertyState());
    }

    @Test
View Full Code Here

    public void testAssignFromDates() {
        String date1 = "1970-01-01T00:00:00.000Z";
        String date2 = "1971-01-01T00:00:00.000Z";
        PropertyState source = MultiGenericPropertyState.dateProperty("foo", Arrays.asList(date1, date2));
        PropertyBuilder builder = PropertyBuilder.scalar(Type.DATE);
        builder.assignFrom(source);
        assertEquals(source, builder.getPropertyState());
    }

    @Test
    public void testAssignInvariant() {
View Full Code Here

    @Test
    public void testAssignInvariant() {
        PropertyState source = MultiStringPropertyState.stringProperty("source", Arrays.asList("1", "2", "3"));
        PropertyBuilder builder = PropertyBuilder.scalar(Type.STRING);
        builder.assignFrom(source);
        assertEquals(source, builder.getPropertyState());
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.