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

mkeyes
15.06.2007 bda8570d7bbbe711878c7778af1e56095d65cfea
As a prelude to the cleanup of many test cases that call searchStringForSubstring xml function, the following commit is made.
Now there is a default value for expectedResult parameter that allows the old behavior to work until the code can be refactored.
New calls to this function should include the parameter, expectedResult, with eith a 0 (false or 1 (true) value.
1 files modified
62 ■■■■■ changed files
opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml 62 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml
@@ -243,8 +243,18 @@
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="expectedResult" type="optional" default="'2'">
        <function-arg-description>
          the expected result, 0 for false (not present), 1 for true (present), 2 for old behavior
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <!-- Until all the test cases are refactored to use the expectedResult param,
         we need this if-else conditional. -->
    <sequence>
    <if expr="expectedResult == '2'">
    <sequence>
      <script>
        searchre = re.compile(testString)
@@ -267,6 +277,58 @@
      </if>
      <return>returnCode</return>
    </sequence>
    <else>
    <sequence>
      <script>
        searchre = re.compile(testString)
      </script>
      <if expr='re.search(searchre, returnString) == None'>
        <sequence>
          <script>returnCode='0'</script>
          <if expr="expectedResult == '0'">
              <sequence>
              <tcstatus result="'pass'"/>
              <message log="1">
                'SUCCESS :  Did Not Find substring, %s, in the return string' % (testString)
              </message>
              </sequence>
          <else>
              <sequence>
              <tcstatus result="'fail'"/>
              <message log="1">
                'ERROR :  Did Not Find substring, %s, in the return string' % (testString)
              </message>
              </sequence>
          </else>
          </if>
        </sequence>
        <else>
        <sequence>
          <script>returnCode='1'</script>
          <if expr="expectedResult == '1'">
              <sequence>
              <tcstatus result="'pass'"/>
              <message log="1">
                'SUCCESS :  Found substring, %s, in the return string' % (testString)
              </message>
              </sequence>
          <else>
              <sequence>
              <tcstatus result="'fail'"/>
              <message log="1">
                'ERROR :  Found substring, %s, in the return string' % (testString)
              </message>
              </sequence>
          </else>
          </if>
        </sequence>
        </else>
      </if>
      <return>returnCode</return>
    </sequence>
    </else>
    </if>
    </sequence>
  </function>
  
  <function name="isAlive" scope="local">