Package org.springframework.web.context.support

Examples of org.springframework.web.context.support.GenericWebApplicationContext


        verifyMocks();
    }
   
    public void testInit() throws Exception {

        final GenericWebApplicationContext genericWebApplicationContext = new GenericWebApplicationContext();
       
        BaseExternalModuleServlet servlet = getServlet(genericWebApplicationContext);
       
        doInitWebapplicationContextTest(genericWebApplicationContext, servlet);
        assertTrue(servlet.getInvoker() instanceof ReadWriteLockingInvoker);
View Full Code Here


        assertTrue(servlet.getInvoker() instanceof ReadWriteLockingInvoker);
    }
   
    public void testInitWithClassLoader() throws Exception {

        final GenericWebApplicationContext genericWebApplicationContext = new GenericWebApplicationContext();
       
        BaseExternalModuleServlet servlet = getServlet(genericWebApplicationContext);
        servlet.setSetThreadContextClassLoader(true);
       
        doInitWebapplicationContextTest(genericWebApplicationContext, servlet);
View Full Code Here

import org.springframework.web.context.support.GenericWebApplicationContext;

public class ContextListenerBeanDefinitionParserTest extends TestCase {

    public void testParser() {
        GenericWebApplicationContext context = new GenericWebApplicationContext();
        context.setServletContext(new AttributeServletContext());
       
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
        reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/web/spring/config/listenerbeancontext.xml"));
       
        context.refresh();
       
        TestContextListener listener = (TestContextListener) context.getBean("listener");
        assertTrue(listener.isInitialized());
        assertFalse(listener.isDestroyed());
       
        context.close();
        assertTrue(listener.isDestroyed());
    }
View Full Code Here

                    HttpServletResponse resp) throws ServletException,
                    IOException {
                b.set(true);
            }
        };
        final GenericWebApplicationContext ac = new GenericWebApplicationContext();
        ac.setClassLoader(ClassUtils.getDefaultClassLoader());
        servlet.setApplicationContext(ac);
       
        servlet.setInvoker();
       
        servlet.service(createMock(HttpServletRequest.class), createMock(HttpServletResponse.class));
View Full Code Here

public class FilterBeanDefinitionParserTest extends TestCase {

    public void testFilter() throws Exception {
       
        GenericWebApplicationContext context = new GenericWebApplicationContext();
        context.setServletContext(new AttributeServletContext());
       
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
        reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/web/spring/config/filterbeancontext.xml"));
       
        context.refresh();
       
        assertEquals("initValue", MyFilter2.getConfigParam());
       
        Map<String, FilterFactoryBean> factoryBeans = context.getBeansOfType(FilterFactoryBean.class);
        assertEquals(3, factoryBeans.size());
       
        Map<String, Filter> s = context.getBeansOfType(Filter.class);
        assertEquals(3, s.size());
       
        Map<String, ? extends FilterFactoryBean> beans = context.getBeansOfType(InternalFrameworkIntegrationFilterFactoryBean.class);
        assertEquals(1, beans.size());
       
        InternalFrameworkIntegrationFilterFactoryBean firstValue = (InternalFrameworkIntegrationFilterFactoryBean) ObjectMapUtils.getFirstValue(beans);
        assertEquals("delegator", firstValue.getFilterName());

        beans = context.getBeansOfType(ExtendedFilterFactoryBean.class);
        assertEquals(1, beans.size());
       
        ExtendedFilterFactoryBean extendedFactoryBean = (ExtendedFilterFactoryBean) ObjectMapUtils.getFirstValue(beans);
        assertEquals("extraValue", extendedFactoryBean.getExtraAttribute());
       
View Full Code Here

                return locations;
            }
           
        };

        final GenericWebApplicationContext parent = newContext(false);
        WebApplicationContext context = loader.createWebApplicationContext(servletContext, parent);
       
        assertNotNull(context);
        assertTrue(context instanceof XmlWebApplicationContext);
       
View Full Code Here

            public String[] getBootstrapContextLocations(ServletContext servletContext) {
                return locations;
            }
           
        };
        final GenericWebApplicationContext parent = newContext(true);
       
        ConfigurableApplicationContext context = loader.initImpalaApplicationContext(servletContext, parent);
       
        assertNotNull(context);
        assertTrue(context instanceof GenericWebApplicationContext);
View Full Code Here

        verify(servletContext);
    }


    private GenericWebApplicationContext newContext(boolean refresh) {
        final GenericWebApplicationContext value = new GenericWebApplicationContext();
        if (refresh) {
          value.refresh();
        }
        return value;
    }
View Full Code Here

            public String[] getBootstrapContextLocations(ServletContext servletContext) {
                return locations;
            }
           
        };
        final GenericWebApplicationContext parent = newContext(true);
       
        ConfigurableApplicationContext context = loader.initImpalaApplicationContext(servletContext, parent);
       
        assertNotNull(context);
        assertTrue(context instanceof GenericWebApplicationContext);
View Full Code Here

    protected ModuleManagementFacade createModuleManagementFacade(ServletContext servletContext) {
        String[] locations = getBootstrapContextLocations(servletContext);
        logger.info("Loading bootstrap context from locations " + Arrays.toString(locations));

        final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        final GenericWebApplicationContext applicationContext = new GenericWebApplicationContext(beanFactory);
        applicationContext.setServletContext(servletContext);

        XmlBeanDefinitionReader definitionReader = new XmlBeanDefinitionReader(beanFactory);
        for (int i = 0; i < locations.length; i++) {
            definitionReader.loadBeanDefinitions(new ClassPathResource(locations[i]));
        }
        applicationContext.refresh();

        return ObjectUtils.cast(applicationContext.getBean("moduleManagementFacade"), ModuleManagementFacade.class);
    }
View Full Code Here

TOP

Related Classes of org.springframework.web.context.support.GenericWebApplicationContext

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.