Package org.apache.torque.test

Examples of org.apache.torque.test.DateTest


                (Long) null,
                Criteria.NOT_EQUAL);
        DateTestPeer.doDelete(criteria);

        // insert new DateTest object to db
        DateTest dateTest = new DateTest();
        Date now = new Date();
        dateTest.setDateValue(now);
        dateTest.setTimeValue(now);
        dateTest.setTimestampValue(now);
        dateTest.save();
        DateFormat dateFormat = new SimpleDateFormat();
        System.out.println(
                "testDateTime() : set date to : "
                + dateFormat.format(now));

        // reload dateTest from db
        DateTest loadedDateTest
                = DateTestPeer.retrieveByPK(dateTest.getPrimaryKey());

        System.out.println(
                "testDateTime() : retrieved date : "
                + dateFormat.format(loadedDateTest.getDateValue()));
        System.out.println(
                "testDateTime() : retrieved time : "
                + dateFormat.format(loadedDateTest.getTimeValue()));
        System.out.println(
                "testDateTime() : retrieved timestamp : "
                + dateFormat.format(loadedDateTest.getTimestampValue()));

        // compute time differences between reloaded and original object
        long dateDifference
                = dateTest.getDateValue().getTime()
                    - loadedDateTest.getDateValue().getTime();
        long timeDifference
                = dateTest.getTimeValue().getTime()
                    - loadedDateTest.getTimeValue().getTime();
        long timestampDifference
                = dateTest.getTimestampValue().getTime()
                    - loadedDateTest.getTimestampValue().getTime();

        System.out.println(
                "testDateTime() : Date difference (ms): "
                + dateDifference);
        System.out.println(
View Full Code Here


                (Long) null,
                Criteria.NOT_EQUAL);
        DateTestPeer.doDelete(criteria);
       
        // insert new DateTest object to db
        DateTest dateTest = new DateTest();
        Date now = new Date();
        dateTest.setDateValue(now);
        dateTest.setTimeValue(now);
        dateTest.setTimestampValue(now);
        dateTest.save();
        DateFormat dateFormat = new SimpleDateFormat();
        System.out.println(
                "testDateTime() : set date to : "
                + dateFormat.format(now));
       
        // reload dateTest from db
        DateTest loadedDateTest
                = DateTestPeer.retrieveByPK(dateTest.getPrimaryKey());
       
        System.out.println(
                "testDateTime() : retrieved date : "
                + dateFormat.format(loadedDateTest.getDateValue()));
        System.out.println(
                "testDateTime() : retrieved time : "
                + dateFormat.format(loadedDateTest.getTimeValue()));
        System.out.println(
                "testDateTime() : retrieved timestamp : "
                + dateFormat.format(loadedDateTest.getTimestampValue()));

        // compute time differences between reloaded and original object
        long dateDifference
                = dateTest.getDateValue().getTime()
                    - loadedDateTest.getDateValue().getTime();
        long timeDifference
                = dateTest.getTimeValue().getTime()
                    - loadedDateTest.getTimeValue().getTime();
        long timestampDifference
                = dateTest.getTimestampValue().getTime()
                    - loadedDateTest.getTimestampValue().getTime();
       
        System.out.println(
                "testDateTime() : Date difference (ms): "
                + dateDifference);
        System.out.println(
View Full Code Here

TOP

Related Classes of org.apache.torque.test.DateTest

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.