Package org.apache.directory.api.util

Examples of org.apache.directory.api.util.GeneralizedTime.toGeneralizedTime()


    @Test
    public void testFractionOfMinute1() throws ParseException
    {
        String gt = "200801021213,5Z";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
        assertEquals( 30, generalizedTime.getCalendar().get( Calendar.SECOND ) );
        assertEquals( 0, generalizedTime.getCalendar().get( Calendar.MILLISECOND ) );
    }
View Full Code Here


    @Test
    public void testFractionOfMinute2() throws ParseException
    {
        String gt = "200801021213,125Z";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
        assertEquals( 7, generalizedTime.getCalendar().get( Calendar.SECOND ) );
        assertEquals( 500, generalizedTime.getCalendar().get( Calendar.MILLISECOND ) );
    }
View Full Code Here

    @Test
    public void testFractionOfHour1() throws ParseException
    {
        String gt = "2008010212,5Z";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
        assertEquals( 30, generalizedTime.getCalendar().get( Calendar.MINUTE ) );
        assertEquals( 0, generalizedTime.getCalendar().get( Calendar.SECOND ) );
        assertEquals( 0, generalizedTime.getCalendar().get( Calendar.MILLISECOND ) );
    }
View Full Code Here

    @Test
    public void testFractionOfHour2() throws ParseException
    {
        String gt = "2008010212,125Z";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
        assertEquals( 7, generalizedTime.getCalendar().get( Calendar.MINUTE ) );
        assertEquals( 30, generalizedTime.getCalendar().get( Calendar.SECOND ) );
        assertEquals( 0, generalizedTime.getCalendar().get( Calendar.MILLISECOND ) );
    }
View Full Code Here

    @Test
    public void testFormatting() throws ParseException
    {
        String gt = "20080102121314Z";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN, null, 0, TimeZoneFormat.Z );
        assertEquals( "200801021213Z", result );
View Full Code Here

        String gt = "20080102121314Z";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN, null, 0, TimeZoneFormat.Z );
        assertEquals( "200801021213Z", result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR, null, 0, TimeZoneFormat.Z );
        assertEquals( "2008010212Z", result );
View Full Code Here

        assertEquals( gt, result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN, null, 0, TimeZoneFormat.Z );
        assertEquals( "200801021213Z", result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR, null, 0, TimeZoneFormat.Z );
        assertEquals( "2008010212Z", result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN, null, 0,
            TimeZoneFormat.DIFF_HOUR_MINUTE );
        assertEquals( "200801021213+0000", result );
View Full Code Here

        assertEquals( "200801021213Z", result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR, null, 0, TimeZoneFormat.Z );
        assertEquals( "2008010212Z", result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN, null, 0,
            TimeZoneFormat.DIFF_HOUR_MINUTE );
        assertEquals( "200801021213+0000", result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR, null, 0,
            TimeZoneFormat.DIFF_HOUR_MINUTE );
View Full Code Here

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN, null, 0,
            TimeZoneFormat.DIFF_HOUR_MINUTE );
        assertEquals( "200801021213+0000", result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR, null, 0,
            TimeZoneFormat.DIFF_HOUR_MINUTE );
        assertEquals( "2008010212+0000", result );
    }

View Full Code Here

    @Test
    public void testAdjustWhileFormatting() throws ParseException
    {
        String gt = "20080102121314+0130";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );

        result = generalizedTime.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN_SEC, null, 0, TimeZoneFormat.Z );
        assertEquals( "20080102104314Z", result );
    }
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.