Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockServletConfig


import com.mockrunner.mock.web.MockServletConfig;

public class HessianServiceTest extends TestCase {

    public void testInit() throws Exception {
        MockServletConfig config = new MockServletConfig();
        config.setInitParameter(
                HessianService.EVENT_BRIDGE_FACTORY_PROPERTY,
                MockEventBridgeFactory.class.getName());

        HessianService handler = new HessianService() {
View Full Code Here


    request.setSession( session );
    request.setupAddParameter( "resource", "adhoc/picklist.xsl" ); //$NON-NLS-1$ //$NON-NLS-2$
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockServletContext context = new MockServletContext();
    context.setServletContextName( "pentaho" );
    MockServletConfig config = new MockServletConfig();
    config.setServletContext( context );
    config.setServletName( "getResource" );
    request.setContextPath( "pentaho" );
    GetResource servlet = new GetResource();
    servlet.init( config );
    // servlet.service(request, response);
  }
View Full Code Here

        assertTrue(it.next() instanceof MockModule2);
    }

    public void testServletCreateModules_Extra() throws Exception {

        MockServletConfig config = new MockServletConfig();
        String exra = String.format(
                "%s, \n%s",
                MockModule1.class.getName(),
                MockModule2.class.getName());
        config.setInitParameter(WebConfiguration.EXTRA_MODULES_PARAMETER, exra);

        WebConfiguration configuration = new WebConfiguration(config);

        Module m1 = new Module() {
View Full Code Here

        WebConfiguration configuration3 = new WebConfiguration(config3);
        assertEquals("a/b/c/cayenne-z.xml", configuration3.getConfigurationLocation());
    }

    public void testServletConfigurationLocation_Name() {
        MockServletConfig config1 = new MockServletConfig();
        config1.setServletName("cayenne-x");

        WebConfiguration configuration1 = new WebConfiguration(config1);
        assertEquals("cayenne-x.xml", configuration1.getConfigurationLocation());

        MockServletConfig config2 = new MockServletConfig();
        config2.setServletName("cayenne-y.xml");

        WebConfiguration configuration2 = new WebConfiguration(config2);
        assertEquals("cayenne-y.xml", configuration2.getConfigurationLocation());

        MockServletConfig config3 = new MockServletConfig();
        config3.setServletName("a/b/c/cayenne-z.xml");

        WebConfiguration configuration3 = new WebConfiguration(config3);
        assertEquals("a/b/c/cayenne-z.xml", configuration3.getConfigurationLocation());
    }
View Full Code Here

        WebConfiguration configuration1 = new WebConfiguration(config1);
        assertEquals("cayenne-y.xml", configuration1.getConfigurationLocation());
    }

    public void testServletConfigurationLocation_Parameter() {
        MockServletConfig config1 = new MockServletConfig();
        config1.setServletName("cayenne-x");
        config1.setInitParameter(
                WebConfiguration.CONFIGURATION_LOCATION_PARAMETER,
                "cayenne-y.xml");

        WebConfiguration configuration1 = new WebConfiguration(config1);
        assertEquals("cayenne-y.xml", configuration1.getConfigurationLocation());
View Full Code Here

public class ROPHessianServletTest extends TestCase {

    public void testInitWithServletName() throws Exception {

        MockServletConfig config = new MockServletConfig();
        config
                .setServletName("cayenne-org.apache.cayenne.configuration.rop.server.test-config");

        MockServletContext context = new MockServletContext();
        config.setServletContext(context);

        ROPHessianServlet servlet = new ROPHessianServlet();

        assertNull(WebUtil.getCayenneRuntime(context));
        servlet.init(config);
View Full Code Here

    }

    public void testInitWithLocation() throws Exception {

        String location = "cayenne-org.apache.cayenne.configuration.rop.server.test-config.xml";
        MockServletConfig config = new MockServletConfig();
        config.setServletName("abc");
        config.setInitParameter("configuration-location", location);

        MockServletContext context = new MockServletContext();
        config.setServletContext(context);

        ROPHessianServlet servlet = new ROPHessianServlet();
        servlet.init(config);

        CayenneRuntime runtime = WebUtil.getCayenneRuntime(context);
View Full Code Here

    public void testInitWithStandardModules() throws Exception {

        String name = "cayenne-org.apache.cayenne.configuration.rop.server.test-config";

        MockServletConfig config = new MockServletConfig();
        config.setServletName(name);

        MockServletContext context = new MockServletContext();
        config.setServletContext(context);

        ROPHessianServlet servlet = new ROPHessianServlet();
        servlet.init(config);

        CayenneRuntime runtime = WebUtil.getCayenneRuntime(context);
View Full Code Here

    public void testInitWithExtraModules() throws Exception {

        String name = "cayenne-org.apache.cayenne.configuration.rop.server.test-config";

        MockServletConfig config = new MockServletConfig();
        config.setServletName(name);
        config.setInitParameter("extra-modules", MockModule1.class.getName()
                + ","
                + MockModule2.class.getName());

        MockServletContext context = new MockServletContext();
        config.setServletContext(context);

        ROPHessianServlet servlet = new ROPHessianServlet();
        servlet.init(config);

        CayenneRuntime runtime = WebUtil.getCayenneRuntime(context);
View Full Code Here

        assertTrue(handler instanceof MockRequestHandler);
    }

    public void testInitHessianService() throws Exception {

        MockServletConfig config = new MockServletConfig();
        config.setServletName("abc");

        MockServletContext context = new MockServletContext();
        config.setServletContext(context);
        config.setInitParameter("extra-modules", ROPHessianServlet_ConfigModule.class
                .getName());

        ROPHessianServlet servlet = new ROPHessianServlet();

        servlet.init(config);
View Full Code Here

TOP

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

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.