Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockServletConfig


            new TestWebapplicationContext( applicationContext, mockServletContext );

        mockServletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                                         webApplicationContext );

        MockServletConfig mockServletConfig = new MockServletConfig()
        {
            @Override
            public ServletContext getServletContext()
            {
                return mockServletContext;
View Full Code Here


        MockHttpServletRequest request = (MockHttpServletRequest)webRequest.getCurrentRequest();
        request.setMethod("GET");
        request.setRequestURI("orders/list");
        ServletContext context = webRequest.getServletContext();
        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Test title</title><meta name=\"layout\" content=\"test\"></meta></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
View Full Code Here

        request.setRequestURI("/");

        ServletContext context = webRequest.getServletContext();

        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Foo title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
View Full Code Here

                "def actionUri = '/foo/fooAction'\n" +
        "}").newInstance();

        request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);
        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Foo title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
View Full Code Here

                    "def actionUri = '/foo/fooAction'\n" +
            "}").newInstance();

            request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);
            GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
            Config c = new Config(new MockServletConfig(context));
            m.init(c, null, null);
            HTMLPageParser parser = new HTMLPageParser();
            String html = "<html><head><title>Foo title</title></head><body>here is the body</body></html>";

            Page page = parser.parse(html.toCharArray());
View Full Code Here

                "def actionUri = '/test/testAction'\n" +
        "}").newInstance();

        request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);
        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Test title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
View Full Code Here

                "def controllerName = 'test2'\n" +
                "def actionUri = '/test2/testAction'\n" +
        "}").newInstance();

        request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Test title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
View Full Code Here

                "static layout = 'mylayout'\n" +
        "}").newInstance();

        request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);
        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Test title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
View Full Code Here

        super.setUp();

        servlet =
            (HttpServlet)Class.forName("org.apache.wink.server.internal.servlet.RestServlet")
                .newInstance();
        MockServletConfig servletConfig = new MockServletConfig();
        servletConfig.addInitParameter("javax.ws.rs.Application", getApplicationClassName());

        String propertiesFile = getPropertiesFile();
        if (propertiesFile != null) {
            servletConfig.addInitParameter("propertiesLocation", propertiesFile);
        }

        String deploymentConfigClass = getDeploymentConfigurationClassName();
        if (deploymentConfigClass != null) {
            servletConfig.addInitParameter("deploymentConfiguration", deploymentConfigClass);
        }

        tls.set(this);
        servlet.init(servletConfig);
    }
View Full Code Here

    mockBundleWiring();

    when(
      _servlet.getServletConfig()
    ).thenReturn(
      new MockServletConfig(servletName)
    );

    _bundleServletContext.registerServlet(
      servletName, Arrays.asList(urlPatterns), _servlet, null,
      _httpContext);
View Full Code Here

TOP

Related Classes of org.springframework.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.