Package org.apache.directory.api.dsmlv2.request

Examples of org.apache.directory.api.dsmlv2.request.SearchRequestDsml


     * @return the XML response in DSMLv2 Format
     * @throws XmlPullParserException if an error occurs in the parser
     */
    public String processDSML( String dsmlInput ) throws XmlPullParserException
    {
        parser = new Dsmlv2Parser( grammar );
        parser.setInput( dsmlInput );

        return processDSML();
    }
View Full Code Here


     * @throws XmlPullParserException if an error occurs in the parser
     * @throws FileNotFoundException if the file does not exist
     */
    public String processDSMLFile( String fileName ) throws XmlPullParserException, FileNotFoundException
    {
        parser = new Dsmlv2Parser( grammar );
        parser.setInputFile( fileName );

        return processDSML();
    }
View Full Code Here

     * @param respStream the output stream to which response will be written, skipped if null
     * @throws Exception If the processing fails
     */
    public void processDSMLFile( File file, OutputStream respStream ) throws Exception
    {
        parser = new Dsmlv2Parser( grammar );
        parser.setInputFile( file.getAbsolutePath() );

        processDSML( respStream );
    }
View Full Code Here

     * @param out the output stream to which DSML response will be written
     * @throws Exception If the processing fails
     */
    public void processDSML( InputStream inputStream, String inputEncoding, OutputStream out ) throws Exception
    {
        parser = new Dsmlv2Parser( grammar );
        parser.setInput( inputStream, inputEncoding );
        processDSML( out );
    }
View Full Code Here

        try
        {
            // Parsing the file
            Dsmlv2Grammar grammar = new Dsmlv2Grammar();
            Dsmlv2Parser parser = new Dsmlv2Parser( grammar );
            parser.setInput( new FileInputStream( dsmlFile ), "UTF-8" ); //$NON-NLS-1$
            parser.parseAllRequests();

            // Getting the batch request
            BatchRequestDsml batchRequest = parser.getBatchRequest();

            // Creating a DSML batch response (only if needed)
            BatchResponseDsml batchResponseDsml = null;
            if ( responseFile != null )
            {
View Full Code Here

     * Test parsing of a request with an Substrings Filter
     */
    @Test
    public void testRequestWithSubstringsFilter()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( SearchRequestTest.class.getResource( "filters/request_with_substrings.xml" ).openStream(),
                "UTF-8" );

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

        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

        ExprNode filter = searchRequest.getFilter();

        assertTrue( filter instanceof SubstringNode );

View Full Code Here

     * Test parsing of a request with a Substrings Filter with 1 Initial element
     */
    @Test
    public void testRequestWithSubstrings1Initial()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( SearchRequestTest.class.getResource( "filters/request_with_substrings_1_initial.xml" )
                .openStream(), "UTF-8" );

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

        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

        ExprNode filter = searchRequest.getFilter();

        assertTrue( filter instanceof SubstringNode );

View Full Code Here

     * Test parsing of a request with a Substrings Filter with 1 Initial element with Base64 value
     */
    @Test
    public void testRequestWithSubstrings1Base64Initial()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( SearchRequestTest.class.getResource(
                "filters/request_with_substrings_1_base64_initial.xml" ).openStream(), "UTF-8" );

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

        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

        ExprNode filter = searchRequest.getFilter();

        assertTrue( filter instanceof SubstringNode );

View Full Code Here

     * Test parsing of a request with a Substrings Filter with 1 emptyInitial element
     */
    @Test
    public void testRequestWithSubstrings1EmptyInitial()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( SearchRequestTest.class
                .getResource( "filters/request_with_substrings_1_empty_initial.xml" ).openStream(), "UTF-8" );

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

        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

        ExprNode filter = searchRequest.getFilter();

        assertTrue( filter instanceof SubstringNode );

View Full Code Here

     * Test parsing of a request with a Substrings Filter with 1 Initial and 1 Any elements
     */
    @Test
    public void testRequestWithSubstrings1Initial1Any()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( SearchRequestTest.class
                .getResource( "filters/request_with_substrings_1_initial_1_any.xml" ).openStream(), "UTF-8" );

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

        SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

        ExprNode filter = searchRequest.getFilter();

        assertTrue( filter instanceof SubstringNode );

View Full Code Here

TOP

Related Classes of org.apache.directory.api.dsmlv2.request.SearchRequestDsml

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.