mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gary Williams
21.01.2011 fe1afda3eb7651e04764aa0e120cc1715615c611
Improve xml dom parsing on testgroup, testsuite elements 
3 files modified
24 ■■■■■ changed files
opends/tests/staf-tests/shared/functions/environment.xml 2 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/utils.xml 10 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/python/common.py 12 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/environment.xml
@@ -125,6 +125,8 @@
        server.password   = DIRECTORY_INSTANCE_PSWD
        server.suffix     = DIRECTORY_INSTANCE_SFX
        server.backend    = DIRECTORY_INSTANCE_BE
        TestSuiteStartTime = STAXGlobal([])
      </script>
      <!-- Set the signal handlers -->
opends/tests/staf-tests/shared/functions/utils.xml
@@ -1039,9 +1039,8 @@
        testcaseStop=int(time.time())        
        testcaseDuration=testcaseStop-testcaseStart
        shortName=get_test_name(STAXCurrentTestcase)
        testgroup = results.getChildNodes().item(3)
        testsuite = testgroup.getChildNodes().item(1)
        testsuite = xml.getElementByAttributeName(qa,'testsuite',ThisSuiteName,'name')
        xml.testcase = repdoc.createElement("testcase")
        xml.createAttr(repdoc,xml.testcase,"name",STAXCurrentTestcase)
@@ -1135,9 +1134,8 @@
        repdoc = xml.parseXMLfile("%s/results_tmp.xml" % logs.reports)
        
        qa = repdoc.getDocumentElement()
        ft = qa.getChildNodes().item(1)
        results = ft.getChildNodes().item(3)
        testgroup = results.getChildNodes().item(3)
        testgroup = xml.getElementByAttributeName(qa,'testgroup',ThisGroupName,'name')
        
        #Create testsuite element
        xml.testsuite = repdoc.createElement("testsuite")
opends/tests/staf-tests/shared/python/common.py
@@ -715,7 +715,17 @@
      tag.setAttributeNode(newAttribute)
    except:
      print "exception: %s" % traceback.format_exception(*sys.exc_info())
  def getElementByAttributeName(self,root,tag,attr,val):
  
    element = root.getElementsByTagName(tag)
    i=0
    while i < element.getLength():
      if element.item(i).getAttribute(val) == attr:
        return element.item(i)
      i += 1
def xml_add_text_node(doc,parent,name,ntext):
  node = doc.createElement(name)
@@ -846,5 +856,3 @@
    import md5
    m = md5.new()
  return m