Examples of encode()


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

            response = kerberosMessage;
        }

        try
        {
            asn1Obj.encode( kerberosMessage.buf() );

            if ( isTcp )
            {
                response.putInt( responseLength );
                response.put( kerberosMessage.buf().array() );

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

        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 );
    }

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

        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 );
    }

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

        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 );
    }

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

        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 )

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

        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() ) );
    }
   
   
    @Test

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

        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() ) );
    }

   
    @Test

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

        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() ) );
    }
   

Examples of org.apache.directory.api.ldap.extras.extended.ads_impl.cancel.Cancel.encode()

        assertEquals( 1, cancel.getCancelId() );

        // Check the encoding
        try
        {
            ByteBuffer bb = cancel.encode();

            String encodedPdu = Strings.dumpBytes( bb.array() );

            assertEquals( encodedPdu, decodedPdu );
        }

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

        assertEquals( 0x70, gracefulDisconnect.computeLength() );

        // Check the encoding
        try
        {
            ByteBuffer bb = gracefulDisconnect.encode();

            String encodedPdu = Strings.dumpBytes( bb.array() );

            assertEquals( encodedPdu, decodedPdu );
        }
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.