Package org.apache.directory.shared.dsmlv2

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


     * 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

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

            parser.setInput(
                AuthRequestTest.class.getResource( "request_with_1_control_empty_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 2 (optional) Control elements
     */
    @Test
    public void testRequestWith2Controls()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( AuthRequestTest.class.getResource( "request_with_2_controls.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( 2, abandonRequest.getControls().size() );

        Control control = controls.get( "1.2.840.113556.1.4.789" );
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( ExtendedRequestTest.class.getResource( "request_with_1_control_base64_value.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

     * Test parsing of a request with 3 (optional) Control elements without value
     */
    @Test
    public void testRequestWith3ControlsWithoutValue()
    {
        Dsmlv2Parser parser = null;
        try
        {
            parser = newParser();

            parser.setInput( AuthRequestTest.class.getResource( "request_with_3_controls_without_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( 3, abandonRequest.getControls().size() );

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

        monitor.worked( 1 );

        try
        {
            // Parsing the file
            Dsmlv2Parser parser = new Dsmlv2Parser();
            parser.setInput( new FileInputStream( dsmlFile ), "UTF-8" );
            parser.parseAllRequests();

            // Getting the batch request
            BatchRequest 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 Response with the (optional) requestID attribute
     */
    @Test
    public void testResponseWithRequestId()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser( getCodec() );

            parser.setInput( SearchResponseTest.class.getResource( "response_with_requestID_attribute.xml" )
                .openStream(), "UTF-8" );

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

        SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
            .getDecorated();

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

     * Test parsing of a Response with a Search Result Done
     */
    @Test
    public void testResponseWithSRD()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser( getCodec() );

            parser.setInput( SearchResponseTest.class.getResource( "response_with_1_SRD.xml" ).openStream(), "UTF-8" );

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

        SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
            .getDecorated();

        assertNotNull( searchResponse.getSearchResultDone() );
    }
View Full Code Here

     * Test parsing of a Response with 1 Search Result Entry and a Search Result Done
     */
    @Test
    public void testResponseWith1SRE1SRD()
    {
        Dsmlv2ResponseParser parser = null;
        try
        {
            parser = new Dsmlv2ResponseParser( getCodec() );

            parser.setInput( SearchResponseTest.class.getResource( "response_with_1_SRE_1_SRD.xml" ).openStream(),
                "UTF-8" );

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

        SearchResponse searchResponse = ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
            .getDecorated();

        assertEquals( 1, searchResponse.getSearchResultEntryList().size() );

        assertNotNull( searchResponse.getSearchResultDone() );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.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.