Examples of computeLength()


Examples of org.apache.directory.api.asn1.AbstractAsn1Object.computeLength()

        AbstractAsn1Object asn1Obj = ( AbstractAsn1Object ) message;
        boolean isTcp = !session.getTransportMetadata().isConnectionless();
        IoBuffer response = null;
        IoBuffer kerberosMessage = null;

        int responseLength = asn1Obj.computeLength();
        kerberosMessage = IoBuffer.allocate( responseLength );

        if ( isTcp )
        {
            response = IoBuffer.allocate( responseLength + 4 );
View Full Code Here

Examples of org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeDecorator.computeLength()

        EntryChange entryChange = ( EntryChange ) decorator.getDecorated();
        entryChange.setChangeType( ChangeType.MODDN );
        entryChange.setChangeNumber( 16 );
        entryChange.setPreviousDn( new Dn( "a=b" ) );
        bb = decorator.encode( ByteBuffer.allocate( decorator.computeLength() ) );
        String decoded = Strings.dumpBytes( bb.array() );
        assertEquals( expected, decoded );
    }

View Full Code Here

Examples of org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator.computeLength()

        PagedResultsDecorator ctrl = new PagedResultsDecorator( codec );
        ctrl.setSize( 32 );
        ctrl.setCookie( Strings.getBytesUtf8( "test" ) );

        ByteBuffer buffer = ctrl.encode( ByteBuffer.allocate( ctrl.computeLength() ) );
        String decoded = Strings.dumpBytes( buffer.array() );
        String expected = Strings.dumpBytes( bb.array() );
        assertEquals( expected, decoded );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchDecorator.computeLength()

        PersistentSearchDecorator decorator = new PersistentSearchDecorator( codec );
        PersistentSearch ctrl = ( PersistentSearch ) decorator.getDecorated();
        ctrl.setChangesOnly( false );
        ctrl.setReturnECs( false );
        ctrl.setChangeTypes( 1 );
        bb = decorator.encode( ByteBuffer.allocate( decorator.computeLength() ) );
        String decoded = Strings.dumpBytes( bb.array() );
        assertEquals( expected, decoded );
    }

View Full Code Here

Examples of org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesDecorator.computeLength()

        assertTrue( subentries.isVisible() );

        // test encoding
        try
        {
            ByteBuffer buffer = decorator.encode( ByteBuffer.allocate( decorator.computeLength() ) );
            String expected = Strings.dumpBytes( bb.array() );
            String decoded = Strings.dumpBytes( buffer.array() );
            assertEquals( expected, decoded );
        }
        catch ( EncoderException e )
View Full Code Here

Examples of org.apache.directory.api.ldap.codec.controls.sort.SortRequestDecorator.computeLength()

        assertEquals( "cn", sk.getAttributeTypeDesc() );
        assertEquals( "oid", sk.getMatchingRuleId() );
        assertFalse( sk.isReverseOrder() );
       
        ByteBuffer encoded = ByteBuffer.allocate( buffer.capacity() );
        decorator.computeLength();
        decorator.encode( encoded );
        assertTrue( Arrays.equals( buffer.array(), encoded.array() ) );
    }
   
   
View Full Code Here

Examples of org.apache.directory.api.ldap.codec.controls.sort.SortResponseDecorator.computeLength()

       
        assertEquals( SortResultCode.SUCCESS, control.getSortResult() );
        assertEquals( "cn", control.getAttributeName() );
       
        ByteBuffer encoded = ByteBuffer.allocate( buffer.capacity() );
        decorator.computeLength();
        decorator.encode( encoded );
        assertTrue( Arrays.equals( buffer.array(), encoded.array() ) );
    }

   
View Full Code Here

Examples of org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueDecorator.computeLength()

        SyncRequestValue syncRequestValue = new SyncRequestValueImpl();
        syncRequestValue.setMode( SynchronizationModeEnum.REFRESH_ONLY );
       
        SyncRequestValueDecorator decorator = new SyncRequestValueDecorator( codec, syncRequestValue );
       
        ByteBuffer buffer = decorator.encode( ByteBuffer.allocate( decorator.computeLength() ) );
       
        String expected = Strings.dumpBytes( new byte[]{ 0x30, 0x03, 0x0A, 0x01, 0x01 } );
        assertEquals( expected, Strings.dumpBytes( buffer.array() ) );
    }
   
View Full Code Here

Examples of org.apache.directory.api.ldap.extras.extended.ads_impl.gracefulDisconnect.GracefulDisconnect.computeLength()

        assertEquals( "ldap://directory.apache.org:80/", gracefulDisconnect.getReplicatedContexts().get( 0 ).toString() );
        assertEquals( "ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5C00%5C00%5C00%5C04)", gracefulDisconnect
            .getReplicatedContexts().get( 1 ).toString() );

        // Check the length
        assertEquals( 0x70, gracefulDisconnect.computeLength() );

        // Check the encoding
        try
        {
            ByteBuffer bb = gracefulDisconnect.encode();
View Full Code Here

Examples of org.apache.directory.api.ldap.extras.extended.ads_impl.gracefulShutdown.GracefulShutdown.computeLength()

        GracefulShutdown gracefulShutdown = container.getGracefulShutdown();
        assertEquals( 1, gracefulShutdown.getTimeOffline() );
        assertEquals( 1, gracefulShutdown.getDelay() );

        // Check the length
        assertEquals( 0x08, gracefulShutdown.computeLength() );

        // Check the encoding
        try
        {
            ByteBuffer bb1 = gracefulShutdown.encode();
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.