Package org.apache.tiles.definition.digester

Examples of org.apache.tiles.definition.digester.DigesterDefinitionsReader$FillAttributeRule


      return dao;
    }

    @Override
    protected DefinitionsReader createDefinitionsReader(ApplicationContext context) {
      DigesterDefinitionsReader reader = (DigesterDefinitionsReader) super.createDefinitionsReader(context);
      reader.setValidating(validateDefinitions);
      return reader;
    }
View Full Code Here


    /**
     * Tests the read method under normal conditions.
     */
    public void testRead() {
        try {
            DefinitionsReader reader = new DigesterDefinitionsReader();
            reader.init(new HashMap());
           
            URL configFile = this.getClass().getClassLoader().getResource(
                    "org/apache/tiles/config/tiles-defs.xml");
            assertNotNull("Config file not found", configFile);
           
            InputStream source = configFile.openStream();
            Map definitions = reader.read(source);
           
            assertNotNull("Definitions not returned.", definitions);
            assertNotNull("Couldn't find doc.mainLayout tile.",
                    (ComponentDefinition) definitions.get("doc.mainLayout"));
            assertNotNull("Couldn't Find title attribute.",
View Full Code Here

    /**
     * Tests calling read without calling init.
     */
    public void testNoInit() {
        try {
            DefinitionsReader reader = new DigesterDefinitionsReader();
           
            // What happens if we don't call init?
            // reader.init(new HashMap());
           
            URL configFile = this.getClass().getClassLoader().getResource(
                    "org/apache/tiles/config/tiles-defs.xml");
            assertNotNull("Config file not found", configFile);
           
            InputStream source = configFile.openStream();
            Map definitions = reader.read(source);
           
            fail("Should've thrown exception.");
        } catch (DefinitionsFactoryException e) {
            // correct.
        } catch (Exception e) {
View Full Code Here

     * Tests read with bad input source.
     */
    public void testBadSource() {
        try {
            // Create Digester Reader.
            DefinitionsReader reader = new DigesterDefinitionsReader();
            Map params = new HashMap();

            // Initialize reader.
            reader.init(params);

            // Read definitions.
            Map definitions = reader.read(new String("Bad Input"));
            fail("Should've thrown an exception.");
        } catch (DefinitionsFactoryException e) {
            // correct.
        } catch (Exception e) {
            fail("Exception reading configuration." + e);
View Full Code Here

    /**
     * Tests read with bad XML source.
     */
    public void testBadXml() {
        try {
            DefinitionsReader reader = new DigesterDefinitionsReader();
            reader.init(new HashMap());
           
            URL configFile = this.getClass().getClassLoader().getResource(
                    "org/apache/tiles/config/malformed-defs.xml");
            assertNotNull("Config file not found", configFile);
           
            InputStream source = configFile.openStream();
            Map definitions = reader.read(source);
            fail("Should've thrown an exception.");
        } catch (DefinitionsFactoryException e) {
            // correct.
        } catch (Exception e) {
            fail("Exception reading configuration." + e);
View Full Code Here

            params.get(DefinitionsFactory.READER_IMPL_PROPERTY);

        if (readerClassName != null) {
            reader = (DefinitionsReader) ClassUtil.instantiate(readerClassName);
        } else {
            reader = new DigesterDefinitionsReader();
        }
        reader.init(params);
    }
View Full Code Here

                .get(DefinitionsFactory.READER_IMPL_PROPERTY);

        if (readerClassName != null) {
            reader = (DefinitionsReader) ClassUtil.instantiate(readerClassName);
        } else {
            reader = new DigesterDefinitionsReader();
        }
        reader.init(params);
    }
View Full Code Here

                .getResource("org/apache/tiles/config/defs-wildcard.xml"))
                .andReturn(url);
        EasyMock.replay(applicationContext);
        ((TilesApplicationContextAware) definitionDao)
                .setApplicationContext(applicationContext);
        definitionDao.setReader(new DigesterDefinitionsReader());

        Definition definition = definitionDao.getDefinition("test.defName.subLayered", Locale.ITALY);
        assertEquals("The template is not correct", "/testName.jsp", definition
                .getTemplateAttribute().getValue());
        assertEquals("The header attribute is not correct",
View Full Code Here

        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(
                "test.inherit.list", Locale.ITALIAN);
        ListAttribute listAttribute = (ListAttribute) definition
View Full Code Here

                .getResource("org/apache/tiles/config/defs-wildcard.xml"))
                .andReturn(url);
        EasyMock.replay(applicationContext);
        ((TilesApplicationContextAware) definitionDao)
                .setApplicationContext(applicationContext);
        definitionDao.setReader(new DigesterDefinitionsReader());

        Definition definition = definitionDao.getDefinition("test.defName.subLayered", Locale.ITALY);
        assertEquals("The template is not correct", "/testName.jsp", definition
                .getTemplateAttribute().getValue());
        assertEquals("The header attribute is not correct",
View Full Code Here

TOP

Related Classes of org.apache.tiles.definition.digester.DigesterDefinitionsReader$FillAttributeRule

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.