Package org.apache.pig.piggybank.evaluation.datetime.convert

Examples of org.apache.pig.piggybank.evaluation.datetime.convert.CustomFormatToISO.exec()


    public void testBadFormat() throws Exception {
        Tuple t1 = TupleFactory.getInstance().newTuple(2);
        t1.set(0, "2011-01-01");
        t1.set(1, "MMMM, yyyy");
        CustomFormatToISO convert = new CustomFormatToISO();
        assertNull("Input that doesn't match format should result in null", convert.exec(t1));
        t1.set(0, "July, 2012");
        assertEquals("Matching format should work correctly", "2012-07-01T00:00:00.000Z", convert.exec(t1));
    }

    @Test
View Full Code Here


        t1.set(0, "2011-01-01");
        t1.set(1, "MMMM, yyyy");
        CustomFormatToISO convert = new CustomFormatToISO();
        assertNull("Input that doesn't match format should result in null", convert.exec(t1));
        t1.set(0, "July, 2012");
        assertEquals("Matching format should work correctly", "2012-07-01T00:00:00.000Z", convert.exec(t1));
    }

    @Test
    public void testUnixToISO() throws Exception {
View Full Code Here

        Tuple t = TupleFactory.getInstance().newTuple(2);
        t.set(0, "10/10/2010");
        t.set(1, "dd/MM/yyyy");
        CustomFormatToISO func = new CustomFormatToISO();
        String iso = func.exec(t);

        assertTrue(iso.equals("2010-10-10T00:00:00.000Z"));
    }
}
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.