Package org.apache.tiles

Examples of org.apache.tiles.TilesApplicationContext


                "org/apache/tiles/config/defs1.xml");
        URL url2 = this.getClass().getClassLoader().getResource(
                "org/apache/tiles/config/defs2.xml");
        URL url3 = this.getClass().getClassLoader().getResource(
                "org/apache/tiles/config/defs3.xml");
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        Set<URL> urlSet = new HashSet<URL>();
        urlSet.add(url1);
        EasyMock.expect(
                applicationContext
                        .getResources("/WEB-INF/tiles.xml"))
                .andReturn(urlSet);
        EasyMock.replay(applicationContext);
        Map<String, String> params = new HashMap<String, String>();
        definitionDao.setApplicationContext(applicationContext);
        definitionDao.init(params);
        assertEquals("The reader is not of the correct class",
                DigesterDefinitionsReader.class, definitionDao.reader
                        .getClass());
        List<URL> sourceURLs = new ArrayList<URL>();
        sourceURLs.add(url1);
        assertEquals("The source URLs are not correct", sourceURLs,
                definitionDao.sourceURLs);
        EasyMock.reset(applicationContext);

        applicationContext = EasyMock.createMock(TilesApplicationContext.class);
        urlSet = new HashSet<URL>();
        urlSet.add(url1);
        EasyMock.expect(
                applicationContext
                        .getResources("org/apache/tiles/config/defs1.xml"))
                .andReturn(urlSet);
        urlSet = new HashSet<URL>();
        urlSet.add(url2);
        EasyMock.expect(
                applicationContext
                        .getResources("org/apache/tiles/config/defs2.xml"))
                .andReturn(urlSet);
        urlSet = new HashSet<URL>();
        urlSet.add(url3);
        EasyMock.expect(
                applicationContext
                        .getResources("org/apache/tiles/config/defs3.xml"))
                .andReturn(urlSet);
        EasyMock.replay(applicationContext);
        params.clear();
        params.put(DefinitionsFactory.READER_IMPL_PROPERTY,
View Full Code Here


                "org/apache/tiles/config/defs2.xml");
        URL url3 = this.getClass().getClassLoader().getResource(
                "org/apache/tiles/config/defs3.xml");
        URL url4 = this.getClass().getClassLoader().getResource(
                "org/apache/tiles/config/defs1_en_US.xml");
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        Set<URL> urlSet = new HashSet<URL>();
        urlSet.add(url1);
        EasyMock.expect(
                applicationContext
                        .getResources("org/apache/tiles/config/defs1.xml"))
                .andReturn(urlSet);
        urlSet = new HashSet<URL>();
        urlSet.add(url2);
        EasyMock.expect(
                applicationContext
                        .getResources("org/apache/tiles/config/defs2.xml"))
                .andReturn(urlSet);
        urlSet = new HashSet<URL>();
        urlSet.add(url3);
        EasyMock.expect(
                applicationContext
                        .getResources("org/apache/tiles/config/defs3.xml"))
                .andReturn(urlSet);
        urlSet = new HashSet<URL>();
        urlSet.add(url4);
        EasyMock.expect(
                applicationContext
                        .getResources("org/apache/tiles/config/defs1_en_US.xml"))
                .andReturn(urlSet);
        EasyMock.replay(applicationContext);
        Map<String, String> params = new HashMap<String, String>();
        params.put(DefinitionsFactory.DEFINITIONS_CONFIG,
View Full Code Here

            urlPath = "file:" + url.getPath();
        } else {
            urlPath = "file:/" + url.getPath();
        }

        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        Set<URL> urlSet = new HashSet<URL>();
        urlSet.add(url);
        EasyMock.expect(applicationContext.getResources(urlPath)).andReturn(
                urlSet);
        EasyMock.replay(applicationContext);
        ((TilesApplicationContextAware) definitionDao)
                .setApplicationContext(applicationContext);
View Full Code Here

     */
    public void testWildcardMapping() throws IOException {
        URL url = this.getClass().getClassLoader().getResource(
                "org/apache/tiles/config/defs-wildcard.xml");
        definitionDao.addSourceURL(url);
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        EasyMock.expect(applicationContext
                .getResource("org/apache/tiles/config/defs-wildcard.xml"))
                .andReturn(url);
        EasyMock.replay(applicationContext);
        ((TilesApplicationContextAware) definitionDao)
                .setApplicationContext(applicationContext);
View Full Code Here

    @SuppressWarnings("unchecked")
    public void testListAttributeLocaleInheritance() throws IOException {
        URL url = this.getClass().getClassLoader().getResource(
                "org/apache/tiles/config/tiles-defs-2.1.xml");
        definitionDao.addSourceURL(url);
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        definitionDao.setReader(new DigesterDefinitionsReader());
        EasyMock.replay(applicationContext);
       
        Definition definition = definitionDao.getDefinition(
View Full Code Here

        PreparerFactory prepFactory =
            (PreparerFactory) createFactory(configuration,
                PREPARER_FACTORY_INIT_PARAM);

        contextFactory.init(configuration);
        TilesApplicationContext tilesContext =
            contextFactory.createApplicationContext(context);

        container.setDefinitionsFactory(defsFactory);
        container.setContextFactory(contextFactory);
        container.setPreparerFactory(prepFactory);
View Full Code Here

public class EnhancedContextFactory extends ChainedTilesContextFactory {

    /** {@inheritDoc} */
    @Override
    public TilesApplicationContext createApplicationContext(Object context) {
        TilesApplicationContext root = super.createApplicationContext(context);
        return new EnhancedTilesApplicationContext(root);
    }
View Full Code Here

        factoryList.toArray(factories);
    }

    /** {@inheritDoc} */
    public TilesApplicationContext createApplicationContext(Object context) {
        TilesApplicationContext retValue = null;

        for (int i = 0; i < factories.length && retValue == null; i++) {
            retValue = factories[i].createApplicationContext(context);
        }

View Full Code Here

        PreparerFactory prepFactory =
            (PreparerFactory) createFactory(configuration,
                PREPARER_FACTORY_INIT_PARAM);

        contextFactory.init(configuration);
        TilesApplicationContext tilesContext =
            contextFactory.createApplicationContext(context);

        container.setDefinitionsFactory(defsFactory);
        container.setContextFactory(contextFactory);
        container.setPreparerFactory(prepFactory);
View Full Code Here

        for (Map.Entry<String, String> entry : initParameters.entrySet()) {
            context.setInitParameter(entry.getKey(), entry.getValue());
        }

        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                context);
        AbstractTilesApplicationContextFactory acFactory = AbstractTilesApplicationContextFactory
                .createFactory(applicationContext);
        applicationContext = acFactory.createApplicationContext(context);
View Full Code Here

TOP

Related Classes of org.apache.tiles.TilesApplicationContext

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.