Package org.apache.directory.studio.dsmlv2

Examples of org.apache.directory.studio.dsmlv2.Tag


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

            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_dn_attribute.xml" ).getFile() );

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

        SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getCurrentSearchResultEntry();

        assertEquals( "dc=example,dc=com", searchResultEntry.getObjectName().toString() );
    }
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( SearchResultEntryTest.class.getResource( "response_with_requestID_attribute.xml" )
                .getFile() );

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

        SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getCurrentSearchResultEntry();

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

                fout.close();
            }
           
            // Processing Reponse (Reading and displaying possible errors)
            int errorCount = 0;
            Dsmlv2ResponseParser responseParser = new Dsmlv2ResponseParser();
            responseParser.setInput( response );
            LdapResponse ldapResponse = responseParser.getNextResponse();
            while ( ldapResponse != null )
            {
                if ( ( ldapResponse instanceof ErrorResponse )
                     || ( ldapResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS ) )
                {
                    errorCount++;
                }
                ldapResponse = responseParser.getNextResponse();
            }
           
            if ( errorCount > 0 )
            {
                monitor.reportError( BrowserCoreMessages.bind(
View Full Code Here

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

            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_0_attr.xml" ).getFile() );

            parser.parse();
        }
        catch ( Exception e )
        {
            fail( e.getMessage() );
        }
View Full Code Here

    /**
     * Test parsing of a response with 1 Attr 0 Value
     */
    public void testResponseWith1Attr0Value()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_1_attr_0_value.xml" )
                .getFile() );

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

        SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getCurrentSearchResultEntry();

        Attributes attributes = searchResultEntry.getPartialAttributeList();

        assertEquals( 1, attributes.size() );
View Full Code Here

    /**
     * Test parsing of a response with 1 Attr 1 Value
     */
    public void testResponseWith1Attr1Value()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_1_attr_1_value.xml" )
                .getFile() );

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

        SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getCurrentSearchResultEntry();

        Attributes attributes = searchResultEntry.getPartialAttributeList();

        assertEquals( 1, attributes.size() );
View Full Code Here

     * Test parsing of a response with 1 Attr 1 Base64 Value
     * @throws UnsupportedEncodingException
     */
    public void testResponseWith1Attr1Base64Value() throws UnsupportedEncodingException
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_1_attr_1_base64_value.xml" )
                .getFile() );

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

        SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getCurrentSearchResultEntry();

        Attributes attributes = searchResultEntry.getPartialAttributeList();

        assertEquals( 1, attributes.size() );
View Full Code Here

    /**
     * Test parsing of a response with 1 Attr 1 empty Value
     */
    public void testResponseWith1Attr1EmptyValue()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_1_attr_1_empty_value.xml" )
                .getFile() );

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

        SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getCurrentSearchResultEntry();

        Attributes attributes = searchResultEntry.getPartialAttributeList();

        assertEquals( 1, attributes.size() );
View Full Code Here

    /**
     * Test parsing of a response with 1 Attr 2 Value
     */
    public void testResponseWith1Attr2Value()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_1_attr_2_value.xml" )
                .getFile() );

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

        SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getCurrentSearchResultEntry();

        Attributes attributes = searchResultEntry.getPartialAttributeList();

        assertEquals( 1, attributes.size() );
View Full Code Here

    /**
     * Test parsing of a response with 2 Attr 1 Value
     */
    public void testResponseWith2Attr1Value()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser();

            parser.setInputFile( SearchResultEntryTest.class.getResource( "response_with_2_attr_1_value.xml" )
                .getFile() );

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

        SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getCurrentSearchResultEntry();

        Attributes attributes = searchResultEntry.getPartialAttributeList();

        assertEquals( 2, attributes.size() );
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.dsmlv2.Tag

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.