Package org.apache.cactus

Examples of org.apache.cactus.FilterTestCase


        if (!(theTestInstance instanceof FilterTestCase))
        {
            return;
        }

        FilterTestCase filterInstance = (FilterTestCase) theTestInstance;
        FilterImplicitObjects filterImplicitObjects =
            (FilterImplicitObjects) this.webImplicitObjects;

        // Sets the request field of the test case class
        // ---------------------------------------------
        // Extract from the HTTP request the URL to simulate (if any)
        HttpServletRequest request =
            filterImplicitObjects.getHttpServletRequest();

        ServletURL url = ServletURL.loadFromRequest(request);

        Field requestField = filterInstance.getClass().getField("request");

        requestField.set(filterInstance,
            new HttpServletRequestWrapper(request, url));

        // Set the response field of the test case class
        // ---------------------------------------------
        Field responseField = filterInstance.getClass().getField("response");

        responseField.set(filterInstance,
            filterImplicitObjects.getHttpServletResponse());

        // Set the config field of the test case class
        // -------------------------------------------
        Field configField = filterInstance.getClass().getField("config");

        configField.set(filterInstance,
            new FilterConfigWrapper(filterImplicitObjects.getFilterConfig()));

        // Set the filter chain of the test case class
        // -------------------------------------------
        Field chainField = filterInstance.getClass().getField("filterChain");

        chainField.set(filterInstance, filterImplicitObjects.getFilterChain());
    }
View Full Code Here


        if (!(theTestInstance instanceof FilterTestCase))
        {
            return;
        }

        FilterTestCase filterInstance = (FilterTestCase) theTestInstance;
        FilterImplicitObjects filterImplicitObjects =
            (FilterImplicitObjects) this.webImplicitObjects;

        // Sets the request field of the test case class
        // ---------------------------------------------
        // Extract from the HTTP request the URL to simulate (if any)
        HttpServletRequest request =
            filterImplicitObjects.getHttpServletRequest();

        ServletURL url = ServletURL.loadFromRequest(request);

        Field requestField = filterInstance.getClass().getField("request");

        requestField.set(filterInstance,
            new HttpServletRequestWrapper(request, url));

        // Set the response field of the test case class
        // ---------------------------------------------
        Field responseField = filterInstance.getClass().getField("response");

        responseField.set(filterInstance,
            filterImplicitObjects.getHttpServletResponse());

        // Set the config field of the test case class
        // -------------------------------------------
        Field configField = filterInstance.getClass().getField("config");

        configField.set(filterInstance,
            new FilterConfigWrapper(filterImplicitObjects.getFilterConfig()));

        // Set the filter chain of the test case class
        // -------------------------------------------
        Field chainField = filterInstance.getClass().getField("filterChain");

        chainField.set(filterInstance, filterImplicitObjects.getFilterChain());
    }
View Full Code Here

     * @see AbstractWebTestCaller#setTestCaseFields(AbstractTestCase)
     */
    protected void setTestCaseFields(AbstractTestCase theTestInstance)
        throws Exception
    {
        FilterTestCase filterInstance = (FilterTestCase) theTestInstance;
        FilterImplicitObjects filterImplicitObjects =
            (FilterImplicitObjects) this.webImplicitObjects;

        // Sets the request field of the test case class
        // ---------------------------------------------

        // Extract from the HTTP request the URL to simulate (if any)
        HttpServletRequest request =
            filterImplicitObjects.getHttpServletRequest();

        ServletURL url = ServletURL.loadFromRequest(request);

        Field requestField = filterInstance.getClass().getField("request");
        requestField.set(filterInstance,
            new HttpServletRequestWrapper(request, url));

        // Set the response field of the test case class
        // ---------------------------------------------

        Field responseField = filterInstance.getClass().getField("response");
        responseField.set(filterInstance,
            filterImplicitObjects.getHttpServletResponse());

        // Set the config field of the test case class
        // -------------------------------------------

        Field configField = filterInstance.getClass().getField("config");
        configField.set(filterInstance,
            new FilterConfigWrapper(filterImplicitObjects.getFilterConfig()));

        // Set the filter chain of the test case class
        // -------------------------------------------

        Field chainField = filterInstance.getClass().getField("filterChain");
        chainField.set(filterInstance,
            filterImplicitObjects.getFilterChain());
    }
View Full Code Here

        if (!(theTestInstance instanceof FilterTestCase))
        {
            return;
        }

        FilterTestCase filterInstance = (FilterTestCase) theTestInstance;
        FilterImplicitObjects filterImplicitObjects =
            (FilterImplicitObjects) this.webImplicitObjects;

        // Sets the request field of the test case class
        // ---------------------------------------------
        // Extract from the HTTP request the URL to simulate (if any)
        HttpServletRequest request =
            filterImplicitObjects.getHttpServletRequest();

        ServletURL url = ServletURL.loadFromRequest(request);

        Field requestField = filterInstance.getClass().getField("request");

        requestField.set(filterInstance,
            new HttpServletRequestWrapper(request, url));

        // Set the response field of the test case class
        // ---------------------------------------------
        Field responseField = filterInstance.getClass().getField("response");

        responseField.set(filterInstance,
            filterImplicitObjects.getHttpServletResponse());

        // Set the config field of the test case class
        // -------------------------------------------
        Field configField = filterInstance.getClass().getField("config");

        configField.set(filterInstance,
            new FilterConfigWrapper(filterImplicitObjects.getFilterConfig()));

        // Set the filter chain of the test case class
        // -------------------------------------------
        Field chainField = filterInstance.getClass().getField("filterChain");

        chainField.set(filterInstance, filterImplicitObjects.getFilterChain());
    }
