Example usage for org.apache.wicket.protocol.http.mock MockServletContext addInitParameter

List of usage examples for org.apache.wicket.protocol.http.mock MockServletContext addInitParameter

Introduction

In this page you can find the example usage for org.apache.wicket.protocol.http.mock MockServletContext addInitParameter.

Prototype

public void addInitParameter(final String name, final String value) 

Source Link

Document

Add an init parameter.

Usage

From source file:dk.frankbille.scoreboard.test.WicketSpringTestCase.java

License:Open Source License

@BeforeClass
public static void setupSpring() {
    if (applicationContext == null) {
        MockServletContext servletContext = new MockServletContext(new ScoreBoardApplication(),
                "src/main/webapp");
        servletContext.addInitParameter("contextConfigLocation", "classpath:applicationContext-test.xml");
        ContextLoader loader = new ContextLoader();
        applicationContext = loader.initWebApplicationContext(servletContext);
        WicketSpringTestCase.servletContext = servletContext;
    }/*from w w  w  .  jav  a 2s . c  o  m*/
}

From source file:org.hippoecm.frontend.plugin.config.impl.JcrConfigServiceFactoryTest.java

License:Apache License

@Test
public void testFirstApplicationIsUsedAsFallback() throws Exception {
    PluginTestApplication secondApp = new PluginTestApplication();
    MockServletContext servletContext = new MockServletContext(secondApp, null);
    servletContext.addInitParameter("config", "second-app");
    HippoTester second = new HippoTester(secondApp, servletContext);

    try {/*ww w  . j a  va  2  s.co m*/
        PluginPage home = (PluginPage) second.startPluginPage();
        JavaPluginConfig config = new JavaPluginConfig("dummy");
        config.put("plugin.class", DummyPlugin.class.getName());
        IPluginContext context = home.getPluginManager().start(config);
        IPluginConfigService pcs = context.getService(IPluginConfigService.class.getName(),
                IPluginConfigService.class);
        IClusterConfig cluster = pcs.getCluster("service");
        assertEquals(new JcrClusterConfig(new JcrNodeModel("/config/test-app/service")), cluster);
    } finally {
        second.destroy();
    }
}