Package com.meterware.servletunit

Examples of com.meterware.servletunit.ServletUnitClient.newInvocation()


        archivaConfiguration.getConfiguration();
        archivaConfigurationControl.setReturnValue( configuration, 6, 8 );
        archivaConfigurationControl.replay();

        action.setServletRequest( sc.newInvocation( "http://localhost/admin/repositoryGroups.action" ).getRequest() );
        action.prepare();
        String result = action.execute();
        assertEquals( Action.SUCCESS, result );

        assertEquals( "http://localhost:0/repository", action.getBaseUrl() );
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

    public void init() throws Exception {
        ServletRunner servletRunner = new ServletRunner();
        servletRunner.registerServlet("/app1/*", HttpServlet.class.getName());
        ServletUnitClient client = servletRunner.newClient();

        request = client.newInvocation("http://localhost/app1").getRequest();
        helper = ErrorHandlerHelper.getInstance(request);
        log = createMock(Logger.class);
    }

    @Test
View Full Code Here

    public void getInstance() throws Exception {
        ServletRunner servletRunner = new ServletRunner();
        servletRunner.registerServlet("/app1/*", HttpServlet.class.getName());
        ServletUnitClient client = servletRunner.newClient();

        request = client.newInvocation("http://localhost/app1").getRequest();

        assertNull(request.getAttribute("_webx_errorHandlerHelper_"));
        helper = ErrorHandlerHelper.getInstance(request);
        assertSame(helper, ErrorHandlerHelper.getInstance(request));
        assertSame(helper, request.getAttribute("_webx_errorHandlerHelper_"));
View Full Code Here

    public AbstractLogConfiguratorListenerTests() throws Exception {
        listener = new LogConfiguratorListener();

        ServletRunner runner = new ServletRunner(new File(webxml()), "");
        ServletUnitClient client = runner.newClient();
        InvocationContext ic = client.newInvocation("http://localhost/servlet");
        servletContext = ic.getServlet().getServletConfig().getServletContext();
        event = new ServletContextEvent(servletContext);
    }

    protected String webxml() {
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

    @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

        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

    // setup SOAP request
    webRequest = new SOAPMessageBodyWebRequest(urlString, operationName, source, isFile);

    // setup invocation context, using web request
    invocationContext = servletUnitClient.newInvocation(webRequest);

    // invoke the servlet
    invocationContext.service();

    // retrieve response
View Full Code Here

       
        archivaConfiguration.getConfiguration();
        archivaConfigurationControl.setReturnValue( configuration );
        archivaConfigurationControl.replay();
       
        action.setServletRequest( sc.newInvocation( "http://localhost/admin/repositoryGroups.action" ).getRequest() );
        action.prepare();
        String result = action.execute();
        assertEquals( Action.SUCCESS, result );
       
        assertEquals( "http://localhost:0/repository", action.getBaseUrl() );
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.