Package com.asakusafw.runtime.value

Examples of com.asakusafw.runtime.value.Date


        edits.put("datetime", StringValueSerdeFactory.DATETIME);
        ParquetFileFormat<WithStringSupports> format = format(WithStringSupports.class, edits);

        WithStringSupports in = new WithStringSupports();
        in.decimal.modify(new BigDecimal("123.45"));
        in.date.modify(new Date(2014, 7, 1));
        in.datetime.modify(new DateTime(2014, 7, 1, 12, 34, 56));

        WithStringSupports out = restore(format, in);
        assertThat(out.decimal, is(in.decimal));
        assertThat(out.date, is(in.date));
View Full Code Here


        int count = 1000;
        List<WithStringSupports> inputs = new ArrayList<WithStringSupports>();
        for (int i = 0; i < count; i++) {
            WithStringSupports object = new WithStringSupports();
            object.decimal.modify(new BigDecimal("123.45"));
            object.date.modify(new Date(2014, 7, 1));
            object.datetime.modify(new DateTime(2014, 7, 1, 12, 34, 56));
            inputs.add(object);
        }
        WithStringSupports sample = inputs.get(0);
        List<WithStringSupports> outputs = restore(format, inputs);
View Full Code Here

    @Test
    public void date_by_string() {
        ValueSerde serde = StringValueSerdeFactory.DATE;
        StringObjectInspector inspector = (StringObjectInspector) serde.getInspector();

        DateOption option = new DateOption(new Date(2014, 7, 1));
        String value = "2014-07-01";

        assertThat(inspector.copyObject(option), is((Object) option));
        assertThat(inspector.copyObject(option), is(not(sameInstance((Object) option))));
        assertThat(inspector.copyObject(null), is(nullValue()));
View Full Code Here

    @Test
    public void date_by_timestamp() {
        ValueSerde serde = TimestampValueSerdeFactory.DATE;
        TimestampObjectInspector inspector = (TimestampObjectInspector) serde.getInspector();

        DateOption option = new DateOption(new Date(2014, 7, 1));
        Timestamp value = new Timestamp(2014 - 1900, 7 - 1, 1, 0, 0, 0, 0);

        assertThat(inspector.copyObject(option), is((Object) option));
        assertThat(inspector.copyObject(option), is(not(sameInstance((Object) option))));
        assertThat(inspector.copyObject(null), is(nullValue()));
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));

        BinaryStreamFormat<Object> unsafe = unsafe(support);

        ByteArrayOutputStream output = new ByteArrayOutputStream();
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));

        BinaryStreamFormat<Object> unsafe = unsafe(support);

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

        ModelLoader loaded = generateJava("attributes");
        ModelWrapper model = loaded.newModel("Model");
        model.set("text_value", new Text("\u3042\u3044\u3046\u3048\u304a"));
        model.set("true_value", true);
        model.set("false_value", false);
        model.set("date_value", new Date(2011, 10, 11));
        model.set("date_time_value", new DateTime(2011, 1, 2, 13, 14, 15));
        BinaryStreamFormat<Object> support = unsafe(loaded.newObject("csv", "ModelCsvFormat"));

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        ModelOutput<Object> writer = support.createOutput(model.unwrap().getClass(), "hello", output);
View Full Code Here

        object.setPFloat(1.5f);
        object.setPDouble(2.5d);
        object.setPDecimal(new BigDecimal("3.141592"));
        object.setPTextAsString("Hello, world!");
        object.setPBoolean(true);
        object.setPDate(new Date(2011, 5, 2));
        object.setPDatetime(new DateTime(2011, 12, 31, 23, 59, 59));

        DataModelReflection ref = def.toReflection(object);
        assertThat(ref.getValue(p("p_int")), is((Object) 100));
        assertThat(ref.getValue(p("p_long")), is((Object) 200L));
View Full Code Here

        object.setPDouble(2.5d);
        object.setPByte((byte) 127);
        object.setPDecimal(new BigDecimal("3.141592"));
        object.setPTextAsString("Hello, world!");
        object.setPBoolean(true);
        object.setPDate(new Date(2011, 5, 2));
        object.setPDatetime(new DateTime(2011, 12, 31, 23, 59, 59));

        DataModelReflection ref = def.toReflection(object);
        Variety restored = def.toObject(ref);
        assertThat(restored, not(sameInstance(object)));
View Full Code Here

        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.get(), is(new Date(1971, 4, 1)));

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

        parser.endRecord();
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.