Package org.apache.directory.ldapstudio.dsmlv2

Examples of org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser


    /**
     * Test parsing of a response with Result Code
     */
    public void testResponseWithResultCode()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( ModifyDNResponseTest.class.getResource( "response_with_result_code.xml" ).getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        ModifyDNResponse modifyDNResponse = ( ModifyDNResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = modifyDNResponse.getLdapResult();

        assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
    }
View Full Code Here


    /**
     * Test parsing of a response with 2 (optional) Control elements
     */
    public void testResponseWith2Controls()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( CompareResponseTest.class.getResource( "response_with_2_controls.xml" ).getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        CompareResponse compareResponse = ( CompareResponse ) parser.getBatchResponse().getCurrentResponse();

        assertEquals( 2, compareResponse.getControls().size() );

        Control control = compareResponse.getCurrentControl();

View Full Code Here

    /**
     * Test parsing of a response with Error Message
     */
    public void testResponseWithErrorMessage()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( ModifyDNResponseTest.class.getResource( "response_with_error_message.xml" ).getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        ModifyDNResponse modifyDNResponse = ( ModifyDNResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = modifyDNResponse.getLdapResult();

        assertEquals( "Unrecognized extended operation EXTENSION_OID: 1.2.6.1.4.1.18060.1.1.1.100.2", ldapResult
            .getErrorMessage() );
View Full Code Here

    /**
     * Test parsing of a response with Error Message
     */
    public void testResponseWithErrorMessage()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_error_message.xml" ).getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = bindResponse.getLdapResult();

        assertEquals( "Unrecognized extended operation EXTENSION_OID: 1.2.6.1.4.1.18060.1.1.1.100.2", ldapResult
            .getErrorMessage() );
View Full Code Here

    /**
     * Test parsing of a response with Empty Error Message
     */
    public void testResponseWithEmptyErrorMessage()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_empty_error_message.xml" ).getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = bindResponse.getLdapResult();

        assertNull( ldapResult.getErrorMessage() );
    }
View Full Code Here

    /**
     * Test parsing of a Response with the (optional) requestID attribute
     */
    public void testResponseWithRequestId()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( SearchResponseTest.class.getResource( "response_with_requestID_attribute.xml" )
                .getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();

        assertEquals( 456, searchResponse.getMessageId() );
    }
View Full Code Here

    /**
     * Test parsing of a Response with a Search Result Done
     */
    public void testResponseWithSRD()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( SearchResponseTest.class.getResource( "response_with_1_SRD.xml" ).getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();

        assertNotNull( searchResponse.getSearchResultDone() );
    }
View Full Code Here

    /**
     * Test parsing of a response with a Referral
     */
    public void testResponseWith1Referral()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( AuthResponseTest.class.getResource( "response_with_1_referral.xml" ).getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = bindResponse.getLdapResult();

        List referrals = ldapResult.getReferrals();

View Full Code Here

    /**
     * Test parsing of a Response with 1 Search Result Entry and a Search Result Done
     */
    public void testResponseWith1SRE1SRD()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( SearchResponseTest.class.getResource( "response_with_1_SRE_1_SRD.xml" ).getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse();

        assertEquals( 1, searchResponse.getSearchResultEntryList().size() );

        assertNotNull( searchResponse.getSearchResultDone() );
    }
View Full Code Here

    /**
     * Test parsing of a Response with the (optional) requestID attribute
     */
    public void testResponseWithRequestId()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( BatchResponseTest.class.getResource( "response_with_requestID_attribute.xml" )
                .getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }

        BatchResponse batchResponse = parser.getBatchResponse();

        assertEquals( 1234567890, batchResponse.getRequestID() );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser

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.