Package org.apache.directory.shared.dsmlv2.request

Examples of org.apache.directory.shared.dsmlv2.request.Dsmlv2Grammar


     */
    public Dsmlv2Parser( boolean storeMsgInBatchReq ) throws XmlPullParserException
    {
        this.storeMsgInBatchReq = storeMsgInBatchReq;

        this.grammar = new Dsmlv2Grammar();
        this.container = new Dsmlv2Container( grammar.getLdapCodecService() );

        this.container.setGrammar( grammar );

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
View Full Code Here


        monitor.worked( 1 );

        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
View Full Code Here

     */
    public Dsmlv2Parser( boolean storeMsgInBatchReq ) throws XmlPullParserException
    {
        this.storeMsgInBatchReq = storeMsgInBatchReq;

        this.grammar = new Dsmlv2Grammar();
        this.container = new Dsmlv2Container( grammar.getLdapCodecService() );

        this.container.setGrammar( grammar );

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
View Full Code Here

     *      when an unrecoverable error occurs
     * @throws IOException
     */
    public void parse() throws XmlPullParserException, IOException
    {
        Dsmlv2Grammar grammar = Dsmlv2Grammar.getInstance();

        grammar.executeAction( container );
    }
View Full Code Here

     * Test parsing of a request with the principal attribute
     */
    @Test
    public void testRequestWithPrincipal()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( AuthRequestTest.class.getResource( "request_with_principal_attribute.xml" ).openStream(),
                "UTF-8" );

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

        BindRequest bindRequest = ( BindRequest ) parser.getBatchRequest().getCurrentRequest();

        assertEquals( "CN=Bob Rush,OU=Dev,DC=Example,DC=COM", bindRequest.getName() );
    }
View Full Code Here

     * Test parsing of a request with the (optional) requestID attribute
     */
    @Test
    public void testRequestWithRequestId()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( AuthRequestTest.class.getResource( "request_with_requestID_attribute.xml" ).openStream(),
                "UTF-8" );

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

        BindRequest abandonRequest = ( BindRequest ) parser.getBatchRequest().getCurrentRequest();

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

     * Test parsing of a request with a (optional) Control element
     */
    @Test
    public void testRequestWith1Control()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( AuthRequestTest.class.getResource( "request_with_1_control.xml" ).openStream(), "UTF-8" );

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

        BindRequest abandonRequest = ( BindRequest ) parser.getBatchRequest().getCurrentRequest();
        Map<String, Control> controls = abandonRequest.getControls();

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

        Control control = controls.get( "1.2.840.113556.1.4.643" );
View Full Code Here

     * Test parsing of a request with the (optional) requestID attribute
     */
    @Test
    public void testRequestWithRequestId()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( ExtendedRequestTest.class.getResource( "request_with_requestID_attribute.xml" )
                .openStream(), "UTF-8" );

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

        ExtendedRequestDsml<?, ?> extendedRequest =
            ( ExtendedRequestDsml<?, ?> ) parser.getBatchRequest().getCurrentRequest();

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

     * Test parsing of a request with a (optional) Control element with Base64 value
     */
    @Test
    public void testRequestWith1ControlBase64Value()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( AuthRequestTest.class.getResource( "request_with_1_control_base64_value.xml" )
                .openStream(), "UTF-8" );

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

        BindRequest abandonRequest = ( BindRequest ) parser.getBatchRequest().getCurrentRequest();
        Map<String, Control> controls = abandonRequest.getControls();

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

        Control control = controls.get( "1.2.840.113556.1.4.643" );
View Full Code Here

     * Test parsing of a request with a (optional) Control element
     */
    @Test
    public void testRequestWith1Control()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( ExtendedRequestTest.class.getResource( "request_with_1_control.xml" ).openStream(),
                "UTF-8" );

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

        ExtendedRequestDsml<?, ?> extendedRequest =
            ( ExtendedRequestDsml<?, ?> ) parser.getBatchRequest().getCurrentRequest();
        Map<String, Control> controls = extendedRequest.getControls();

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

        Control control = controls.get( "1.2.840.113556.1.4.643" );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.dsmlv2.request.Dsmlv2Grammar

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.