Package com.meterware.servletunit

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


    public void testGetRepositories()
        throws Exception
    {
        ServletRunner sr = new ServletRunner();
        ServletUnitClient sc = sr.newClient();

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


    public void testGetRepositoryGroups()
        throws Exception
    {
        ServletRunner sr = new ServletRunner();
        ServletUnitClient sc = sr.newClient();

        Configuration configuration = createInitialConfiguration();
       
        archivaConfiguration.getConfiguration();
        archivaConfigurationControl.setReturnValue( configuration );
View Full Code Here

        repositoryLocation = new File( appserverBase, "data/repositories/internal" );

        ServletRunner sr = new ServletRunner();
        sr.registerServlet( "/repository/*", UnauthenticatedRepositoryServlet.class.getName() );
        sc = sr.newClient();
        sc.getSession( true ).getServletContext().setAttribute( PlexusConstants.PLEXUS_KEY, getContainer() );
    }

    public void testPutWithMissingParentCollection()
        throws IOException, SAXException
View Full Code Here

            TestRepositorySessionFactory factory =
                applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
            factory.setRepositorySession( session );

            ServletRunner sr = new ServletRunner();
            ServletUnitClient sc = sr.newClient();

            action.setServletRequest( sc.newInvocation( "http://localhost/admin/repositories.action" ).getRequest() );

            action.prepare();
            String result = action.execute();
View Full Code Here

    @Test
    public void testGetRepositoryGroups()
        throws Exception
    {
        ServletRunner sr = new ServletRunner();
        ServletUnitClient sc = sr.newClient();

        Configuration configuration = createInitialConfiguration();

        archivaConfiguration.getConfiguration();
        archivaConfigurationControl.setReturnValue( configuration, 6, 8 );
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 = createServletContextWrapper(ic.getServlet().getServletConfig().getServletContext());

        assertNotNull(servletContext);
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

        // Servlet container
        ServletRunner servletRunner = new ServletRunner();
        servletRunner.registerServlet("/*", NoopServlet.class.getName());

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

        // Charset
        HttpUnitOptions.setDefaultCharacterSet("GBK");
    }

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

    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

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.