Package org.apache.directory.ldapstudio.dsmlv2

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


    /**
     * Test parsing of a response with empty Response Name
     */
    public void testResponseWithEmptyResponseName()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( ExtendedResponseTest.class.getResource( "response_with_empty_responseName.xml" ).getFile() );

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

        ExtendedResponse extendedResponse = ( ExtendedResponse ) parser.getBatchResponse().getCurrentResponse();

        assertEquals( "", extendedResponse.getResponseName().toString() );
    }
View Full Code Here


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

            parser.setInputFile( ExtendedResponseTest.class.getResource( "response_with_response.xml" ).getFile() );

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

        ExtendedResponse extendedResponse = ( ExtendedResponse ) parser.getBatchResponse().getCurrentResponse();

        assertEquals( "This is a response", extendedResponse.getResponse() );
    }
View Full Code Here

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

            parser.setInputFile( ExtendedResponseTest.class.getResource( "response_with_base64_response.xml" ).getFile() );

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

        ExtendedResponse extendedResponse = ( ExtendedResponse ) parser.getBatchResponse().getCurrentResponse();

        assertEquals( "DSMLv2.0 rocks!!", new String( (byte[]) extendedResponse.getResponse() ) );
    }
View Full Code Here

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

            parser.setInputFile( ExtendedResponseTest.class.getResource( "response_with_empty_response.xml" ).getFile() );

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

        ExtendedResponse extendedResponse = ( ExtendedResponse ) parser.getBatchResponse().getCurrentResponse();

        assertEquals( "", extendedResponse.getResponse() );
    }
View Full Code Here

    /**
     * Test parsing of a response with Response Name and Response
     */
    public void testResponseWithResponseNameAndResponse()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( ExtendedResponseTest.class.getResource( "response_with_responseName_and_response.xml" )
                .getFile() );

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

        ExtendedResponse extendedResponse = ( ExtendedResponse ) parser.getBatchResponse().getCurrentResponse();

        assertEquals( "This is a response", extendedResponse.getResponse() );

        try
        {
View Full Code Here

     */
    public void testParsingFail( Class testClass, String filename )
    {
        try
        {
            Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();

            parser.setInputFile( testClass.getResource( filename ).getFile() );

            parser.parse();
        }
        catch ( XmlPullParserException e )
        {
            assertTrue( e.getMessage(), true );
            return;
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( ModifyResponseTest.class.getResource( "response_with_requestID_attribute.xml" )
                .getFile() );

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

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

        assertEquals( 456, modifyResponse.getMessageId() );
    }
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( AddResponseTest.class.getResource( "response_with_requestID_attribute.xml" ).getFile() );

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

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

        assertEquals( 456, addResponse.getMessageId() );
    }
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( AddResponseTest.class.getResource( "response_with_1_control.xml" ).getFile() );

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

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

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

        Control control = addResponse.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( ModifyResponseTest.class.getResource( "response_with_1_control.xml" ).getFile() );

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

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

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

        Control control = modifyResponse.getCurrentControl();

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.