Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockServletContext


    request.setMethod("POST");
    request.setBodyContent(body);

        MockHttpSession session = new MockHttpSession();
        session.setupServletContext(new MockServletContext());
        request.setSession(session);

        request.setUserPrincipal(null);

    return request;
View Full Code Here


        // create Engine
        PropertiesConfiguration config = new  PropertiesConfiguration();
        config.load(new FileInputStream("./src/webapp/WEB-INF/conf/jetspeed.properties"));
        Mock servletConfigMock = new Mock(ServletConfig.class);
        MockServletConfig msc = new MockServletConfig();
        msc.setServletContext(new MockServletContext());
        Engine engine = Jetspeed.createEngine(config, "./src/webapp", msc, SpringEngine.class);

        // mock test PortletWindow
        Mock entityMock = new Mock(MutablePortletEntity.class);       
        Mock windowListMock = new Mock(CompositeWindowList.class);
View Full Code Here

        this.portletFactory.setPortalContext(portalContext);       
    }
   
    public void testPortletInstance() throws PortletException
    {
        ServletContext servletContext = new MockServletContext();
       
        PortletApplication demoPA =
            (PortletApplication) DelegatingObjectProxy.createProxy(new Class [] { PortletApplication.class, PortletApplicationDefinition.class },
                                                                   new MockPortletApplication("demo", null, null));
       
View Full Code Here

    throws Exception
    {
        RequestContextComponent rcc = (RequestContextComponent) new Mock(RequestContextComponent.class).proxy();
       
        MockServletConfig config = new MockServletConfig();
        MockServletContext context = new MockServletContext();
        MockHttpSession session = new MockHttpSession();
        session.setupServletContext(context);
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setupAddParameter("action", "constraints");
        request.setupAddParameter("method", method);
View Full Code Here

            String p_sPortletId, String p_sCol, String p_sRow)
    {
        RequestContextComponent rcc = (RequestContextComponent) new Mock(RequestContextComponent.class).proxy();
       
        MockServletConfig config = new MockServletConfig();
        MockServletContext context = new MockServletContext();
        MockHttpSession session = new MockHttpSession();
        session.setupServletContext(context);
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setupAddParameter("action", p_sAction);
        request.setupAddParameter("id", p_sPortletId);
View Full Code Here

        paths.add(create(tmp, "with space", "ascii"));
        paths.add(create(tmp, "with space", "làtîn"));

        GeoServerResourceLoader loader = new GeoServerResourceLoader(tmp);
        publisher = new FilePublisher(loader);
        publisher.setServletContext(new MockServletContext());
    }
View Full Code Here

        // put the mock http server in test mode
        TestHttpClientProvider.startTest();

        // if we have data, create a mock servlet context and start up the spring configuration
        if (testData.isTestDataAvailable()) {
            MockServletContext servletContext = new MockServletContext();
            servletContext.setInitParameter("GEOSERVER_DATA_DIR", testData.getDataDirectoryRoot()
                    .getPath());
            servletContext.setInitParameter("serviceStrategy", "PARTIAL-BUFFER2");
           
            //set up a fake WEB-INF directory
            if (testData.getDataDirectoryRoot().canWrite()) {
                File webinf = new File(testData.getDataDirectoryRoot(), "WEB-INF");
                webinf.mkdir();
               
                servletContext.setRealPath("WEB-INF", webinf.getAbsolutePath());
            }

            List<String> contexts = new ArrayList();
            setUpSpring(contexts);

            applicationContext = new GeoServerTestApplicationContext(
                contexts.toArray(new String[contexts.size()]), servletContext);
            applicationContext.setUseLegacyGeoServerLoader(false);
            applicationContext.refresh();
            applicationContext.publishEvent(new ContextLoadedEvent(applicationContext));

            // set the parameter after a refresh because it appears a refresh
            // wipes
            // out all parameters
            servletContext.setAttribute(
                WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext);

            onSetUp(testData);
        }
    }
View Full Code Here

       
       
        kvp(request, path);

        MockHttpSession session = new MockHttpSession();
        session.setupServletContext(new MockServletContext());
        request.setSession(session);

        request.setUserPrincipal(null);

        return request;
View Full Code Here

        //HACK: once we port tests to the new data directory, remove this
        GeoServerLoader.setLegacy( useLegacyDataDirectory() );

        // if we have data, create a mock servlet context and start up the spring configuration
        if (testData.isTestDataAvailable()) {
            MockServletContext servletContext = new MockServletContext();
            servletContext.setInitParameter("GEOSERVER_DATA_DIR", testData.getDataDirectoryRoot()
                    .getPath());
            servletContext.setInitParameter("serviceStrategy", "PARTIAL-BUFFER2");
           
            //set up a fake WEB-INF directory
            if (testData.getDataDirectoryRoot().canWrite()) {
                File webinf = new File(testData.getDataDirectoryRoot(), "WEB-INF");
                webinf.mkdir();
               
                servletContext.setRealPath("WEB-INF", webinf.getAbsolutePath());
            }
           
            applicationContext = new GeoServerTestApplicationContext(getSpringContextLocations(),
                    servletContext);
            applicationContext.setUseLegacyGeoServerLoader(useLegacyDataDirectory());
            applicationContext.refresh();
            applicationContext.publishEvent(new ContextLoadedEvent(applicationContext));

            // set the parameter after a refresh because it appears a refresh
            // wipes
            // out all parameters
            servletContext.setAttribute(
                    WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                    applicationContext);
        }
    }
View Full Code Here

       
       
        kvp(request, path);

        MockHttpSession session = new MockHttpSession();
        session.setupServletContext(new MockServletContext());
        request.setSession(session);

        request.setUserPrincipal(null);

        return request;
View Full Code Here

TOP

Related Classes of com.mockrunner.mock.web.MockServletContext

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.