View Full Code Here

        if (!(theTestInstance instanceof FilterTestCase))
        {
            return;
        }

        FilterTestCase filterInstance = (FilterTestCase) theTestInstance;
        FilterImplicitObjects filterImplicitObjects =
            (FilterImplicitObjects) this.webImplicitObjects;

        // Sets the request field of the test case class
        // ---------------------------------------------
        // Extract from the HTTP request the URL to simulate (if any)
        HttpServletRequest request =
            filterImplicitObjects.getHttpServletRequest();

        ServletURL url = ServletURL.loadFromRequest(request);

        Field requestField = filterInstance.getClass().getField("request");

        requestField.set(filterInstance,
            AbstractHttpServletRequestWrapper.newInstance(request, url));

        // Set the response field of the test case class
        // ---------------------------------------------
        Field responseField = filterInstance.getClass().getField("response");

        responseField.set(filterInstance,
            filterImplicitObjects.getHttpServletResponse());

        // Set the config field of the test case class
        // -------------------------------------------
        Field configField = filterInstance.getClass().getField("config");

        configField.set(filterInstance,
            new FilterConfigWrapper(filterImplicitObjects.getFilterConfig()));

        // Set the filter chain of the test case class
        // -------------------------------------------
        Field chainField = filterInstance.getClass().getField("filterChain");

        chainField.set(filterInstance, filterImplicitObjects.getFilterChain());
    }
View Full Code Here

     * @see AbstractTestCaller#setTestCaseFields(AbstractTestCase)
     */
    protected void setTestCaseFields(AbstractTestCase theTestInstance)
        throws Exception
    {
        FilterTestCase filterInstance = (FilterTestCase) theTestInstance;
        FilterImplicitObjects filterImplicitObjects =
            (FilterImplicitObjects) this.webImplicitObjects;

        // Sets the request field of the test case class
        // ---------------------------------------------

        // Extract from the HTTP request the URL to simulate (if any)
        HttpServletRequest request =
            filterImplicitObjects.getHttpServletRequest();

        ServletURL url = ServletURL.loadFromRequest(request);

        Field requestField = filterInstance.getClass().getField("request");
        requestField.set(filterInstance,
            new HttpServletRequestWrapper(request, url));

        // Set the response field of the test case class
        // ---------------------------------------------

        Field responseField = filterInstance.getClass().getField("response");
        responseField.set(filterInstance,
            filterImplicitObjects.getHttpServletResponse());

        // Set the config field of the test case class
        // -------------------------------------------

        Field configField = filterInstance.getClass().getField("config");
        configField.set(filterInstance,
            new FilterConfigWrapper(filterImplicitObjects.getFilterConfig()));

        // Set the filter chain of the test case class
        // -------------------------------------------

        Field chainField = filterInstance.getClass().getField("filterChain");
        chainField.set(filterInstance,
            filterImplicitObjects.getFilterChain());
    }
View Full Code Here

        if (!(theTestInstance instanceof FilterTestCase))
        {
            return;
        }

        FilterTestCase filterInstance = (FilterTestCase) theTestInstance;
        FilterImplicitObjects filterImplicitObjects =
            (FilterImplicitObjects) this.webImplicitObjects;

        // Sets the request field of the test case class
        // ---------------------------------------------
        // Extract from the HTTP request the URL to simulate (if any)
        HttpServletRequest request =
            filterImplicitObjects.getHttpServletRequest();

        ServletURL url = ServletURL.loadFromRequest(request);

        Field requestField = filterInstance.getClass().getField("request");

        requestField.set(filterInstance,
            new HttpServletRequestWrapper(request, url));

        // Set the response field of the test case class
        // ---------------------------------------------
        Field responseField = filterInstance.getClass().getField("response");

        responseField.set(filterInstance,
            filterImplicitObjects.getHttpServletResponse());

        // Set the config field of the test case class
        // -------------------------------------------
        Field configField = filterInstance.getClass().getField("config");

        configField.set(filterInstance,
            new FilterConfigWrapper(filterImplicitObjects.getFilterConfig()));

        // Set the filter chain of the test case class
        // -------------------------------------------
        Field chainField = filterInstance.getClass().getField("filterChain");

        chainField.set(filterInstance, filterImplicitObjects.getFilterChain());
    }
View Full Code Here

TOP

Related Classes of org.apache.cactus.FilterTestCase

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.