Package com.meterware.servletunit

Examples of com.meterware.servletunit.ServletRunner


        if (container == null) {
            String resource = System.getProperty("jest.web.xml", DEFAULT_WEB_XML);
            System.err.println("Starting Servlet Container from " + resource);
            InputStream wdesc = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
            assertNotNull(resource + " not loadable at thread context classpath", wdesc);
            container = new ServletRunner(wdesc);
            assertNotNull("Servlet engine could not be started", container);
           
            baseURI = System.getProperty("jest.base.uri", DEFAULT_BASE_URI);
            System.err.println("Base URI  " + baseURI);
           
View Full Code Here


    @Before
    public void setUp() throws Exception {
        InputStream is = this.getClass().getResourceAsStream(getConfiguration());
        assertNotNull("The configuration input stream should not be null", is);
        sr = new ServletRunner(is, CONTEXT);
       
        loadServlets();
       
        HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);
       
View Full Code Here

        assertEquals("<-empty->", res);
    }

    protected void initTest(String ctxScope, String sesScope, String reqScope, FilterDef[] filters) throws Exception {
        InputStream webXml = getWebXml(filters, ctxScope, sesScope, reqScope);
        sr = new ServletRunner(webXml);
        sr.registerServlet("empty", EmptyServlet.class.getName());
    }
View Full Code Here

    protected static ApplicationContext factory;

    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

     * ����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

        createBeanFactory("services.xml");

        // sub context - web context������ͼ����ע��request�ȶ��󣬵�������parent���Ѿ����ڣ�������
        subFactory = new XmlWebApplicationContext();
        subFactory.setConfigLocation("empty.xml");
        subFactory.setServletContext(new ServletRunner(new File(srcdir, "WEB-INF/web.xml"), "").newClient()
                .newInvocation("http://localhost/servlet").getServlet().getServletConfig().getServletContext());
        subFactory.setParent((ApplicationContext) factory);
        subFactory.refresh();

        // init global before request��parent context�е�singleton proxy����ע��
View Full Code Here

    protected XmlWebApplicationContext factory;
    protected TemplateService templateService;
    protected JspEngineImpl engine;

    protected void initServlet(String webXml) throws Exception {
        ServletRunner runner = new ServletRunner(new File(srcdir, webXml), "");
        client = runner.newClient();
        ic = client.newInvocation("http://localhost:8080/app1");

        servletContext = new ServletContextWrapper(ic.getServlet().getServletConfig().getServletContext());
        request = ic.getRequest();
        response = ic.getResponse();
View Full Code Here

        CacheManager.getInstance().removeCache( "url-failures-cache" );

        HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );

        sr = new ServletRunner( getTestFile( "src/test/resources/WEB-INF/web.xml" ) );
        sr.registerServlet( "/workingcopy/*", MockWorkingCopyServlet.class.getName() );
        sc = sr.newClient();

        new File( workingDirectory, "1/src/main/java/org/apache/continuum" ).mkdirs();
        new File( workingDirectory, "1/src/main/java/org/apache/continuum/App.java" ).createNewFile();
View Full Code Here

        Configuration config = archivaConfiguration.getConfiguration();

        config.addManagedRepository( createManagedRepository( REPOID_INTERNAL, "Internal Test Repo", repoRootInternal ) );
        saveConfiguration();

        sr = new ServletRunner();
        sr.registerServlet( "/repository/*", UnauthenticatedRepositoryServlet.class.getName() );
        sc = sr.newClient();
        HttpSession session = sc.getSession( true );
        ServletContext servletContext = session.getServletContext();
        servletContext.setAttribute( PlexusConstants.PLEXUS_KEY, getContainer() );
View Full Code Here

    }

    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

TOP

Related Classes of com.meterware.servletunit.ServletRunner

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.