Prepare functional tests for upgrade to stax351 based on jython 2.5.2
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Copyright 2007-2009 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2011 ForgeRock AS. |
| | | ! --> |
| | | <stax> |
| | | |
| | |
| | | <iterate var="dummyIndex" in="componentList"> |
| | | <sequence> |
| | | <script> |
| | | dsconfig_subcommand = componentList[componentNumber][0].strip() |
| | | dsconfig_component1 = componentList[componentNumber][1].strip() |
| | | dsconfig_component2 = componentList[componentNumber][2].strip() |
| | | dsconfig_component3 = componentList[componentNumber][3].strip() |
| | | dsconfig_component4 = componentList[componentNumber][4].strip() |
| | | # avoid same testName by incrementing the number |
| | | thisTestname = "%s.%s, %s" % (i,componentList[componentNumber][0],componentList[componentNumber][2]) |
| | | thisTestname = "%s.%s, %s" \ |
| | | % (i,dsconfig_subcommand,dsconfig_component1) |
| | | i+=1 |
| | | </script> |
| | | <message>'TRACE %s' % thisTestname</message> |
| | |
| | | <sequence> |
| | | <call function="'testCase_Preamble'" /> |
| | | <message> |
| | | 'Getting component %s, %s, %s, %s, %s' % (componentList[componentNumber][0], componentList[componentNumber][1], componentList[componentNumber][2], componentList[componentNumber][3], componentList[componentNumber][4]) |
| | | 'Getting component %s, %s, %s, %s, %s' \ |
| | | % (dsconfig_subcommand, componentList[componentNumber][1], componentList[componentNumber][2], componentList[componentNumber][3], componentList[componentNumber][4]) |
| | | </message> |
| | | |
| | | <if expr="componentList[componentNumber][0] == 'get-local-db-index-prop'"> |
| | |
| | | 'dsInstanceHost' : server.host , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'subcommand' : '%s' % componentList[componentNumber][0] , |
| | | 'objectType' : '%s' % componentList[componentNumber][1] , |
| | | 'objectName' : '%s' % componentList[componentNumber][2] , |
| | | 'subcommand' : '%s' % dsconfig_subcommand , |
| | | 'objectType' : '%s' % dsconfig_component1 , |
| | | 'objectName' : '%s' % dsconfig_component2 , |
| | | 'optionsString' : '--backend-name %s' % DIRECTORY_INSTANCE_BE , |
| | | 'expectedRC' : 0 |
| | | } |
| | |
| | | 'dsInstanceHost' : server.host , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'subcommand' : '%s' % componentList[componentNumber][0] , |
| | | 'objectType' : '%s' % componentList[componentNumber][1] , |
| | | 'objectName' : '%s' % componentList[componentNumber][2] , |
| | | 'subcommand' : '%s' % dsconfig_subcommand , |
| | | 'objectType' : '%s' % dsconfig_component1 , |
| | | 'objectName' : '%s' % dsconfig_component2 , |
| | | 'expectedRC' : 0 |
| | | } |
| | | </call> |
| | |
| | | |
| | | <call function="'searchStringForSubstring'"> |
| | | { 'returnString' : returnString , |
| | | 'testString' : componentList[componentNumber][3] , |
| | | 'testString' : dsconfig_component3 , |
| | | 'expectedResult' : '1' } |
| | | </call> |
| | | |
| | | <call function="'checktestString'"> |
| | | { 'returnString' : returnString , |
| | | 'expectedString' : componentList[componentNumber][4] } |
| | | 'expectedString' : dsconfig_component4 } |
| | | </call> |
| | | |
| | | </sequence> |
| | |
| | | <iterate var="dummyIndex" in="componentList"> |
| | | <sequence> |
| | | <script> |
| | | thisTestname = componentList[componentNumber][0] |
| | | thisTestname = componentList[componentNumber][0].strip() |
| | | dsconfig_subcommand = componentList[componentNumber][0].strip() |
| | | dsconfig_component1 = componentList[componentNumber][1].strip() |
| | | dsconfig_component2 = componentList[componentNumber][2].strip() |
| | | </script> |
| | | <testcase name="getTestCaseName(thisTestname)" > |
| | | <try> |
| | |
| | | <sequence> |
| | | <call function="'testCase_Preamble'" /> |
| | | <message> |
| | | 'Getting component %s, %s, %s' % (componentList[componentNumber][0], componentList[componentNumber][1], componentList[componentNumber][2]) |
| | | 'Getting component %s, %s, %s' \ |
| | | % (dsconfig_subcommand, dsconfig_component1, dsconfig_component2) |
| | | </message> |
| | | |
| | | <call function="'dsconfig'"> |
| | |
| | | 'dsInstanceHost' : server.host , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'subcommand' : '%s' % componentList[componentNumber][0] , |
| | | 'subcommand' : '%s' % dsconfig_subcommand , |
| | | 'expectedRC' : 0 |
| | | } |
| | | </call> |
| | |
| | | |
| | | <call function="'searchStringForSubstring'"> |
| | | { 'returnString' : returnString , |
| | | 'testString' : componentList[componentNumber][1] , |
| | | 'testString' : dsconfig_component1 , |
| | | 'expectedResult' : '1' } |
| | | </call> |
| | | |
| | | <if expr="dsconfig_component2 != ''"> |
| | | <call function="'checktestString'"> |
| | | { 'returnString' : returnString , |
| | | 'expectedString' : componentList[componentNumber][2] } |
| | | 'expectedString' : dsconfig_component2 } |
| | | </call> |
| | | </if> |
| | | |
| | | </sequence> |
| | | |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Copyright 2007-2009 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2011 ForgeRock AS. |
| | | ! --> |
| | | <stax> |
| | | |
| | |
| | | |
| | | <sequence> |
| | | |
| | | <script> |
| | | dsconfig_subcommand = componentList[componentNumber][0].strip() |
| | | dsconfig_component1 = componentList[componentNumber][1].strip() |
| | | dsconfig_component2 = componentList[componentNumber][2].strip() |
| | | </script> |
| | | |
| | | <testcase name="getTestCaseName(componentList[componentNumber][0])" > |
| | | |
| | | <try> |
| | |
| | | <sequence> |
| | | <call function="'testCase_Preamble'" /> |
| | | <message> |
| | | 'Listing component %s, %s, %s' % (componentList[componentNumber][0], componentList[componentNumber][1], componentList[componentNumber][2]) |
| | | 'Listing component %s, %s, %s' \ |
| | | % (dsconfig_subcommand, dsconfig_component1, dsconfig_component2) |
| | | </message> |
| | | |
| | | <if expr="componentList[componentNumber][0] == 'list-local-db-indexes'"> |
| | |
| | | 'dsInstanceHost' : server.host , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'subcommand' : '%s' % componentList[componentNumber][0] , |
| | | 'subcommand' : '%s' % dsconfig_subcommand , |
| | | 'objectType' : 'backend-name' , |
| | | 'objectName' : server.backend , |
| | | 'expectedRC' : 0 |
| | |
| | | 'dsInstanceHost' : server.host , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'subcommand' : '%s' % componentList[componentNumber][0] , |
| | | 'subcommand' : '%s' % dsconfig_subcommand , |
| | | 'expectedRC' : 0 |
| | | } |
| | | </call> |
| | |
| | | |
| | | <call function="'searchStringForSubstring'"> |
| | | { 'returnString' : returnString , |
| | | 'testString' : componentList[componentNumber][1] , |
| | | 'testString' : dsconfig_component1 , |
| | | 'expectedResult' : '1' } |
| | | </call> |
| | | |
| | | <call function="'checktestString'"> |
| | | { 'returnString' : returnString , |
| | | 'expectedString' : componentList[componentNumber][2] } |
| | | 'expectedString' : dsconfig_component2 } |
| | | </call> |
| | | |
| | | </sequence> |
| | |
| | | </call> |
| | | |
| | | <!-- Check the STAFResult is expected class type --> |
| | | <if expr='STAFResult.__class__ is not org.python.core.PyDictionary'> |
| | | <if expr='STAFResult.__class__ is not PyDictionary'> |
| | | <sequence> |
| | | <message log="1" level="'Error'"> |
| | | 'ERROR : Invalid result type (%s), requires org.python.core.PyDictionary.' % STAFResult.__class__ |
| | | 'ERROR : Invalid result type (%s), requires PyDictionary.' % STAFResult.__class__ |
| | | </message> |
| | | <throw exception="'STAXException.Results.TestCaseException'"> |
| | | 'Result not a PyDictionary object.' |
| | |
| | | <script>SEC_I2_REPL_PORT = STAXResult</script> |
| | | |
| | | <message> |
| | | 'Got these free ports for I1: %s, %s, %s, %s' % (SEC_I1_PORT, \ |
| | | SEC_I1_SPORT, SEC_I1_ADMIN_PORT, SEC_I1_REPL_PORT) |
| | | 'Got these free ports for I2: %s, %s, %s, %s' % (SEC_I2_PORT, \ |
| | | SEC_I2_SPORT, SEC_I2_ADMIN_PORT, SEC_I2_REPL_PORT) |
| | | 'Got these free ports for I1: %s, %s, %s, %s' \ |
| | | % (SEC_I1_PORT, SEC_I1_SPORT, SEC_I1_ADMIN_PORT, SEC_I1_REPL_PORT) |
| | | </message> |
| | | |
| | | |
| | | <message> |
| | | 'Got these free ports for I2: %s, %s, %s, %s' \ |
| | | % (SEC_I2_PORT, SEC_I2_SPORT, SEC_I2_ADMIN_PORT, SEC_I2_REPL_PORT) |
| | | </message> |
| | | |
| | | <!--- Test Case information |
| | | #@TestMarker Setup-Uninstall Security tests |
| | |
| | | import re |
| | | import os |
| | | import sys |
| | | from org.python.core import PyString,PyUnicode,PyList,PyDictionary |
| | | </script> |
| | | |
| | | <!-- Load in any additional Java classes --> |
| | |
| | | |
| | | <script> |
| | | try: |
| | | if issueId.__class__ is org.python.core.PyList: |
| | | if issueId.__class__ is PyList: |
| | | for issue in issueId: |
| | | if int(issue) not in issuesList: |
| | | issuesList.append(int(issue)) |
| | |
| | | </script> |
| | | |
| | | <!-- Check that returnString is really a string or unicode --> |
| | | <if expr='returnString.__class__ is not org.python.core.PyString |
| | | and returnString.__class__ is not org.python.core.PyUnicode'> |
| | | <if expr='returnString.__class__ is not PyString |
| | | and returnString.__class__ is not PyUnicode'> |
| | | <sequence> |
| | | <message log="1" level="'Error'"> |
| | | 'Invalid returnString type (%s), requires str or unicode.' \ |
| | |
| | | </script> |
| | | |
| | | <!-- Check that returnString is really a string --> |
| | | <if expr='returnString.__class__ is not org.python.core.PyString |
| | | and returnString.__class__ is not org.python.core.PyUnicode'> |
| | | <if expr='returnString.__class__ is not PyString |
| | | and returnString.__class__ is not PyUnicode'> |
| | | <sequence> |
| | | <message log="1" level="'Error'"> |
| | | 'ERROR : Invalid returnString type (%s), requires str or unicode.' \ |
| | |
| | | <location>STAXServiceMachine</location> |
| | | <service>'delay'</service> |
| | | <request> |
| | | 'delay %i' % sleepForMilliSeconds |
| | | 'delay %i' % int(sleepForMilliSeconds) |
| | | </request> |
| | | </stafcmd> |
| | | |
| | |
| | | testcaseDuration=testcaseStop-testcaseStart |
| | | shortName=get_test_name(STAXCurrentTestcase) |
| | | |
| | | xml=xmldoc_service() |
| | | |
| | | 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) |
| | | testsuite = testgroup.getChildNodes().item(1) |
| | | |
| | | xml.testcase = repdoc.createElement("testcase") |
| | | xml.createAttr(repdoc,xml.testcase,"name",STAXCurrentTestcase) |
| | | xml.createAttr(repdoc,xml.testcase,"duration",testcaseDuration) |
| | |
| | | xml.createAttr(repdoc,xml.testcase,"suite",ThisSuiteName) |
| | | xml.createAttr(repdoc,xml.testcase,"info",information) |
| | | |
| | | #TODO: handle org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR |
| | | import org.w3c.dom.DOMException |
| | | try: |
| | | xml.testsuite.appendChild(xml.testcase) |
| | | except org.w3c.dom.DOMException, e: |
| | | print "Caught %s." % e |
| | | testsuite.appendChild(xml.testcase) |
| | | |
| | | if len(issuesList)!=0: |
| | | xml.issues = repdoc.createElement("issues") |
| | |
| | | ThisGroupName=CurrentTestPath['group'] |
| | | ThisSuiteName=CurrentTestPath['suite'] |
| | | |
| | | xml=xmldoc_service() |
| | | |
| | | 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) |
| | | |
| | | #Create testsuite element |
| | | xml.testsuite = repdoc.createElement("testsuite") |
| | | xml.createAttr(repdoc,xml.testsuite,"name",ThisSuiteName) |
| | | xml.createAttr(repdoc,xml.testsuite,"shortname",ThisSuiteName) |
| | | xml.testgroup.appendChild(xml.testsuite) |
| | | |
| | | testgroup.appendChild(xml.testsuite) |
| | | |
| | | xml.writeXMLfile(repdoc,"%s/results_tmp.xml" % logs.reports) |
| | | |
| | |
| | | </sequence> |
| | | </function> |
| | | |
| | | |
| | | </stax> |
| | |
| | | "list_matches" , |
| | | "count_attr" , |
| | | "host_is_localhost" , |
| | | "md5_hash"] |
| | | "md5_hash" |
| | | ] |
| | | |
| | | class format_testcase: |
| | | 'Format the Test name objects' |
| | |
| | | self.diffFile = diffFile |
| | | |
| | | def genDiff(self): |
| | | from org.tmatesoft.svn.core.wc import * |
| | | from org.tmatesoft.svn.core.wc import DefaultSVNDiffGenerator |
| | | from java.io import File |
| | | from java.io import FileOutputStream |
| | | |
| | |
| | | from javax.xml.transform.dom import DOMSource |
| | | tranFactory = TransformerFactory.newInstance(); |
| | | aTransformer = tranFactory.newTransformer(); |
| | | aTransformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1") |
| | | aTransformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8") |
| | | aTransformer.setOutputProperty(OutputKeys.INDENT, "yes") |
| | | |
| | | src = DOMSource(doc); |
| | |
| | | |
| | | tranFactory = TransformerFactory.newInstance(); |
| | | aTransformer = tranFactory.newTransformer(); |
| | | aTransformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1") |
| | | aTransformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8") |
| | | aTransformer.setOutputProperty(OutputKeys.INDENT, "yes"); |
| | | aTransformer.transform(xmlInput, xmlOutput); |
| | | |
| | |
| | | import md5 |
| | | m = md5.new() |
| | | return m |
| | | |
| | | |