Package com.meterware.servletunit

Examples of com.meterware.servletunit.ServletRunner.newClient()


        ServletRunner servletRunner = new FilterServletRunner();

        servletRunner.registerServlet("myservlet", MyServlet.class.getName());

        // Servlet client
        client = servletRunner.newClient();

        // 取得初始页面form.html
        WebResponse response = client.getResponse(new GetMethodWebRequest("http://localhost/myservlet"));

        WebForm form = response.getFormWithName("myform");
View Full Code Here


    }

    @Before
    public final void prepareRequest() throws Exception {
        ServletRunner servletRunner = new ServletRunner(new File(srcdir, "WEB-INF/web.xml"), "/myapp");
        ServletUnitClient client = servletRunner.newClient();
        InvocationContext invocationContext = client.newInvocation("http://localhost/myapp/myservlet");

        HttpServletRequest request = invocationContext.getRequest();
        HttpServletResponse response = invocationContext.getResponse();
        ServletConfig config = invocationContext.getServlet().getServletConfig();
View Full Code Here

    protected static void prepareServlet() throws Exception {
        ServletRunner servletRunner = new ServletRunner();

        servletRunner.registerServlet("/app1/*", MyServlet.class.getName());

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

        MyServlet servlet = (MyServlet) client.newInvocation("http://www.taobao.com/app1").getServlet();
        assertNotNull(servlet);
View Full Code Here

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

        // Servlet client
        client = servletRunner.newClient();
    }

    protected void registerServlets(ServletRunner runner) {
    }

View Full Code Here

    protected static void prepareServlet() throws Exception {
        ServletRunner servletRunner = new ServletRunner();

        servletRunner.registerServlet("/app1/*", MyServlet.class.getName());

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

        MyServlet servlet = (MyServlet) client.newInvocation("http://www.taobao.com/app1").getServlet();
        assertNotNull(servlet);
View Full Code Here

        // 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

        requestContexts = (RequestContextChainingService) factory.getBean("requestContexts");

        ServletRunner servletRunner = new ServletRunner();
        servletRunner.registerServlet("/app1/*", MyServlet.class.getName());
        ServletUnitClient client = servletRunner.newClient();
        InvocationContext ic = client.newInvocation(url);
        MyServlet servlet = (MyServlet) ic.getServlet();

        rc = requestContexts.getRequestContext(servlet.getServletContext(), ic.getRequest(), ic.getResponse());
    }
View Full Code Here

        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

        File webXml = new File(webInf, "web.xml");

        ServletRunner servletRunner = new ServletRunner(webXml, "");

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

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

    protected ResourceLoadingService resourceLoadingService;

    protected static void initServlet() throws Exception {
        ServletRunner servletRunner = new ServletRunner(new File(srcdir, "WEB-INF/web.xml"), "");
        client = servletRunner.newClient();

        InvocationContext ic = client.newInvocation("http://www.taobao.com/app1");
        servletContext = new ServletContextWrapper(ic.getServlet().getServletConfig().getServletContext());

        assertNotNull(servletContext);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.