Package org.apache.directory.api.util

Examples of org.apache.directory.api.util.GeneralizedTime


     */
    @Test
    public void testCompareTo() throws ParseException
    {
        String gt1 = "20080102121313,999Z";
        GeneralizedTime generalizedTime1 = new GeneralizedTime( gt1 );

        String gt2 = "20080102121314Z";
        GeneralizedTime generalizedTime2 = new GeneralizedTime( gt2 );

        String gt3 = "20080102121314,001Z";
        GeneralizedTime generalizedTime3 = new GeneralizedTime( gt3 );

        assertTrue( generalizedTime1.compareTo( generalizedTime2 ) < 0 );
        assertTrue( generalizedTime1.compareTo( generalizedTime3 ) < 0 );
        assertTrue( generalizedTime2.compareTo( generalizedTime3 ) < 0 );

        assertTrue( generalizedTime2.compareTo( generalizedTime1 ) > 0 );
        assertTrue( generalizedTime3.compareTo( generalizedTime1 ) > 0 );
        assertTrue( generalizedTime3.compareTo( generalizedTime2 ) > 0 );

        assertTrue( generalizedTime1.compareTo( generalizedTime1 ) == 0 );
        assertTrue( generalizedTime2.compareTo( generalizedTime2 ) == 0 );
        assertTrue( generalizedTime3.compareTo( generalizedTime3 ) == 0 );
    }
View Full Code Here


     */
    @Test
    public void testEquals() throws ParseException
    {
        String gt1 = "20080102121314Z";
        GeneralizedTime generalizedTime1 = new GeneralizedTime( gt1 );

        String gt2 = "20080102121314Z";
        GeneralizedTime generalizedTime2 = new GeneralizedTime( gt2 );

        String gt3 = "20080102121314,001Z";
        GeneralizedTime generalizedTime3 = new GeneralizedTime( gt3 );

        assertTrue( generalizedTime1.equals( generalizedTime2 ) );
        assertFalse( generalizedTime1.equals( generalizedTime3 ) );
        assertFalse( generalizedTime1.equals( null ) );
    }
View Full Code Here

     * when TimeZone has hours < 10 and minutes > 10).
     */
    public void testDIRSHARED29() throws ParseException
    {
        String gt = "20090312123456+0130";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
    }
View Full Code Here

        LOG.info( "milliseconds lost = {}", millisLost );

        // Set time on new Calendar instance, and generate the GT string
        Calendar calendar = Calendar.getInstance();
        calendar.setTime( date );
        GeneralizedTime gt = new GeneralizedTime( calendar );
        assertEquals( "calendar time must equal the date time", date.getTime(), calendar.getTime().getTime() );
        String gtStr = gt.toGeneralizedTime();
        LOG.info( "generalized time string of original time = {}", gtStr );

        // Parse and regenerate calendar from gtStr
        GeneralizedTime recalculatedGt = new GeneralizedTime( gtStr );
        long recalculatedTime = recalculatedGt.getCalendar().getTime().getTime();
        LOG.info( "recalculated time = {}", recalculatedTime );
        LOG.info( "generalized time string of recalculated time = {}", recalculatedGt.toGeneralizedTime() );

        assertEquals( "The time after round trip GeneralizedTime generation should stay the same",
            originalTime, recalculatedTime );
    }
View Full Code Here

     */
    @Test
    public void testYearMonthDayHourMinSecZulu() throws ParseException
    {
        String gt = "20080102121314Z";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
    }
View Full Code Here

     */
    @Test
    public void testYearMonthDayHourMinSecPlusHour() throws ParseException
    {
        String gt = "20080102121314+04";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
    }
View Full Code Here

     */
    @Test
    public void testYearMonthDayHourMinSecMinusHourMin() throws ParseException
    {
        String gt = "20080102121314-1030";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
    }
View Full Code Here

     */
    @Test
    public void testYearMonthDayHourMinSecDotFractionZulu() throws ParseException
    {
        String gt = "20080102121314.987Z";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
    }
View Full Code Here

     */
    @Test
    public void testYearMonthDayHourMinSecDotFractionPlusHour() throws ParseException
    {
        String gt = "20080102121314.987+0100";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
    }
View Full Code Here

     */
    @Test
    public void testYearMonthDayHourMinSecDotFractionMinusHourMin() throws ParseException
    {
        String gt = "20080102121314.987-1030";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.util.GeneralizedTime

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.