Package org.apache.directory.ldapstudio.dsmlv2

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


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

            parser.setInputFile( AddResponseTest.class.getResource( "response_with_2_referrals.xml" ).getFile() );

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

        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = addResponse.getLdapResult();

        List referrals = ldapResult.getReferrals();

View Full Code Here


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

            parser.setInputFile( ModifyResponseTest.class
                .getResource( "response_with_1_referral_and_error_message.xml" ).getFile() );

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

        ModifyResponse modifyResponse = ( ModifyResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = modifyResponse.getLdapResult();

        List referrals = ldapResult.getReferrals();

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( ModifyDNResponseTest.class.getResource( "response_with_2_controls.xml" ).getFile() );

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

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

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

        Control control = modifyDNResponse.getCurrentControl();

View Full Code Here

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

            parser.setInputFile( AddResponseTest.class.getResource( "response_with_1_referral_and_error_message.xml" )
                .getFile() );

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

        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = addResponse.getLdapResult();

        List referrals = ldapResult.getReferrals();

View Full Code Here

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

            parser.setInputFile( ModifyResponseTest.class.getResource( "response_with_matchedDN_attribute.xml" )
                .getFile() );

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

        ModifyResponse modifyResponse = ( ModifyResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = modifyResponse.getLdapResult();

        assertEquals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM", ldapResult.getMatchedDN() );
    }
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( CompareResponseTest.class.getResource( "response_with_requestID_attribute.xml" )
                .getFile() );

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

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

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

    /**
     * Test parsing of a response with 3 (optional) Control elements without value
     */
    public void testResponseWith3ControlsWithoutValue()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

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

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

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

        assertEquals( 3, modifyDNResponse.getControls().size() );

        Control control = modifyDNResponse.getCurrentControl();

View Full Code Here

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

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

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

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

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

        Control control = compareResponse.getCurrentControl();

View Full Code Here

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

            parser
                .setInputFile( AddResponseTest.class.getResource( "response_with_matchedDN_attribute.xml" ).getFile() );

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

        AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

        LdapResult ldapResult = addResponse.getLdapResult();

        assertEquals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM", ldapResult.getMatchedDN() );
    }
View Full Code Here

    /**
     * Test parsing of a response with a (optional) Control element with empty value
     */
    public void testResponseWith1ControlEmptyValue()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

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

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

        CompareResponse compareResponse = ( CompareResponse ) parser.getBatchResponse().getCurrentResponse();
        Control control = compareResponse.getCurrentControl();
       
        assertEquals( 1, compareResponse.getControls().size() );
        assertTrue( control.getCriticality() );
        assertEquals( "1.2.840.113556.1.4.643", control.getControlType() );
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.