assertNotNull(dispatcherServlet);
}
public void testServlet() throws Exception {
GenericWebApplicationContext context = new GenericWebApplicationContext();
context.setServletContext(new AttributeServletContext());
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/web/spring/config/servletbeancontext.xml"));
context.refresh();
assertEquals("injectedValue", MyServlet1.getMyAttribute());
assertEquals("initValue", MyServlet2.getConfigParam());
Map<String,ServletFactoryBean> factoryBeans = context.getBeansOfType(ServletFactoryBean.class);
assertEquals(3, factoryBeans.size());
Map<String,HttpServlet> s = context.getBeansOfType(HttpServlet.class);
assertEquals(1, s.size());
Map<String,? extends ServletFactoryBean> beans = context.getBeansOfType(InternalFrameworkIntegrationServletFactoryBean.class);
assertEquals(1, beans.size());
InternalFrameworkIntegrationServletFactoryBean firstValue = (InternalFrameworkIntegrationServletFactoryBean) ObjectMapUtils.getFirstValue(beans);
assertEquals("delegator", firstValue.getServletName());
beans = context.getBeansOfType(ExtendedServletFactoryBean.class);
assertEquals(1, beans.size());
ExtendedServletFactoryBean extendedFactoryBean = (ExtendedServletFactoryBean) ObjectMapUtils.getFirstValue(beans);
assertEquals("extraValue", extendedFactoryBean.getExtraAttribute());