Package com.meterware.servletunit

Examples of com.meterware.servletunit.ServletRunner


    public static final String CONTEXT_URL = "http://localhost/mycontext";
    protected ServletRunner sr;

    @Before
    public void setUp() throws Exception {
        sr = new ServletRunner(getResourceAsStream(getConfiguration()), CONTEXT);
       
        try {
            sr.newClient().getResponse(CONTEXT_URL + "/services");
        } catch (HttpNotFoundException e) {
            // ignore, we just want to boot up the servlet
View Full Code Here


public abstract class AbstractServletTest extends AbstractCXFTest {

    protected ServletRunner sr;

    public void setUp() throws Exception {
        sr = new ServletRunner(getResourceAsStream(getConfiguration()));
       
        try {
            sr.newClient().getResponse("http://localhost/services/");
        } catch (HttpNotFoundException e) {
            // ignore, we just want to boot up the servlet
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( "/repository/*", UnauthenticatedRepositoryServlet.class.getName() );
        sc = sr.newClient();
    }
View Full Code Here

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

        HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );

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

        servletAuthControl = MockControl.createControl( ServletAuthenticator.class );
        servletAuthControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
View Full Code Here

    protected ServletRunner sr;

    @Before
    public void setUp() throws Exception {
        InputStream configurationStream = getResourceAsStream(getConfiguration());
        sr = new ServletRunner(configurationStream, CONTEXT);
       
        try {
            sr.newClient().getResponse(CONTEXT_URL + "/services");
        } catch (HttpNotFoundException e) {
            // ignore, we just want to boot up the servlet
View Full Code Here

    }
   
    @Test
    public void testInvoke() {
        try {
            sr = new ServletRunner(getResourceAsStream(getConfiguration()), CONTEXT);
            sr.newClient().getResponse(CONTEXT_URL + "/services");
            // there expect a spring bean exception
            fail("we expect a spring bean Exception here");
        } catch (Exception ex) {
            // supprot spring 2.0.x and sping 2.5
View Full Code Here

    }
   
    @Test
    public void testInvoke() {
        try {
            sr = new ServletRunner(getResourceAsStream(getConfiguration()), CONTEXT);
            sr.newClient().getResponse(CONTEXT_URL + "/services");
            // there expect a class not found exception
            fail("we expect a CannotLoadBeanClassException here");
        } catch (Exception ex) {
            assertTrue("we expect a CannotLoadBeanClassException here",
View Full Code Here

    {
        super.setUp();

        HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);
   
        sr = new ServletRunner( getResourceAsStream(getConfiguration()) );
    }
View Full Code Here

        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

    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 = createServletContextWrapper(ic.getServlet().getServletConfig().getServletContext());

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