Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockServletContext.addInitParameter()


* To change this template use File | Settings | File Templates.
*/
public class SpringTapestryIntegrationTests extends TestCase {
    public void testSpringIntegration() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "classpath:org/springmodules/web/tapestry/applicationContext.xml");
        ContextLoader contextLoader = new ContextLoader();
        contextLoader.initWebApplicationContext(servletContext);

        MockServletConfig servletConfig = new MockServletConfig(servletContext, "servlet");
        ApplicationServlet servlet = new ApplicationServlet();
View Full Code Here


            File services = new File(testDataDir, "services.xml");
            if (!services.exists())
                throw new FileNotFoundException(services.getPath());

            ctx.addInitParameter("GEOSERVER_DATA_DIR", testDataDir.getAbsolutePath());
            ctx.addInitParameter("serviceStrategy", "PARTIAL-BUFFER2");

        } catch (IOException ex) {
            LOGGER.severe("Error in test files: " + ex.getMessage());
            throw new RuntimeException("Error in test files", ex);
View Full Code Here

            File services = new File(testDataDir, "services.xml");
            if (!services.exists())
                throw new FileNotFoundException(services.getPath());

            ctx.addInitParameter("GEOSERVER_DATA_DIR", testDataDir.getAbsolutePath());
            ctx.addInitParameter("serviceStrategy", "PARTIAL-BUFFER2");

        } catch (IOException ex) {
            LOGGER.severe("Error in test files: " + ex.getMessage());
            throw new RuntimeException("Error in test files", ex);
        }
View Full Code Here

    public HibGeoServerTestApplicationContext(String[] configLocation, String dataPath)
            throws BeansException {
        super(configLocation, false);

        MockServletContext ctx = new MockServletContext();
        ctx.addInitParameter("GEOSERVER_DATA_DIR", dataPath);
        ctx.addInitParameter("serviceStrategy", "PARTIAL-BUFFER2");

        this.servletContext = ctx;
    }
View Full Code Here

            throws BeansException {
        super(configLocation, false);

        MockServletContext ctx = new MockServletContext();
        ctx.addInitParameter("GEOSERVER_DATA_DIR", dataPath);
        ctx.addInitParameter("serviceStrategy", "PARTIAL-BUFFER2");

        this.servletContext = ctx;
    }

    public ServletContext getServletContext() {
View Full Code Here

    sb.append("com.tll.di.SmbizClientPersistModule\r\n");
    sb.append("com.tll.di.SmbizListingModule\r\n");
    sb.append("com.tll.di.SmbizAppModule\r\n");

    final MockServletContext context = new MockServletContext();
    context.addInitParameter(Bootstrapper.DEPENDENCY_MODULE_CLASS_NAMES, sb.toString());

    sb.setLength(0);
    sb.append("com.tll.server.rpc.entity.PersistContextBootstrapper\r\n");
    sb.append("com.tll.server.rpc.listing.ListingContextBootstrapper\r\n");
    if(employSecurity) sb.append("com.tll.server.SecurityContextBootstrapper\r\n");
View Full Code Here

    sb.setLength(0);
    sb.append("com.tll.server.rpc.entity.PersistContextBootstrapper\r\n");
    sb.append("com.tll.server.rpc.listing.ListingContextBootstrapper\r\n");
    if(employSecurity) sb.append("com.tll.server.SecurityContextBootstrapper\r\n");
    sb.append("com.tll.server.AppContextBootstrapper\r\n");
    context.addInitParameter(Bootstrapper.DEPENDENCY_HANDLER_CLASS_NAMES, sb.toString());

    return context;
  }

  @Test
View Full Code Here

    CountingMockExpressionEvaluator eval = (CountingMockExpressionEvaluator) ctx.getExpressionEvaluator();
    ctx.setAttribute("bla", "blie");
    ctx.setAttribute("blo", "blue");

    MockServletContext sc = (MockServletContext) ctx.getServletContext();
    sc.addInitParameter(ExpressionEvaluationUtils.EXPRESSION_CACHE_CONTEXT_PARAM, "true");

    assertEquals("blie", ExpressionEvaluationUtils.evaluate("test", "${bla}", String.class, ctx));
    assertEquals(1, eval.parseExpressionCount);

    assertEquals("blue", ExpressionEvaluationUtils.evaluate("test", "${blo}", String.class, ctx));
View Full Code Here

    CountingMockExpressionEvaluator eval = (CountingMockExpressionEvaluator) ctx.getExpressionEvaluator();
    ctx.setAttribute("bla", "blie");
    ctx.setAttribute("blo", "blue");

    MockServletContext sc = (MockServletContext) ctx.getServletContext();
    sc.addInitParameter(ExpressionEvaluationUtils.EXPRESSION_CACHE_CONTEXT_PARAM, "true");

    String expr = "text${bla}text${blo}text";
    Object o = ExpressionEvaluationUtils.evaluate("test", expr, String.class, ctx);
    assertEquals("textblietextbluetext", o);
    assertEquals(2, eval.parseExpressionCount);
View Full Code Here

    doTestInitLogging(url.toString(), true);
  }

  private void doTestInitLogging(String location, boolean refreshInterval) {
    MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
    sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, location);
    if (refreshInterval) {
      sc.addInitParameter(Log4jWebConfigurer.REFRESH_INTERVAL_PARAM, "10");
    }
    Log4jWebConfigurer.initLogging(sc);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.