Package org.dom4j

Examples of org.dom4j.XPath.selectNodes()


   
    Document document = xmlReader.read(new File(getOutputDir(), "hibernate.cfg.xml"));
   
    // Validate the Generator and it has no arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-configuration/session-factory/mapping");
    Element[] elements = (Element[]) xpath.selectNodes(document).toArray(new Element[0]);
    assertEquals(2,elements.length);
   
    for (int i = 0; i < elements.length; i++) {
      Element element = elements[i];
      assertNotNull(element.attributeValue("resource"));
View Full Code Here


   
    Document document = xmlReader.read(new File(getOutputDir(), "hibernate.cfg.xml"));
   
    // Validate the Generator and it has no arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-configuration/session-factory/mapping");
    Element[] elements = (Element[]) xpath.selectNodes(document).toArray(new Element[0]);
    assertEquals(2, elements.length);
   
    for (int i = 0; i < elements.length; i++) {
      Element element = elements[i];
      assertNull(element.attributeValue("resource"));
View Full Code Here

    SAXReader xmlReader =  this.getSAXReader();
   
    Document document = xmlReader.read(new File(getOutputDir(), "org/hibernate/tool/hbm2x/Product.hbm.xml"));
   
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/version");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one version element", 1, list.size());     
  }
 
  protected String getBaseForMappings() {
    return "org/hibernate/tool/hbm2x/";
View Full Code Here

   
    Document document;
    try {
      document = xmlReader.read(outputXml);
      XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/idbag");
      List list = xpath.selectNodes(document);
      assertEquals("Expected to get one idbag element", 1, list.size());
      Element node = (Element) list.get(0);
      assertEquals(node.attribute( "table" ).getText(),"`UserGroups`");
      assertEquals(node.attribute( "name" ).getText(),"groups");
      assertEquals(node.attribute( "lazy" ).getText(),"false");
View Full Code Here

    SAXReader xmlReader =  this.getSAXReader();
   
    Document document = xmlReader.read(outputXml)
   
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/idbag/collection-id");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one collection-id element", 1, list.size());
    Element node = (Element) list.get(0);
    assertEquals(node.attribute( "column" ).getText(),"userGroupId");
    assertEquals(node.attribute( "type" ).getText(),"long");
 
View Full Code Here

    Document document;
    try {
        document = xmlReader.read(outputXml);
        XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class");
        List list = xpath.selectNodes(document);
        assertEquals("Expected to get one class element", 1, list.size());
        Element node = (Element) list.get(0);
        assertNotNull("Abstract attrinute was not exported.", node.attribute( "abstract" ));
        assertEquals(node.attribute( "abstract" ).getText(),"true");
      } catch (DocumentException e) {
View Full Code Here

    SAXReader xmlReader =  getSAXReader();

    Document document = xmlReader.read(outputXml);

    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one class element", 1, list.size());
    Element node = (Element) list.get(0);
    assertEquals(node.attribute( "proxy" ).getText(),"org.hibernate.tool.hbm2x.hbm2hbmxml.GlarchProxy");
  }
View Full Code Here

    SAXReader xmlReader =  getSAXReader();

    Document document = xmlReader.read(outputXml);

    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/dynamic-component");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one dynamic-component element", 1, list.size());
    Element node = (Element) list.get(0);
    assertEquals(node.attribute( "name" ).getText(),"dynaBean");

  }
View Full Code Here

    SAXReader xmlReader =  getSAXReader();

    Document document = xmlReader.read(outputXml);

    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/list");
    Element node = (Element) xpath.selectNodes(document).get(1); //second list
    List list = node.elements("composite-element");
    assertEquals("Expected to get one composite-element element", 1, list.size());
    node = (Element) list.get(0);
    assertEquals("Expected to get two property element", 2, node.elements("property").size());
View Full Code Here

    SAXReader xmlReader =  this.getSAXReader();

    Document document = xmlReader.read(outputXml);

    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/set/many-to-many");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one many-to-many element", 1, list.size());
    Element node = (Element) list.get(0);
    assertEquals(node.attribute( "entity-name" ).getText(),"org.hibernate.tool.hbm2x.hbm2hbmxml.Group");

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.