Package org.apache.directory.shared.kerberos.flags

Examples of org.apache.directory.shared.kerberos.flags.TicketFlags


{

    @Test
    public void testEmptyConstructor() throws Exception
    {
        TicketFlags tf = new TicketFlags();
        for ( TicketFlag t : TicketFlag.values() )
        {
            if ( !t.equals( TicketFlags.MAX_SIZE ) )
            {
                assertFalse( tf.isFlagSet( t ) );
            }
        }
        assertFalse( tf.isForwardable() );
        assertFalse( tf.isForwarded() );
        assertFalse( tf.isHwAuthent() );
        assertFalse( tf.isInitial() );
        assertFalse( tf.isInvalid() );
        assertFalse( tf.isMayPosdate() );
        assertFalse( tf.isOkAsDelegate() );
        assertFalse( tf.isPostdated() );
        assertFalse( tf.isPreAuth() );
        assertFalse( tf.isProxiable() );
        assertFalse( tf.isProxy() );
        assertFalse( tf.isRenewable() );
        assertFalse( tf.isReserved() );
        assertFalse( tf.isTransitedPolicyChecked() );
    }
View Full Code Here


    @Test
    public void testGivenIntConstructor() throws Exception
    {
        // Flags 1, 2, 4, 8 set
        TicketFlags tf = new TicketFlags( ( int ) ( Math.pow( 2, 31 - 1 ) + Math.pow( 2, 31 - 2 ) + Math.pow( 2, 31 - 4 ) + Math.pow(
            2, 31 - 8 ) ) );
        assertFalse( tf.isReserved() ); // 0
        assertTrue( tf.isForwardable() ); // 1
        assertTrue( tf.isForwarded() ); // 2
        assertFalse( tf.isProxiable() ); // 3
        assertTrue( tf.isProxy() ); // 4
        assertFalse( tf.isMayPosdate() ); // 5
        assertFalse( tf.isPostdated() ); // 6
        assertFalse( tf.isInvalid() ); // 7
        assertTrue( tf.isRenewable() ); // 8
        assertFalse( tf.isInitial() ); // 9
        assertFalse( tf.isPreAuth() ); // 10
        assertFalse( tf.isHwAuthent() ); // 11
        assertFalse( tf.isTransitedPolicyChecked() ); // 12
        assertFalse( tf.isOkAsDelegate() ); // 13
    }
View Full Code Here

    @Test
    public void testGivenByteArrayConstructor() throws Exception
    {
        // Flags 1, 2, 4, 8 set
        TicketFlags tf = new TicketFlags(
            getBytes( ( int ) ( ( 1 << ( 31 - 1 ) ) |
                                ( 1 << ( 31 - 2 ) ) |
                                ( 1 << ( 31 - 4 ) ) |
                                ( 1 << 31 - 8 ) ) ) );
        assertFalse( tf.isReserved() ); // 0
        assertTrue( tf.isForwardable() ); // 1
        assertTrue( tf.isForwarded() ); // 2
        assertFalse( tf.isProxiable() ); // 3
        assertTrue( tf.isProxy() ); // 4
        assertFalse( tf.isMayPosdate() ); // 5
        assertFalse( tf.isPostdated() ); // 6
        assertFalse( tf.isInvalid() ); // 7
        assertTrue( tf.isRenewable() ); // 8
        assertFalse( tf.isInitial() ); // 9
        assertFalse( tf.isPreAuth() ); // 10
        assertFalse( tf.isHwAuthent() ); // 11
        assertFalse( tf.isTransitedPolicyChecked() ); // 12
        assertFalse( tf.isOkAsDelegate() ); // 13

    }
View Full Code Here


    @Test
    public void testSetFlag() throws Exception
    {
        TicketFlags tf = new TicketFlags();
       
        for ( TicketFlag t : TicketFlag.values() )
        {
            if ( !t.equals( TicketFlag.MAX_VALUE ) )
            {
                tf.setFlag( t );
            }
        }
       
        assertTrue( tf.isReserved() ); // 0
        assertTrue( tf.isForwardable() ); // 1
        assertTrue( tf.isForwarded() ); // 2
        assertTrue( tf.isProxiable() ); // 3
        assertTrue( tf.isProxy() ); // 4
        assertTrue( tf.isMayPosdate() ); // 5
        assertTrue( tf.isPostdated() ); // 6
        assertTrue( tf.isInvalid() ); // 7
        assertTrue( tf.isRenewable() ); // 8
        assertTrue( tf.isInitial() ); // 9
        assertTrue( tf.isPreAuth() ); // 10
        assertTrue( tf.isHwAuthent() ); // 11
        assertTrue( tf.isTransitedPolicyChecked() ); // 12
        assertTrue( tf.isOkAsDelegate() ); // 13
    }
View Full Code Here

     * Tests converting the ticket flags to a descriptive String.
     */
    @Test
    public void testToString() throws Exception
    {
        TicketFlags tf = new TicketFlags();
        assertEquals( "toString()", "", tf.toString() );

        int i = 0;
        for ( TicketFlag t : TicketFlag.values() )
        {
            if ( t != TicketFlag.MAX_VALUE )
            {
                i |= 1 << ( 31 - t.getValue() );
            }
        }

        tf = new TicketFlags( i );
        assertEquals( "toString()", "RESERVED(0) FORWARDABLE(1) FORWARDED(2) PROXIABLE(3) PROXY(4) "
            + "MAY_POSTDATE(5) POSTDATED(6) INVALID(7) RENEWABLE(8) INITIAL(9) PRE_AUTHENT(10) "
            + "HW_AUTHENT(11) TRANSITED_POLICY_CHECKED(12) OK_AS_DELEGATE(13)", tf.toString() );
    }
View Full Code Here

     * Tests that setting flags is idempotent.
     */
    @Test
    public void testDuplicateSetting()
    {
        TicketFlags flags = new TicketFlags();
        flags.setFlag( TicketFlag.MAY_POSTDATE );
        flags.setFlag( TicketFlag.FORWARDABLE );
        flags.setFlag( TicketFlag.PROXIABLE );
        flags.setFlag( TicketFlag.MAY_POSTDATE );
        flags.setFlag( TicketFlag.RENEWABLE );
        assertEquals( flags.toString(), "FORWARDABLE(1) PROXIABLE(3) MAY_POSTDATE(5) RENEWABLE(8)" );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.kerberos.flags.TicketFlags

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.