Package org.apache.directory.shared.ldap.codec.controls.search.pagedSearch

Examples of org.apache.directory.shared.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator


        Control control = controls.get( "1.2.840.113556.1.4.319" );
        assertEquals( "1.2.840.113556.1.4.319", control.getOid() );
        assertTrue( control instanceof PagedResultsDecorator );

        PagedResultsDecorator pagedSearchControl = ( PagedResultsDecorator ) control;

        assertEquals( 5, pagedSearchControl.getSize() );
        assertTrue( Arrays.equals( "abcdef".getBytes(), pagedSearchControl.getCookie() ) );

        // Check the encoding
        try
        {
            ByteBuffer bb = encoder.encodeMessage( bindResponse );
View Full Code Here


        Control control = controls.get( "1.2.840.113556.1.4.319" );
        assertEquals( "1.2.840.113556.1.4.319", control.getOid() );
        assertTrue( control instanceof PagedResultsDecorator );

        PagedResultsDecorator pagedSearchControl = ( PagedResultsDecorator ) control;

        assertEquals( 5, pagedSearchControl.getSize() );
        assertTrue( Arrays.equals( "abcdef".getBytes(), pagedSearchControl.getCookie() ) );

        // Check the encoding
        try
        {
            ByteBuffer bb = encoder.encodeMessage( bindResponse );
View Full Code Here

                  0x02, 0x01, 0x20,                // size INTEGER,
                  0x04, 0x04, 't', 'e', 's', 't'   // cookie OCTET STRING,
            } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );
       
        PagedResults pagedSearch = (PagedResults)decorator.decode( bb.array() );

        assertEquals( 32, pagedSearch.getSize() );
        assertTrue( Arrays.equals( Strings.getBytesUtf8("test"),
            pagedSearch.getCookie() ) );
           
        bb.flip();

        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

            0x30, 0x03,         // realSearchControlValue ::= SEQUENCE {
              0x02, 0x01, 0x20  // size INTEGER,
            } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );
       
        decorator.decode( bb.array() );
    }
View Full Code Here

            0x30, 0x06,                       // realSearchControlValue ::= SEQUENCE {
              0x04, 0x04, 't', 'e', 's', 't'  // cookie OCTET STRING,
            } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );
       
        decorator.decode( bb.array() );
    }
View Full Code Here

            {
            0x30, 0x00,         // realSearchControlValue ::= SEQUENCE
            } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );
       
        decorator.decode( bb.array() );
    }
View Full Code Here

                0x02, 0x01, (byte)0xFF,          // size INTEGER,
                0x04, 0x04, 't', 'e', 's', 't'   // cookie OCTET STRING,
            } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );
       
        PagedResults pagedSearch = (PagedResults)decorator.decode( bb.array() );

        assertEquals( Integer.MAX_VALUE, pagedSearch.getSize() );
        assertTrue( Arrays.equals( Strings.getBytesUtf8("test"),
            pagedSearch.getCookie() ) );
           
        bb.flip();


        PagedResultsDecorator ctrl = new PagedResultsDecorator( codec );
        ctrl.setSize( -1 );
        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

                0x02, 0x00,                      // size INTEGER,
                0x04, 0x04, 't', 'e', 's', 't'   // cookie OCTET STRING,
            } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );
       
        decorator.decode( bb.array() );
    }
View Full Code Here

                0x02, 0x01, 0x20,   // size INTEGER,
                0x04, 0x00          // cookie OCTET STRING,
            } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );
       
        PagedResults pagedSearch = (PagedResults)decorator.decode( bb.array() );

        assertEquals( 32, pagedSearch.getSize() );
        assertNull( pagedSearch.getCookie() );
           
        PagedResultsDecorator ctrl = new PagedResultsDecorator( codec );
        ctrl.setSize( 32 );
        ctrl.setCookie( null );

        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

                {
                    cursor.close();
                }
            }

            pagedResultsControl = new PagedResultsDecorator( ldapServer.getDirectoryService()
                .getLdapCodecService() );
            pagedResultsControl.setCritical( true );
            pagedResultsControl.setSize( 0 );
            req.getResultResponse().addControl( pagedResultsControl );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator

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.