Package com.asakusafw.runtime.value

Examples of com.asakusafw.runtime.value.Date


        DateOption option = new DateOption();

        assertThat(parser.next(), is(true));

        parser.fill(option);
        assertThat(option.get(), is(new Date(2011, 3, 31)));

        parser.fill(option);
        assertThat(option.get(), is(new Date(1971, 4, 1)));

        parser.fill(option);
        assertThat(option.isNull(), is(true));

        parser.endRecord();
View Full Code Here


            DateOption date = new DateOption();
            while (parser.next()) {
                parser.fill(date);
                parser.endRecord();
                if (rows == 0) {
                    assertThat(date, is(new DateOption(new Date(1999, 12, 31))));
                }
                rows++;
            }
            parser.close();
            assertThat(rows, is(count));
View Full Code Here

        assertThat(parser.next(), is(false));
    }

    private Date date(int y, int m, int d) {
        int elapsed = DateUtil.getDayFromDate(y, m, d);
        Date date = new Date();
        date.setElapsedDays(elapsed);
        return date;
    }
View Full Code Here

        assertThat(object.get("type_decimal"), eq(new BigDecimal("1234.567")));

        object.set("type_text", new Text("Hello, world!"));
        assertThat(object.get("type_text"), eq(new Text("Hello, world!")));

        object.set("type_date", new Date(2011, 3, 31));
        assertThat(object.get("type_date"), eq(new Date(2011, 3, 31)));

        object.set("type_datetime", new DateTime(2011, 3, 31, 23, 30, 1));
        assertThat(object.get("type_datetime"), eq(new DateTime(2011, 3, 31, 23, 30, 1)));
    }
View Full Code Here

        assertThat(parser.next(), is(false));
    }

    private Date date(int y, int m, int d) {
        int elapsed = DateUtil.getDayFromDate(y, m, d);
        Date date = new Date();
        date.setElapsedDays(elapsed);
        return date;
    }
View Full Code Here

        object.set("type_long", 200L);
        object.set("type_float", 300.f);
        object.set("type_double", 400.d);
        object.set("type_decimal", new BigDecimal("1234.567"));
        object.set("type_text", new Text("Hello, world!"));
        object.set("type_date", new Date(2011, 3, 31));
        object.set("type_datetime", new DateTime(2011, 3, 31, 23, 30, 1));

        Writable writable = (Writable) object.unwrap();

        DataOutputBuffer output = new DataOutputBuffer();
View Full Code Here

        assertThat(object.get("key"), eq(127));
        object.set("sum", 256L);
        assertThat(object.get("sum"), eq(256L));
        object.set("count", 10L);
        assertThat(object.get("count"), eq(10L));
        object.set("max", new Date(2011, 12, 31));
        assertThat(object.get("max"), eq(new Date(2011, 12, 31)));
        object.set("min", new Date(2011, 4, 1));
        assertThat(object.get("min"), eq(new Date(2011, 4, 1)));
    }
View Full Code Here

        assertThat(object.get("key"), eq(127));
        object.set("sum", 256L);
        assertThat(object.get("sum"), eq(256L));
        object.set("count", 10L);
        assertThat(object.get("count"), eq(10L));
        object.set("max", new Date(2011, 12, 31));
        assertThat(object.get("max"), eq(new Date(2011, 12, 31)));
        object.set("min", new Date(2011, 4, 1));
        assertThat(object.get("min"), eq(new Date(2011, 4, 1)));

        Summarized annotation = object.unwrap().getClass().getAnnotation(Summarized.class);
        assertThat(annotation, not(nullValue()));

        loader.setNamespace(Constants.SOURCE_TABLE);
View Full Code Here

        all.set("c_short", (short) 1023);
        all.set("c_long", 100000L);
        all.set("c_float", 1.5f);
        all.set("c_double", 2.5f);
        all.set("c_decimal", new BigDecimal("3.1415"));
        all.set("c_date", new Date(2011, 9, 1));
        all.set("c_datetime", new DateTime(2011, 12, 31, 23, 59, 59));

        DataModelStreamSupport<Object> unsafe = unsafe(support);

        ByteArrayOutputStream output = new ByteArrayOutputStream();
View Full Code Here

     * test for date values.
     * @throws Exception if failed
     */
    @Test
    public void date_values() throws Exception {
        assertRestorable(new DateOption(new Date(2011, 3, 31)));
        assertRestorable(new DateOption(new Date(1971, 4, 1)));
        assertRestorable(new DateOption());

        dateFormat = "yyyy-MM\"dd";
        assertRestorable(new DateOption(new Date(2011, 3, 31)));
        assertRestorable(new DateOption(new Date(1971, 4, 1)));

        dateFormat = "yyyy-MM,dd";
        assertRestorable(new DateOption(new Date(2011, 3, 31)));
        assertRestorable(new DateOption(new Date(1971, 4, 1)));

        dateFormat = "yyyy-MM\ndd";
        assertRestorable(new DateOption(new Date(2011, 3, 31)));
        assertRestorable(new DateOption(new Date(1971, 4, 1)));

        dateFormat = "yyyy-MM\rdd";
        assertRestorable(new DateOption(new Date(2011, 3, 31)));
        assertRestorable(new DateOption(new Date(1971, 4, 1)));
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.runtime.value.Date

Copyright © 2018 www.massapicom. 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.