Package com.meterware.servletunit

Examples of com.meterware.servletunit.PatchedServletRunner


     * ����web client��ע��servlets��
     */
    @Before
    public final void prepareWebClient() throws Exception {
        // Servlet container
        ServletRunner servletRunner = new PatchedServletRunner();

        registerServlets(servletRunner);
        servletRunner.registerServlet("/readfile/*", ReadFileServlet.class.getName());
        servletRunner.registerServlet("/servlet/*", NoopServlet.class.getName());
        servletRunner.registerServlet("*.do", NoopServlet.class.getName());

        // Servlet client
        client = servletRunner.newClient();
    }
View Full Code Here


    private RequestContext                requestContext;

    private WebResponse clientResponse;

    public ServletTestContainer() {
        servletRunner = new PatchedServletRunner();

        servletRunner.registerServlet("/noop/*", NoopServlet.class.getName());
        init(servletRunner);

        client = servletRunner.newClient();
View Full Code Here

    static {
        Servlet3Util.setDisableServlet3Features(true); // 禁用servlet3,因为httpunit还不支持
    }

    public ServletTestContainer() {
        servletRunner = new PatchedServletRunner();

        servletRunner.registerServlet("/noop/*", NoopServlet.class.getName());
        init(servletRunner);

        client = servletRunner.newClient();
View Full Code Here

    protected final void prepareWebClient(String webXmlName, String contextPath) throws Exception {
        // Servlet container
        File webInf = new File(srcdir, "WEB-INF");
        File webXml = new File(webInf, defaultIfEmpty(webXmlName, "web.xml"));

        ServletRunner servletRunner = new PatchedServletRunner(webXml, contextPath);

        // Servlet client
        client = servletRunner.newClient();
        client.setExceptionsThrownOnErrorStatus(false);
        client.getClientProperties().setAutoRedirect(false);

        // Ignore script error
        JavaScript.setThrowExceptionsOnError(false);
View Full Code Here

    }

    protected static void prepareServlet(String app) throws Exception {
        // Servlet container
        File webXml = new File(srcdir, "WEB-INF/web.xml");
        ServletRunner servletRunner = new PatchedServletRunner(webXml, "");

        // Servlet client
        client = servletRunner.newClient();
        client.setExceptionsThrownOnErrorStatus(false);
        client.getClientProperties().setAutoRedirect(false);

        // Filter
        WebxFrameworkFilter filter = (WebxFrameworkFilter) client.newInvocation("http://www.taobao.com/" + app)
View Full Code Here

    /** 创建web client,注册servlets。 */
    @Before
    public final void prepareWebClient() throws Exception {
        // Servlet container
        ServletRunner servletRunner = new PatchedServletRunner();

        registerServlets(servletRunner);
        servletRunner.registerServlet("/readfile/*", ReadFileServlet.class.getName());
        servletRunner.registerServlet("/servlet/*", NoopServlet.class.getName());
        servletRunner.registerServlet("*.do", NoopServlet.class.getName());

        // Servlet client
        client = servletRunner.newClient();
    }
View Full Code Here

    public void componentPath_wrong() throws Exception {
        File webInf = new File(srcdir, "app2/WEB-INF");
        File webXml = new File(webInf, "web.xml");

        try {
            new PatchedServletRunner(webXml, "");
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("default component \"app1\" should not have component path \"/my/app1\""));
        }
    }
View Full Code Here

    @Before
    public void init() throws Exception {
        File webInf = new File(srcdir, "app3/WEB-INF");
        File webXml = new File(webInf, "web.xml");

        ServletRunner servletRunner = new PatchedServletRunner(webXml, "");
        client = servletRunner.newClient();

        filter = (WebxFrameworkFilter) client.newInvocation("http://www.taobao.com/app1").getFilter();
        assertNotNull(filter);

        components = filter.getWebxComponents();
View Full Code Here

    public void illegal_configLocationPattern() throws Exception {
        File webInf = new File(srcdir, "app4/WEB-INF");
        File webXml = new File(webInf, "web.xml");

        try {
            new PatchedServletRunner(webXml, "");
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e,
                       exception("Invalid componentConfigurationLocationPattern: classpath*:META-INF/mycomponent.xml"));
        }
View Full Code Here

    /** 创建web client,注册servlets。 */
    @Before
    public final void prepareWebClient() throws Exception {
        // Servlet container
        ServletRunner servletRunner = new PatchedServletRunner();

        registerServlets(servletRunner);
        servletRunner.registerServlet("/readfile/*", ReadFileServlet.class.getName());
        servletRunner.registerServlet("/servlet/*", NoopServlet.class.getName());
        servletRunner.registerServlet("*.do", NoopServlet.class.getName());

        // Servlet client
        client = servletRunner.newClient();
    }
View Full Code Here

TOP

Related Classes of com.meterware.servletunit.PatchedServletRunner

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.