Package org.apache.directory.api.ldap.model.message

Examples of org.apache.directory.api.ldap.model.message.SearchResultDoneImpl


    {
        boolean next = wrapped.next();

        if ( !next )
        {
            searchDoneResp = new SearchResultDoneImpl( messageId );
            searchDoneResp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
            done = true;
        }

        return next;
View Full Code Here


    {
        boolean next = wrapped.next();

        if ( !next )
        {
            searchDoneResp = new SearchResultDoneImpl( messageId );
            searchDoneResp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
            done = true;
        }

        return next;
View Full Code Here

     * @return a populated SearchResponseDoneImpl stub
     */
    private SearchResultDoneImpl createStub()
    {
        // Construct the Search response to test with results and referrals
        SearchResultDoneImpl response = new SearchResultDoneImpl( 45 );
        LdapResult result = response.getLdapResult();

        try
        {
            result.setMatchedDn( new Dn( "dc=example,dc=com" ) );
        }
View Full Code Here

     * Tests for equality using the same object.
     */
    @Test
    public void testEqualsSameObj()
    {
        SearchResultDoneImpl resp = createStub();
        assertTrue( resp.equals( resp ) );
    }
View Full Code Here

     * Tests for equality using an exact copy.
     */
    @Test
    public void testEqualsExactCopy()
    {
        SearchResultDoneImpl resp0 = createStub();
        SearchResultDoneImpl resp1 = createStub();
        assertTrue( resp0.equals( resp1 ) );
        assertTrue( resp1.equals( resp0 ) );
    }
View Full Code Here

     * Tests for equality using different stub implementations.
     */
    @Test
    public void testEqualsDiffImpl()
    {
        SearchResultDoneImpl resp0 = createStub();
        SearchResultDone resp1 = new SearchResultDone()
        {
            public LdapResult getLdapResult()
            {
                LdapResultImpl result = new LdapResultImpl();

                try
                {
                    result.setMatchedDn( new Dn( "dc=example,dc=com" ) );
                }
                catch ( Exception e )
                {
                    // Do nothing
                }
                result.setResultCode( ResultCodeEnum.SUCCESS );
                ReferralImpl refs = new ReferralImpl();
                refs.addLdapUrl( "ldap://someserver.com" );
                refs.addLdapUrl( "ldap://apache.org" );
                refs.addLdapUrl( "ldap://another.net" );
                result.setReferral( refs );

                return result;
            }


            public MessageTypeEnum getType()
            {
                return MessageTypeEnum.SEARCH_RESULT_DONE;
            }


            public Map<String, Control> getControls()
            {
                return EMPTY_CONTROL_MAP;
            }


            public SearchResultDone addControl( Control a_control ) throws MessageException
            {
                return this;
            }


            public SearchResultDone removeControl( Control a_control ) throws MessageException
            {
                return this;
            }


            public int getMessageId()
            {
                return 45;
            }


            public Object get( Object a_key )
            {
                return null;
            }


            public Object put( Object a_key, Object a_value )
            {
                return null;
            }


            public SearchResultDone addAllControls( Control[] controls ) throws MessageException
            {
                return this;
            }


            public boolean hasControl( String oid )
            {
                return false;
            }


            public Control getControl( String oid )
            {
                return null;
            }


            public SearchResultDone setMessageId( int messageId )
            {
                return this;
            }
        };

        assertTrue( resp0.equals( resp1 ) );
        assertFalse( resp1.equals( resp0 ) );
    }
View Full Code Here

     * Tests for equal hashCode using the same object.
     */
    @Test
    public void testHashCodeSameObj()
    {
        SearchResultDoneImpl resp = createStub();
        assertTrue( resp.hashCode() == resp.hashCode() );
    }
View Full Code Here

     * Tests for equal hashCode using an exact copy.
     */
    @Test
    public void testHashCodeExactCopy()
    {
        SearchResultDoneImpl resp0 = createStub();
        SearchResultDoneImpl resp1 = createStub();
        assertTrue( resp0.hashCode() == resp1.hashCode() );
    }
View Full Code Here

     * Tests inequality when messageIds are different.
     */
    @Test
    public void testNotEqualsDiffIds()
    {
        SearchResultDoneImpl resp0 = new SearchResultDoneImpl( 3 );
        SearchResultDoneImpl resp1 = new SearchResultDoneImpl( 4 );

        assertFalse( resp0.equals( resp1 ) );
        assertFalse( resp1.equals( resp0 ) );
    }
View Full Code Here

                monitor.reportError( e );
            }
        }

        // Creating and adding a search result done at the end of the results
        SearchResultDone srd = new SearchResultDoneImpl();
        LdapResult ldapResult = srd.getLdapResult();
        if ( !monitor.errorsReported() )
        {
            ldapResult.setResultCode( ResultCodeEnum.SUCCESS );
        }
        else
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.message.SearchResultDoneImpl

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.