use of com.mockrunner.mock.web.MockServletConfig in project cayenne by apache.
the class ROPServletTest method testInitHessianService.
@Test
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());
ROPServlet servlet = new ROPServlet();
servlet.init(config);
runtime = WebUtil.getCayenneRuntime(context);
Collection<Module> modules = runtime.getModules();
assertEquals(5, modules.size());
Object[] marray = modules.toArray();
assertTrue(marray[3] instanceof ROPHessianServlet_ConfigModule);
// TODO: mock servlet request to check that the right service instance
// is invoked
}
use of com.mockrunner.mock.web.MockServletConfig in project cayenne by apache.
the class WebConfigurationTest method testServletConfigurationLocation_Parameter.
@Test
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());
}
use of com.mockrunner.mock.web.MockServletConfig in project cayenne by apache.
the class WebConfigurationTest method testServletConfigurationLocation_Name.
@Test
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());
}
Aggregations