@Test
public void testRead21Version() throws IOException {

    URL configFile = this.getClass().getClassLoader().getResource(
            "org/apache/tiles/config/tiles-defs-2.1.xml");
    assertNotNull("Config file not found", configFile);
    InputStream source = configFile.openStream();
    Map<String, Definition> definitions = reader.read(source);
    assertNotNull("Definitions not returned.", definitions);
    Definition def = definitions.get("doc.cascaded.test");
    assertNotNull("Couldn't find doc.role.test tile.", def);
    Attribute attribute = def.getLocalAttribute("title");
    assertNotNull("Couldn't Find title local attribute.", attribute);
    attribute = def.getCascadedAttribute("title2");
    assertNotNull("Couldn't Find title2 cascaded attribute.", attribute);
    attribute = def.getLocalAttribute("items1");
    assertNotNull("Couldn't Find items1 local attribute.", attribute);
    attribute = def.getCascadedAttribute("items2");
    assertNotNull("Couldn't Find items2 cascaded attribute.", attribute);
    def = definitions.get("test.nesting.definitions");
    assertNotNull("Couldn't find test.nesting.definitions tile.", def);
    assertEquals("/layout.jsp", def.getTemplateAttribute().getValue());
    assertEquals("template", def.getTemplateAttribute().getRenderer());
    attribute = def.getAttribute("body");
    assertNotNull("Couldn't Find body attribute.", attribute);
    assertEquals("Attribute not of 'definition' type", "definition",
            attribute.getRenderer());
    assertNotNull("Attribute value null", attribute.getValue());
    String defName = attribute.getValue().toString();
    def = definitions.get(defName);
    assertNotNull("Couldn't find " + defName + " tile.", def);
    def = definitions.get("test.nesting.list.definitions");
    assertNotNull("Couldn't find test.nesting.list.definitions tile.",
            def);
    attribute = def.getAttribute("list");
    assertNotNull("Couldn't Find list attribute.", attribute);
    assertTrue("Attribute not of valid type",
            attribute instanceof ListAttribute);
    ListAttribute listAttribute = (ListAttribute) attribute;
    List<Attribute> list = listAttribute.getValue();
    assertEquals("The list is not of correct size", 1, list.size());
    attribute = list.get(0);
    assertNotNull("Couldn't Find element attribute.", attribute);
    assertEquals("Attribute not of 'definition' type", "definition",
            attribute.getRenderer());
    assertNotNull("Attribute value null", attribute.getValue());
    defName = attribute.getValue().toString();
    def = definitions.get(defName);
    assertNotNull("Couldn't find " + defName + " tile.", def);
    defName = "test.inherit.list.base";
    def = definitions.get(defName);
    assertNotNull("Couldn't find " + defName + " tile.", def);
    defName = "test.inherit.list";
    def = definitions.get(defName);
    assertNotNull("Couldn't find " + defName + " tile.", def);
    listAttribute = (ListAttribute) def.getAttribute("list");
    assertEquals("This definition does not inherit its list attribute",
            true, listAttribute.isInherit());
    defName = "test.noinherit.list";
    def = definitions.get(defName);
    listAttribute = (ListAttribute) def.getAttribute("list");
    assertEquals("This definition inherits its list attribute",
            false, listAttribute.isInherit());
    defName = "test.new.attributes";
    def = definitions.get(defName);
    assertNotNull("Couldn't find " + defName + " tile.", def);
    Attribute templateAttribute = def.getTemplateAttribute();
    assertEquals(templateAttribute.getExpressionObject().getExpression(),
            "${my.expression}");
    assertEquals("mytype", templateAttribute.getRenderer());
    attribute = def.getAttribute("body");
    assertNotNull("Couldn't Find body attribute.", attribute);
    assertEquals("${my.attribute.expression}", attribute
            .getExpressionObject().getExpression());
}