Package org.apache.directory.ldapstudio.dsmlv2.engine

Examples of org.apache.directory.ldapstudio.dsmlv2.engine.Dsmlv2Engine


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

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

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

        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getSearchResultDone();

        LdapResult ldapResult = searchResultDone.getLdapResult();

        List referrals = ldapResult.getReferrals();
View Full Code Here


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

            parser.setInputFile( SearchResultDoneTest.class.getResource( "response_with_1_empty_referral.xml" ).getFile() );

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

        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getSearchResultDone();

        LdapResult ldapResult = searchResultDone.getLdapResult();

        List referrals = ldapResult.getReferrals();
View Full Code Here

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

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

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

        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getSearchResultDone();

        LdapResult ldapResult = searchResultDone.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( SearchResultDoneTest.class.getResource(
                "response_with_1_referral_and_error_message.xml" ).getFile() );

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

        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getSearchResultDone();

        LdapResult ldapResult = searchResultDone.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( SearchResultDoneTest.class.getResource( "response_with_matchedDN_attribute.xml" )
                .getFile() );

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

        SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse() )
            .getSearchResultDone();

        LdapResult ldapResult = searchResultDone.getLdapResult();

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

        monitor.beginTask( BrowserCoreMessages.jobs__import_dsml_task, 2 );
        monitor.reportProgress( " " ); //$NON-NLS-1$
        monitor.worked( 1 );
       
        Dsmlv2Engine engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(), connection.getBindPrincipal(), connection.getBindPassword() );
        try
        {
            // Executing the DSML request and getting the response
            String response = engine.processDSMLFile( dsmlFile.getAbsolutePath() );
           
            // Saving Response if needed
            if ( responseFile != null )
            {
                FileOutputStream fout = new FileOutputStream( responseFile );
View Full Code Here

            // Executing the request
            Document xmlRequest = DocumentHelper.createDocument();
            Element rootElement = xmlRequest.addElement( "batchRequest" );
            SearchRequestDsml searchRequestDsml = new SearchRequestDsml( searchRequest );
            searchRequestDsml.toDsml( rootElement );
            Dsmlv2Engine engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(), connection
                .getBindPrincipal(), connection.getBindPassword() );
            String response = engine.processDSML( xmlRequest.asXML() );

            // Saving the response
            FileOutputStream fout = new FileOutputStream( exportDsmlFilename );
            new PrintStream( fout ).println( response );
            fout.close();
View Full Code Here

        if ( LdapConstants.ADD_RESPONSE == response.getMessageType() )
        {
            AddResponse addResponse = response.getAddResponse();
            copyMessageIdAndControls( response, addResponse );

            AddResponseDsml addResponseDsml = new AddResponseDsml( addResponse );
            batchResponse.addResponse( addResponseDsml );
        }
        else if ( LdapConstants.BIND_RESPONSE == response.getMessageType() )
        {
            BindResponse bindResponse = response.getBindResponse();
View Full Code Here

        else if ( LdapConstants.BIND_RESPONSE == response.getMessageType() )
        {
            BindResponse bindResponse = response.getBindResponse();
            copyMessageIdAndControls( response, bindResponse );

            AuthResponseDsml authResponseDsml = new AuthResponseDsml( bindResponse );
            batchResponse.addResponse( authResponseDsml );
        }
        else if ( LdapConstants.COMPARE_RESPONSE == response.getMessageType() )
        {
            CompareResponse compareResponse = response.getCompareResponse();
View Full Code Here

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

        BatchResponse batchResponse = parser.getBatchResponse();

        assertEquals( 2, batchResponse.getResponses().size() );

        LdapResponse response = batchResponse.getCurrentResponse();

        if ( response instanceof ModifyDNResponse )
        {
            assertTrue( true );
        }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.dsmlv2.engine.Dsmlv2Engine

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.