Package org.apache.tiles.definition

Examples of org.apache.tiles.definition.DefinitionsReader


    /**
     * Tests {@link LocaleUrlDefinitionDAO#setReader(DefinitionsReader)}.
     */
    public void testSetReader() {
        DefinitionsReader reader = EasyMock.createMock(DefinitionsReader.class);
        definitionDao.setReader(reader);
        assertEquals("There reader has not been set correctly", reader,
                definitionDao.reader);
    }
View Full Code Here


    public void testCreateDefinitionsReader() {
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        DefinitionsReader reader = factory.createDefinitionsReader(context,
                applicationContext, contextFactory);
        assertTrue("The class of the reader is not correct",
                reader instanceof DigesterDefinitionsReader);
    }
View Full Code Here

        List<ApplicationResource> sourceURLs = new ArrayList<ApplicationResource>();
        sourceURLs.add(url1);
        sourceURLs.add(url2);
        sourceURLs.add(url3);
        definitionDao.setSources(sourceURLs);
        DefinitionsReader reader = new DigesterDefinitionsReader();
        definitionDao.setReader(reader);

        assertNotNull("test.def1 definition not found.", definitionDao.getDefinition("test.def1", null));
        assertNotNull("test.def2 definition not found.", definitionDao.getDefinition("test.def2", null));
        assertNotNull("test.def3 definition not found.", definitionDao.getDefinition("test.def3", null));
View Full Code Here

        List<ApplicationResource> sourceURLs = new ArrayList<ApplicationResource>();
        sourceURLs.add(url1);
        sourceURLs.add(url2);
        sourceURLs.add(url3);
        definitionDao.setSources(sourceURLs);
        DefinitionsReader reader = new DigesterDefinitionsReader();
        definitionDao.setReader(reader);

        Map<String, Definition> defaultDefinitions = definitionDao.getDefinitions(null);
        Map<String, Definition> usDefinitions = definitionDao.getDefinitions(Locale.US);
        Map<String, Definition> frenchDefinitions = definitionDao.getDefinitions(Locale.FRENCH);
View Full Code Here

    /**
     * Tests {@link LocaleUrlDefinitionDAO#setReader(DefinitionsReader)}.
     */
    @Test
    public void testSetReader() {
        DefinitionsReader reader = createMock(DefinitionsReader.class);
        definitionDao.setReader(reader);
        assertEquals("There reader has not been set correctly", reader, definitionDao.reader);
    }
View Full Code Here

        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        Set<ApplicationResource> urlSet = new HashSet<ApplicationResource>();
        urlSet.add(url1);
        expect(applicationContext.getResources("/WEB-INF/tiles.xml")).andReturn(urlSet);
        replay(applicationContext);
        DefinitionsReader reader = new DigesterDefinitionsReader();
        definitionDao.setReader(reader);
        List<ApplicationResource> sourceURLs = new ArrayList<ApplicationResource>();
        sourceURLs.add(url1);
        definitionDao.setSources(sourceURLs);
        assertEquals("The reader is not of the correct class", DigesterDefinitionsReader.class,
View Full Code Here

        replay(dao);

        List<ApplicationResource> sources = new ArrayList<ApplicationResource>();
        sources.add(resource);
        dao.setSources(sources);
        DefinitionsReader reader = new DigesterDefinitionsReader();
        dao.setReader(reader);

        Request context = createMock(Request.class);
        expect(context.getContext("session")).andReturn(new HashMap<String, Object>()).anyTimes();
        expect(context.getRequestLocale()).andReturn(null).anyTimes();
View Full Code Here

    @Test
    public void testLoadDefinitionsFromURLFileNotFound() throws MalformedURLException {
        URLApplicationResource resource = new URLApplicationResource("/hello/there.txt", new URL(
                "file:///hello/there.txt"));
        replay(dao);
        DefinitionsReader reader = createMock(DefinitionsReader.class);
        replay(reader);

        dao.setReader(reader);
        assertNull(dao.loadDefinitionsFromResource(resource));
        verify(dao, reader);
View Full Code Here

        List<ApplicationResource> sourceURLs = new ArrayList<ApplicationResource>();
        sourceURLs.add(url1);
        sourceURLs.add(url2);
        sourceURLs.add(url3);
        definitionDao.setSources(sourceURLs);
        DefinitionsReader reader = new DigesterDefinitionsReader();
        definitionDao.setReader(reader);
        assertNotNull("test.def1 definition not found.", definitionDao.getDefinition("test.def1", null));
        assertNotNull("test.def2 definition not found.", definitionDao.getDefinition("test.def2", null));
        assertNotNull("test.def3 definition not found.", definitionDao.getDefinition("test.def3", null));
        assertNotNull("test.common definition not found.", definitionDao.getDefinition("test.common", null));
View Full Code Here

        List<ApplicationResource> sourceURLs = new ArrayList<ApplicationResource>();
        sourceURLs.add(url1);
        sourceURLs.add(url2);
        sourceURLs.add(url3);
        definitionDao.setSources(sourceURLs);
        DefinitionsReader reader = new DigesterDefinitionsReader();
        definitionDao.setReader(reader);

        Map<String, Definition> defaultDefinitions = definitionDao.getDefinitions(null);
        Map<String, Definition> usDefinitions = definitionDao.getDefinitions(Locale.US);
        Map<String, Definition> frenchDefinitions = definitionDao.getDefinitions(Locale.FRENCH);
View Full Code Here

TOP

Related Classes of org.apache.tiles.definition.DefinitionsReader

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.