You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ju...@apache.org on 2001/11/20 15:35:32 UTC

cvs commit: jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/toBeWalked1/toBeWalked2 WalkerTest.w2

juergen     01/11/20 06:35:32

  Added:       testsuite Build.xml
               testsuite/bin AppendCP.CMD Cp.CMD TErrorsReport.CMD
                        TProcessor.CMD
               testsuite/lib commons-httpclient.jar jakarta-oro-2.0.jar
                        jdom.jar junit.jar tprocessor.jar webdavlib.jar
                        xerces.jar
               testsuite/testsuite/junit Tprocessor.dtd
                        testCasesResults.dtd testCasesResults.xml
                        tprocessor.xml
               testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor
                        AclAssert.java CopyAssert.java DeleteAssert.java
                        GetAssert.java LockAssert.java MoveAssert.java
                        PropPatchAssert.java PropfindAssert.java
                        ResponseBodyAssert.java
                        StreamResponseBodyAssert.java TErrorsReport.java
                        TProcessors.java XMLOutput.java
                        XMLResponseBodyAssert.java
               testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil
                        ClassName.java ExecuteHttpGet.java TArgs.java
                        XConf.java
               testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker
                        DirectoryWalker.java MultiTProcessorExecuter.java
                        TProcessorTestExecuter.java WalkerFilter.java
                        WalkerJob.java WalkerTest.java
               testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/toBeWalked1
                        WalkerTest.w1
               testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/toBeWalked1/toBeWalked2
                        WalkerTest.w2
  Log:
  first portion of the testsuite containing all the necessary java programs.
  
  Revision  Changes    Path
  1.1                  jakarta-slide/testsuite/Build.xml
  
  Index: Build.xml
  ===================================================================
  <project default="all">
  
    <property name="src" value="${basedir}/testsuite/junit/src" />
    <property name="debug" value="${basedir}/testsuite/junit/debug" />
    <property name="lib" value="${basedir}/lib" />
    <property name="dist" value="${basedir}/dist" />
    <property name="cpath" value="${lib}/commons-httpclient.jar;${lib}/jdom.jar;${lib}/junit.jar;${lib}/tprocessor.jar;${lib}/webdavlib.jar;${lib}/xerces.jar" />
    
    <!-- =============================================================== -->
    <target name="compile">
      <echo message="Compiling ..." />
      <delete dir="${debug}" />
      <mkdir dir="${debug}" />
      <javac srcdir="${src}"
             destdir="${debug}"
             classpath="${cpath}"
             debug="on" />
      <copy todir="${debug}" >
        <fileset dir="${src}" excludes="**/*.java,**/CVS/**/*" />
      </copy>           
    </target>
  
    <!-- =============================================================== -->
    <target name="makejar">
      <echo message="Building tprocessor.jar  ..." />
      <delete file="${lib}/tprocessor.jar" />
      <jar jarfile="${lib}/tprocessor.jar"
           basedir="${debug}" />
    </target>
    
    <!-- =============================================================== -->
    <target name="makezip">
      <echo message="Building testsuite.zip ..." />
      <zip zipfile="${basedir}/../testsuite.zip"
           basedir="${basedir}"
      />
    </target>
    
    <!-- =============================================================== -->
    <target name="make">
      <antcall target="compile" />
      <antcall target="makejar" />
    </target>
    
    <!-- =============================================================== -->
    <target name="dist">
      <antcall target="makezip" />
      <delete dir="${dist}" />
      <mkdir dir="${dist}" />
      <move todir="${dist}" file="${basedir}/../testsuite.zip" />
    </target>
    
    <!-- =============================================================== -->
    <target name="all">
      <antcall target="make" />
      <antcall target="dist" />
    </target>
  
  </project>
  
  
  1.1                  jakarta-slide/testsuite/bin/AppendCP.CMD
  
  Index: AppendCP.CMD
  ===================================================================
  @echo off
  set _CP=
  if "%1" == "" goto END
  echo Appending %1 and all jar files contained in %1 to the classpath...
  set CLASSPATH=%CLASSPATH%;%1
  for %%f in (%1\*.jar) do call cp %%f
  set CLASSPATH=%CLASSPATH%;%_CP%
  :END
  set _CP=
  
  
  
  1.1                  jakarta-slide/testsuite/bin/Cp.CMD
  
  Index: Cp.CMD
  ===================================================================
  if "%_CP%" == "" GOTO NEW
  GOTO APPEND
  
  :NEW
  set _CP=%1
  GOTO END
  
  :APPEND
  set _CP=%_CP%;%1
  GOTO END
  
  :END
  
  
  
  
  1.1                  jakarta-slide/testsuite/bin/TErrorsReport.CMD
  
  Index: TErrorsReport.CMD
  ===================================================================
  @echo off
  setlocal
  
  rem Set defaults
  rem NOTE: (1) TP_HOME=.. works if tprocessor.cmd is started from the bin directory.
  rem           Otherwise, set TP_HOME to point to the TProcessor installation directory, or use 
  rem           the -home argument
  set TP_HOME=..
  set PAR=
  
  rem Process parms
  :LOOP
  if "%1" == "" goto INVOKE_ER
  if "%1" == "-?" goto HELP
  if "%1" == "-h" goto HELP
  if "%1" == "-help" goto HELP
  if "%1" == "-home" goto SET_HOME
  if "%1" == "-infile" goto SET_INFILE
  if "%1" == "-outfile" goto SET_OUTFILE
  goto SET_PAR
  
  :SET_PAR
  set PAR=%PAR% %1
  shift 
  goto LOOP
  
  :SET_HOME
  shift
  set TP_HOME=%1
  shift
  goto LOOP
  
  :SET_INFILE
  shift
  set ER_INFILE=-infile %1
  shift
  goto LOOP
  
  :SET_OUTFILE
  shift
  set ER_OUTFILE=-outfile %1
  shift
  goto LOOP
  
  rem Invoke the report
  :INVOKE_ER
  set OPTS=
  set OPTS=%OPTS% -Dxdav.home="%TP_HOME%"
  
  if "%ER_INFILE%" == "" set ER_INFILE=-infile %TP_HOME%\testsuite\junit\testcasesresults.xml
  if "%ER_OUTFILE%" == "" set ER_OUTFILE=-outfile %TP_HOME%\testsuite\junit\errors.txt
  
  set CLASSPATH=
  call AppendCP %TP_HOME%\lib
  
  set CLS=org.apache.slide.testsuite.testtools.tprocessor.TErrorsReport %ER_INFILE% %ER_OUTFILE%
  goto EXEC
  
  :EXEC
  @echo on
  %JAVA_HOME%\bin\java %OPTS% %CLS% %PAR%
  @echo off
  goto END
  
  :HELP
  echo.
  echo Usage: terrorsreport [options] 
  echo.
  echo Options:
  echo   -infile ^<testsuite_result_xml^>     (default: %TP_HOME%\testsuite\junit\testcasesresults.xml)
  echo   -outfile ^<errors_report^>           (default: %TP_HOME%\testsuite\junit\errors.txt;
  echo                                         also allowed: stdout, stderr)
  echo.
  goto END
  
  :END
  endlocal
  
  
  1.1                  jakarta-slide/testsuite/bin/TProcessor.CMD
  
  Index: TProcessor.CMD
  ===================================================================
  @echo off
  setlocal
  
  rem Set defaults
  rem NOTE: (1) TP_HOME=.. works if tprocessor.cmd is started from the bin directory.
  rem           Otherwise, set TP_HOME to point to the TProcessor installation directory, or use 
  rem           the -home argument
  rem       (2) DAV_HOST, DAV_PORT and DAV_NAME identify the WebDAV Server to test, i.e. the server
  rem           URL is http://%DAV_HOST%:%DAV_PORT%/%DAV_NAME%
  rem       (3) TP_STORE identifies the Slide store for the TProcessor to operate on.
  rem       (4) TP_USERS is the number of concurrent users for the multiuser testcases.
  rem       (5) TP_ITERATIONS is the number of iterations each concurrent user performs an action.
  set TP_HOME=..
  set DAV_HOST=localhost
  set DAV_PORT=8080
  set DAV_NAME=slide
  set TP_STORE=files
  set TP_USERS=10
  set TP_ITERATIONS=10
  set TESTCASE_PATH=
  set TESTCASE_PATTERN=
  set PAR=
  
  rem Process parms
  :LOOP
  if "%1" == "" goto INVOKE_TP
  if "%1" == "-?" goto HELP
  if "%1" == "-h" goto HELP
  if "%1" == "-help" goto HELP
  if "%1" == "-home" goto SET_HOME
  if "%1" == "-davhost" goto SET_HOST
  if "%1" == "-davport" goto SET_PORT
  if "%1" == "-davname" goto SET_NAME
  if "%1" == "-store" goto SET_STORE
  if "%1" == "-users" goto SET_USERS
  if "%1" == "-iterations" goto SET_ITERATIONS
  if "%1" == "-testcase" goto SET_NAME
  if "%1" == "-pattern" goto SET_PATTERN
  goto SET_PAR
  
  :SET_PAR
  set PAR=%PAR% %1
  shift 
  goto LOOP
  
  :SET_HOME
  shift
  set TP_HOME=%1
  shift
  goto LOOP
  
  :SET_HOST
  shift
  set DAV_HOST=%1
  shift
  goto LOOP
  
  :SET_PORT
  shift
  set DAV_PORT=%1
  shift
  goto LOOP
  
  :SET_NAME
  shift
  set DAV_NAME=%1
  shift
  goto LOOP
  
  :SET_STORE
  shift
  set TP_STORE=%1
  shift
  goto LOOP
  
  :SET_USERS
  shift
  set TP_USERS=%1
  shift
  goto LOOP
  
  :SET_ITERATIONS
  shift
  set TP_ITERATIONS=%1
  shift
  goto LOOP
  
  :SET_NAME
  shift
  set TESTCASE_PATH=%1
  shift
  goto LOOP
  
  :SET_PATTERN
  shift
  set TESTCASE_PATTERN=%1
  shift
  goto LOOP
  
  :INVOKE_TP
  set /A TP_ITER_SMALL=%TP_ITERATIONS%/2
  
  set OPTS=
  set OPTS=%OPTS% -Dxdav.home="%TP_HOME%"
  set OPTS=%OPTS% -Dxdav.host=%DAV_HOST%
  set OPTS=%OPTS% -Dxdav.port=%DAV_PORT%
  set OPTS=%OPTS% -Dxdav.globalVariableServerName=%DAV_NAME%
  set OPTS=%OPTS% -Dxdav.globalVariableCollection=%TP_STORE%
  set OPTS=%OPTS% -Dxdav.globalVariableUsers=%TP_USERS%
  set OPTS=%OPTS% -Dxdav.globalVariableIterationCount=%TP_ITERATIONS%
  set OPTS=%OPTS% -Dxdav.globalVariableIterationCountSmall=%TP_ITER_SMALL%
  
  set CLASSPATH=
  call AppendCP %TP_HOME%\lib
  
  if not "%TESTCASE_PATH%" == "" goto SET_SINGLE
  if not "%TESTCASE_PATTERN%" == "" goto SET_PATTERN
  goto SET_ALL
  
  :SET_SINGLE
  set CLS=org.apache.slide.testsuite.testtools.tprocessor.TProcessors -name %TP_HOME%\%TESTCASE_PATH%
  goto EXEC
  
  :SET_PATTERN
  set CLS=org.apache.slide.testsuite.testtools.walker.MultiTProcessorExecuter
  set PAR=%TESTCASE_PATTERN%
  goto EXEC
  
  :SET_ALL
  set CLS=junit.textui.TestRunner
  set PAR=org.apache.slide.testsuite.testtools.walker.TProcessorTestExecuter
  goto EXEC
  
  :EXEC
  @echo on
  %JAVA_HOME%\bin\java %OPTS% %CLS% %PAR%
  @echo off
  goto END
  
  :HELP
  echo.
  echo Usage: tprocessor [options] 
  echo.
  echo Options:
  echo   -davhost ^<webdavserver_host^>       (default: localhost)
  echo   -davport ^<webdavserver_port^>       (default: 8080)
  echo   -davname ^<webdavserver_name^>       (default: slide)
  echo   -store ^<store_to_operate_on^>       (default: files)
  echo   -users ^<number_of_users^>           (default: 10)
  echo   -iterations ^<number_of_iterations^> (default: 10)
  echo   -testcase ^<xmltestcase_path^>       (relative to the home directory)
  echo   -pattern ^<xmltestcase_pattern^>
  echo.
  echo If both, -testcase and -pattern are omitted, all testcases are executed.
  echo.
  echo Examples:
  echo   (1) Execute all testcases
  echo   tprocessor
  echo.
  echo   (2) Execute one specific testcase
  echo   tprocessor -testcase /testsuite/junit/xmltestcases/copy/code/copy201.xml 
  echo.
  echo   (3) Execute all XML testcases which start with 'copy'
  echo   tprocessor -pattern "copy*.xml"
  echo.
  goto END
  
  :END
  endlocal
  
  
  1.1                  jakarta-slide/testsuite/lib/commons-httpclient.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-slide/testsuite/lib/jakarta-oro-2.0.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-slide/testsuite/lib/jdom.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-slide/testsuite/lib/junit.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-slide/testsuite/lib/tprocessor.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-slide/testsuite/lib/webdavlib.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-slide/testsuite/lib/xerces.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/Tprocessor.dtd
  
  Index: Tprocessor.dtd
  ===================================================================
  <?xml version='1.0' encoding='UTF-8' ?>
  
  <!--Generated by XML Authority-->
  
  <!ELEMENT test (specification? , (step | repeater | thread)+ , cleanup? )>
  
  <!ELEMENT cleanup (step | repeater)+>
  
  <!ELEMENT thread (step | repeater)+>
  
  <!ELEMENT repeater (step | repeater | thread)+>
  <!ATTLIST repeater  repeatCount   CDATA  '1'
                      varDefinition CDATA  ''
                      varUsage      CDATA  '' >
  
  <!ELEMENT assign (#PCDATA)>
  <!ATTLIST assign varDefinition CDATA  ''
                   varUsage      CDATA  '' >
                      
  <!ELEMENT step (assign*, user? , password? , request , response)>
  
  <!ATTLIST step  executeIn CDATA  '' >
  <!ELEMENT request (command , header* , body?)>
  
  <!ELEMENT response (command , header* , body?)>
  
  <!ELEMENT specification (abstract+ , pre-Requisite? , description+ , expectedResult+ , exception?)>
  
  <!ELEMENT header (#PCDATA)>
  <!ATTLIST header  varDefinition CDATA  ''
                    varUsage      CDATA  '' >
                    
  <!ELEMENT command (#PCDATA)>
  <!ATTLIST command  varDefinition CDATA  ''
                     varUsage      CDATA  '' >
                    
  <!ELEMENT body (#PCDATA)>
  <!ATTLIST body    varDefinition CDATA  ''
                    varUsage      CDATA  ''
                    fileReference CDATA  '' >
                    
  
  <!ELEMENT abstract (#PCDATA)>
  
  <!ELEMENT pre-Requisite (#PCDATA)>
  
  <!ELEMENT description (#PCDATA)>
  
  <!ELEMENT expectedResult (#PCDATA)>
  
  <!ELEMENT exception (#PCDATA)>
  
  <!ELEMENT user (#PCDATA)>
  <!ATTLIST user     varDefinition CDATA  ''
                     varUsage      CDATA  '' >
  
  <!ELEMENT password (#PCDATA)>
  <!ATTLIST password  varDefinition CDATA  ''
                      varUsage      CDATA  '' >
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/testCasesResults.dtd
  
  Index: testCasesResults.dtd
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Pill, Juergen (private) -->
  <!--DTD generated by XML Spy v3.5 NT (http://www.xmlspy.com)-->
  <!ELEMENT XMLSizeError (path, expectedSize, receivedSize, expectedElements, receivedElements, receivedAndNotExpected?, expectedAndNotReceived?, receivedAndNotExpected?)>
  <!ELEMENT XMLValueError (path, expectedValue, receivedValue)>
  <!ELEMENT ContentLengthError (#PCDATA)>
  <!ELEMENT ContentValueError (#PCDATA)>
  <!ELEMENT exceuteStep (method, url, exception?, headerErrors?, XMLSizeError*, XMLValueError*, responseError?, ContentLengthError?, ContentValueError?, result, time)>
  <!ELEMENT expectedAndNotReceived (#PCDATA)>
  <!ELEMENT expectedElements (#PCDATA)>
  <!ELEMENT expectedSize (#PCDATA)>
  <!ELEMENT expectedValue (#PCDATA)>
  <!ELEMENT fileName (#PCDATA)>
  <!ELEMENT headerErrors (nonExistingHeader+ | nonMatchingHeader)>
  <!ELEMENT method (#PCDATA)>
  <!ELEMENT nonExistingHeader (#PCDATA)>
  <!ATTLIST nonExistingHeader
  	name (Allow | DAV | MS-Author-Via) #REQUIRED
  >
  <!ELEMENT nonMatchingHeader (expectedValue, receivedValue)>
  <!ATTLIST nonMatchingHeader
  	name CDATA #REQUIRED
  >
  <!ELEMENT path (#PCDATA)>
  <!ELEMENT receivedAndNotExpected (#PCDATA)>
  <!ELEMENT receivedElements (#PCDATA)>
  <!ELEMENT receivedSize (#PCDATA)>
  <!ELEMENT receivedValue (#PCDATA)>
  <!ELEMENT responseError (receivedValue, expectedValue)>
  <!ELEMENT result (#PCDATA)>
  <!ELEMENT resultFileName (#PCDATA)>
  <!ELEMENT excecutionDate (#PCDATA)>
  <!ELEMENT testCase (fileName, exceuteStep+, result, time, testElementCount, testElementErrors)>
  <!ELEMENT testSuite (excecutionDate, resultFileName, testCase+, result, time, testElementCount, testElementErrors)>
  <!ELEMENT time (#PCDATA)>
  <!ELEMENT url (#PCDATA)>
  <!ELEMENT testElementCount (#PCDATA)>
  <!ELEMENT testElementErrors (#PCDATA)>
  <!ELEMENT exception (#PCDATA)>
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/testCasesResults.xml
  
  Index: testCasesResults.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE testSuite SYSTEM "\\bolrep2\projects\xdavNC\TaTooDev\xdav\testsuite\junit\testCasesResults.dtd">
  <testSuite>
     <excecutionDate>20.11.01 14:07</excecutionDate>
     <resultFileName>..\testsuite\junit\xmltestcases\..\testCasesResults.xml</resultFileName>
  
  
     <testCase>
        <fileName>
        X:\jpl\jakarta-slide\testsuite\bin\..\testsuite\junit\xmltestcases\taminoPlatform\contentStore\contentStore.xml
        </fileName>
  
  
  
        <exceuteStep>
           <method>PUT</method>
           <url>/taminowebdavserver/files31NT/lock.xml</url>
           <result>Success</result>
           <time>852</time>
        </exceuteStep>
  
  
  
        <exceuteStep>
           <method>GET</method>
           <url>/taminowebdavserver/files31NT/lock.xml</url>
           <result>Success</result>
           <time>150</time>
        </exceuteStep>
  
  
  
        <exceuteStep>
           <method>PUT</method>
           <url>/taminowebdavserver/files31NT/lock.xml</url>
           <result>Success</result>
           <time>451</time>
        </exceuteStep>
  
  
  
        <exceuteStep>
           <method>GET</method>
           <url>/taminowebdavserver/files31NT/lock.xml</url>
           <result>Success</result>
           <time>170</time>
        </exceuteStep>
  
  
  
        <exceuteStep>
           <method>PUT</method>
           <url>/taminowebdavserver/files31NT/help-doc.html</url>
           <result>Success</result>
           <time>491</time>
        </exceuteStep>
  
  
  
        <exceuteStep>
           <method>GET</method>
           <url>/taminowebdavserver/files31NT/help-doc.html</url>
           <result>Success</result>
           <time>90</time>
        </exceuteStep>
  
  
  
        <exceuteStep>
           <method>DELETE</method>
           <url>/taminowebdavserver/files31NT/help-doc.html</url>
           <result>Success</result>
           <time>431</time>
        </exceuteStep>
  
  
  
        <exceuteStep>
           <method>DELETE</method>
           <url>/taminowebdavserver/files31NT/lock.xml</url>
           <result>Success</result>
           <time>320</time>
        </exceuteStep>
  
  
  
        <result>Success</result>
        <time>4396</time>
        <testElementCount>8</testElementCount>
        <testElementErrors>0</testElementErrors>
     </testCase>
  
     <result>Success</result>
     <time>12247</time>
     <testElementCount>1</testElementCount>
     <testElementErrors>0</testElementErrors>
  </testSuite>
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/tprocessor.xml
  
  Index: tprocessor.xml
  ===================================================================
  <config>
    
    
  
  
  
    <ExcludedXMLbodyElements>
  
      <item>//creationdate</item>
      <item>//getlastmodified</item>
      <item>/prop/lockdiscovery/activelock/timeout</item>
      <item>/prop/lockdiscovery/activelock/locktoken/href</item>
      <item>/multistatus/response/propstat/prop/supported-privilege-set</item>
      <item>/multistatus/response/propstat/prop/current-user-privilege-set</item>
      <item>/multistatus/response/propstat/prop/getcontenttype</item>
      <item>/multistatus/response/propstat/prop/getcontentlanguage</item>
  
      <PROPFIND>
          
          <item>/multistatus/response/propstat/prop/supported-privilege-set</item>
          <item>/multistatus/response/propstat/prop/current-user-privilege-set</item>
          <item>/multistatus/response/propstat/prop/acl</item>
          <item>/multistatus/response/propstat/prop/acl-semantics</item>
          <item>/multistatus/response/propstat/prop/principal-collection-set</item>
          <item>/multistatus/response/propstat/prop/getcontentlanguage</item>
          <item>/multistatus/response/propstat/prop/getcontentlanguage</item>
          
      </PROPFIND>
     
    </ExcludedXMLbodyElements>
    
    
  
  
  
  
    <excludedHeaderProperties>
    
      <item>Date</item>
      <item>Content-Language</item>
      <item>Servlet-Engine</item>
      <item>Last-Modified</item>
      <item>ETag</item>
      
    </excludedHeaderProperties>
    
    
    
    <automatedVariables>
      <LOCK>
        <item>prop/lockdiscovery/activelock/locktoken/href</item>
        <item>prop/lockdiscovery/activelock/timeout/href</item>
      </LOCK>
    </automatedVariables>
    
    
    
    
    
    <tamino>
      <taminobase>bolrep2/tamino</taminobase>
      <database>xdav</database>
    </tamino>
    
  </config>
  
  
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/AclAssert.java
  
  Index: AclAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/AclAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  
  // Slide
  import org.apache.webdav.lib.methods.XMLResponseMethodBase;
  // jdom
  import org.jdom.Element;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  
  
  
  /**
   * Perform the necessary checks for the received and expected ACL body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class AclAssert extends XMLResponseBodyAssert {
      
      
      /** constructor
       */
      public AclAssert(XMLResponseMethodBase method, Element elt, XConf xconf, XMLOutput xmlresult){
          super(method, elt, xconf, xmlresult);
      }
      
      
      
      
      /**
       * checks if Expected Response and Response bodies are the same
       */
      public boolean assert(){
          
          if (method.getStatusCode() == 204 ||
              method.getStatusCode() == 403 ||
              method.getStatusCode() == 409 ||
              method.getStatusCode() == 423 ||
              method.getStatusCode() == 201 ||
              method.getStatusCode() == 412  ){
              return true;
          }
          
          return super.assert();
      }
      
      
      
      
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/CopyAssert.java
  
  Index: CopyAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/CopyAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  
  // Slide
  import org.apache.webdav.lib.methods.*;
  // jdom
  import org.jdom.*;
  import org.jdom.input.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  /**
   * Perform the necessary checks for the received and expected Copy body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class CopyAssert extends XMLResponseBodyAssert {
      
      
      /** constructer
       */
      public CopyAssert(XMLResponseMethodBase method, Element elt, XConf xconf, XMLOutput xmlresult){
          super(method, elt, xconf, xmlresult);
      }
      
      
      
      
      /**
       * checks if Expected Response and Response are same
       */
      public boolean assert(){
          
          if (method.getStatusCode() == 204 ||
              method.getStatusCode() == 403 ||
              method.getStatusCode() == 409 ||
              method.getStatusCode() == 423 ||
              method.getStatusCode() == 201 ||
              method.getStatusCode() == 412  ){
              return true;
          }
          
          return super.assert();
      }
      
      
      
      
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/DeleteAssert.java
  
  Index: DeleteAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/DeleteAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  
  // Slide
  import org.apache.webdav.lib.methods.*;
  // jdom
  import org.jdom.*;
  import org.jdom.input.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  /**
   * Perform the necessary checks for the received and expected Delete body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class DeleteAssert extends XMLResponseBodyAssert {
      
      
      
      /** constructer
       */
      public DeleteAssert(XMLResponseMethodBase method, Element elt, XConf xconf, XMLOutput xmlresult){
          super(method, elt, xconf, xmlresult);
      }
      
      
      
      
      /**
       * checks if Expected Response and Response are same
       */
      public boolean assert(){
  
          
          if (method.getStatusCode() == 204 ||
              method.getStatusCode() == 404 ||
              method.getStatusCode() == 409 ||
              method.getStatusCode() == 423 ){
              return true;
          }
          
          return super.assert();
      }
      
      
      
      
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/GetAssert.java
  
  Index: GetAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/GetAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  
  
  // Slide
  import org.apache.commons.httpclient.HttpMethod;
  // java
  import java.io.*;
  import java.util.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  
  /**
   * Perform the necessary checks for the received and expected Get body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class GetAssert extends StreamResponseBodyAssert {
      
      
      /** constructer
       * @param WebdavMethodBase Element
       */
      public GetAssert(HttpMethod method, Reader expectedBody, XConf xconf, XMLOutput xmlresult){
          super(method, expectedBody, xconf, xmlresult);
      }
      
      
      
      
      /**
       * checks if Expected Response and Response are same
       */
      public boolean assert(){
          
          if (method.getStatusCode() == 204 ||
              method.getStatusCode() == 403 ||
              method.getStatusCode() == 409 ||
              method.getStatusCode() == 423 ||
              method.getStatusCode() == 201 ||
              method.getStatusCode() == 412  ){
              return true;
          }
          
          return super.assert();
      }
      
      
      
      
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/LockAssert.java
  
  Index: LockAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/LockAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  // Slide
  import org.apache.webdav.lib.methods.*;
  // jdom
  import org.jdom.*;
  import org.jdom.input.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  /**
   * Perform the necessary checks for the received and expected Lock body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class LockAssert extends XMLResponseBodyAssert {
      
      
      /** constructer
       */
      public LockAssert(XMLResponseMethodBase method, Element elt, XConf xconf, XMLOutput xmlresult){
          super(method, elt, xconf, xmlresult);
      }
      
      
      /**
       * checks if Expected Response and Response are same
       */
      public boolean assert(){
          
          if (method.getStatusCode() == 423  ||
              method.getStatusCode() == 200  ||
              method.getStatusCode() == 412  ){
              return true;
          }
          
          return super.assert();
      }
      
      
      
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/MoveAssert.java
  
  Index: MoveAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/MoveAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  // Slide
  import org.apache.webdav.lib.methods.*;
  // jdom
  import org.jdom.*;
  import org.jdom.input.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  /**
   * Perform the necessary checks for the received and expected Move body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class MoveAssert extends CopyAssert {
      
      
      
      
      /** constructer
       */
      public MoveAssert(XMLResponseMethodBase method, Element elt, XConf xconf, XMLOutput xmlresult){
          super(method, elt, xconf, xmlresult);
      }
      
      
      
      
      
      /**
       * checks if Expected Response and Response are same
       */
      public boolean assert(){
          
          if (method.getStatusCode() == 204 ||
              method.getStatusCode() == 403 ||
              method.getStatusCode() == 409 ||
              method.getStatusCode() == 423 ||
              method.getStatusCode() == 201 ||
              method.getStatusCode() == 412  ){
              return true;
          }
          
          return super.assert();
      }
      
      
  }
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/PropPatchAssert.java
  
  Index: PropPatchAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/PropPatchAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  //java
  import java.io.*;
  import java.util.*;
  // Slide
  import org.apache.webdav.lib.methods.*;
  // jdom
  import org.jdom.*;
  import org.jdom.input.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  /**
   * Perform the necessary checks for the received and expected PropPatch body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class PropPatchAssert extends XMLResponseBodyAssert {
      
      
      /** constructer
       */
      public PropPatchAssert(XMLResponseMethodBase method, Element elt, XConf xconf, XMLOutput xmlresult){
          super(method, elt, xconf, xmlresult);
      }
      
      /**
       * checks if Expected Response and Response are same
       */
      public boolean assert(){
          
          if (method.getStatusCode() == 404  ||
              method.getStatusCode() == 409  ||
              method.getStatusCode() == 423  ){
              return true;
          }
          
          return super.assert();
      }
      
      
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/PropfindAssert.java
  
  Index: PropfindAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/PropfindAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  
  // Slide
  import org.apache.webdav.lib.methods.*;
  // jdom
  import org.jdom.*;
  import org.jdom.input.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  /**
   * Perform the necessary checks for the received and expected PropFind body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class PropfindAssert extends XMLResponseBodyAssert {
      
      
      /** constructer
       */
      public PropfindAssert(XMLResponseMethodBase method, Element elt, XConf xconf, XMLOutput xmlresult){
          super(method, elt, xconf, xmlresult);
      }
      
      
      public boolean compareValues(String path, String name, String value1, String value2) {
          // ignore leading and trailing "/" in the href section
          if (name.equals("href")){
              if (value1.endsWith("/")){
                  value1 = value1.substring(0,value1.length()-1);
              }
              if (value2.endsWith("/")){
                  value2 = value2.substring(0,value2.length()-1);
              }
              if (value1.startsWith("/")){
                  value1 = value1.substring(1,value1.length());
              }
              if (value2.startsWith("/")){
                  value2 = value2.substring(1,value2.length());
              }
          }
          return super.compareValues(path, name, value1, value2);
      }
      
      
      
      
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/ResponseBodyAssert.java
  
  Index: ResponseBodyAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/ResponseBodyAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  // java
  import java.util.List;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  
  /**
   * Abstract root class to perform the necessary checks for the received and expected body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public abstract class ResponseBodyAssert {
      
      
      /** specify where to write the xml results **/
      protected XMLOutput xmlresult;
      
      
      protected List                    configuration;
      
      
      
      /** constructer
       * @param WebdavMethodBase Element
       */
      public ResponseBodyAssert(XConf xconf, String name, XMLOutput xmlresult){
          this.configuration = xconf.getPropertyList ("ExcludedXMLbodyElements", name);
          this.xmlresult = xmlresult;
      }
      
      
      /**
       * checks if Expected Response and the received Response body are logically identical
       */
      public abstract boolean assert();
      
      
      
      
      
  }
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/StreamResponseBodyAssert.java
  
  Index: StreamResponseBodyAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/StreamResponseBodyAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  //java
  import java.io.*;
  import java.util.*;
  // Slide
  import org.apache.webdav.lib.methods.*;
  import org.apache.commons.httpclient.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  
  
  /**
   * Abstract root class to perform the necessary checks for the received and expected stream body
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public abstract class StreamResponseBodyAssert extends ResponseBodyAssert{
      
      
      
      
      
      protected HttpMethod    method;
      protected Reader        expectedBody;
      protected Reader        receivedBody;
      
      /** constructer
       * @param WebdavMethodBase Element
       */
      public StreamResponseBodyAssert(HttpMethod method, Reader expectedBody, XConf xconf, XMLOutput xmlresult){
          
          
          super(xconf, method.getName(), xmlresult);
          
          this.method = method;
          this.expectedBody = expectedBody;
          // ugly quick hack to read the body
          try {
              if (method.hasResponseBody() && method instanceof GetMethod) {
                  this.receivedBody = new StringReader(((GetMethod)method).getDataAsString());
              }
          }
          catch (Exception e) {
              e.printStackTrace();
              xmlresult.writeException(e);
          }
          
          
      }
      
      
      
      
      /**
       * checks if Expected Response and Response are same
       */
      public boolean assert(){
          if (method.getStatusCode() < 200  || method.getStatusCode() > 300  ){
              return true;
          }
          
          if (receivedBody == null ||
              expectedBody == null  )
              return true;
          return compareStreams(receivedBody, expectedBody);
      }
      
      
      /**
       * checks if Expected Response and Response are same
       */
      private boolean compareStreams(Reader receivedBody, Reader expectedBody){
          String receivedString = getStringFromStream(receivedBody);
          String expectedString = getStringFromStream(expectedBody);
          
  //System.out.println("");
  //System.out.println("##########Expected#########");
  //System.out.println(expectedString);
  //System.out.println("##########Expected#########");
  //System.out.println("##########Received#########");
  //System.out.println(receivedString);
  //System.out.println("##########Received#########");
          
          if (expectedString.length() != receivedString.length()) {
              xmlresult.writeElement("ContentLengthError", "Received = " + receivedString.length() + " Expected = " + expectedString.length() );
              return false;
          }
          if (!expectedString.equals(receivedString)) {
              xmlresult.writeElement("ContentValueError", "Differ Position = " + getFirstDifferentPosition(expectedString, receivedString));
              return false;
          }
  
        return true;  // length and value are identical
      }
      
      
      
      /**
       * checks if Expected Response and Response are same
       */
      private String getStringFromStream(Reader input){
          String result = null;
          
          
          try {
              StringWriter output = new StringWriter();
              char[] buffer = new char[1024];
              int numberOfBytesRead;
              
              while ((numberOfBytesRead=input.read(buffer)) > 0) {
                  output.write (buffer, 0, numberOfBytesRead);
              }
              
              result = output.toString();
              input.close();
              output.close();
              
          }
          catch (Exception e) {
              e.printStackTrace();
              xmlresult.writeException(e);
          }
          
          return result;
          
      }
      
      
      /**
       * checks if Expected Response and Response are same
       */
      private int getFirstDifferentPosition(String receivedBody, String expectedBody){
          int result = 1;
          while (result <= receivedBody.length()) {
              if (receivedBody.charAt(result) != expectedBody.charAt(result)) return result;
              result++;
          }
          return result;
      }
      
      
      
  }
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/TErrorsReport.java
  
  Index: TErrorsReport.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/TErrorsReport.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  import java.io.*;
  import java.net.*;
  import java.util.*;
  import java.text.*;
  import org.jdom.*;
  import org.jdom.input.*;
  import org.jdom.output.*;
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  /**
   ** Errors report from a TestcasesResults.xml file.
   **
   ** @author    peter.nevermann@softwareag.com
   ** @version   0.1
   **/
  public class TErrorsReport {
      /**
       *
       */
      public static void main(String[] args) {
          try {
              TArgs a = new TArgs( args );
              File f = null;
              String inname = null;
              String outname = null;
              InputStream in = null;
              PrintStream out = System.out;
              
              if( a.isOptionSet("infile") ) {
                  inname = a.get("infile");
                  f = new File( inname );
                  if( !f.exists() )
                      out.println( "\nFile "+inname+" not found\n" );
                  in = new FileInputStream(f);
              }
  
              if( a.isOptionSet("outfile") ) {
                  outname = a.get("outfile");
                  if( "stdout".equalsIgnoreCase(outname) ) {
                      out = System.out;
                      out.println("\n\n");
                  }
                  else if( "stderr".equalsIgnoreCase(outname) ) {
                      out = System.err;
                      out.println("\n\n");
                  }
                  else {
                      f = new File( outname );
                      out = new PrintStream( new FileOutputStream(f) );
                  }
              }
              else {
                  out.println("\n\n");
              }
              
              SAXBuilder sax = new SAXBuilder();
              Document doc = sax.build( in );
              Element root = doc.getRootElement();
              Iterator tci = root.getChildren("testCase").iterator();
              long errors = 0;
              out.println(
                  "********************************************************************************\n"+
                  "TESTSUITE ERRORS REPORT\n"+
                  "Report created.......: "+DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.GERMANY).format(new Date())+"\n"+
                  "Testsuite executed...: "+root.getChild("excecutionDate").getText()+"\n"+
                  "Input log............: "+inname+"\n"+
                  "********************************************************************************\n");
              boolean error = false;
              while( tci.hasNext() ) {
                  String cause = null;
                  error = false;
                  Element tc = (Element)tci.next();
                  Iterator xsi = tc.getChildren("exceuteStep").iterator();
                  cause = "";
                  while( xsi.hasNext() ) {
                      Element xs = (Element)xsi.next();
                      Element r = xs.getChild("result");
                      if( "Success".equals(r.getText()) )
                          continue;
                      error = true;
                      errors++;
                      Iterator xsei = xs.getChildren().iterator();
                      while( xsei.hasNext() ) {
                          Element xse = (Element)xsei.next();
                          if( "method".equals(xse.getName()) )
                              continue;
                          if( "url".equals(xse.getName()) )
                              continue;
                          if( "result".equals(xse.getName()) )
                              continue;
                          if( "time".equals(xse.getName()) )
                              continue;
                          cause = cause+"- "+xse.getName()+": ";
                      }
                      cause = cause+xs.getChild("method").getTextTrim()+" "+xs.getChild("url").getTextTrim()+"\n";
                  }
                  if( error ) {
                      String l = tc.getChild("fileName").getText();
                      int i = l.indexOf("testsuite");
                      l = l.substring(i).trim();
                      out.println("Testcase: "+l);
                      out.println(cause);
                  }
              }
              out.println("\nResult: "+errors+" errors\n");
              out.close();
          }
          catch( Exception x ) { x.printStackTrace(); }
      }
  }
  
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/TProcessors.java
  
  Index: TProcessors.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/TProcessors.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  //java
  import java.io.*;
  import java.util.*;
  // Slide
  import org.apache.commons.httpclient.*;
  import org.apache.webdav.lib.*;
  import org.apache.webdav.lib.methods.*;
  import org.apache.util.WebdavStatus;
  // jdom
  import org.jdom.*;
  import org.jdom.input.*;
  import org.jdom.output.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  
  /**
   * Main class to performe a test case and check and report the results
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class TProcessors {
      
      
      
      /** Table for startup parameter */
      Hashtable startUp = null;
      
      
      /** home */
      String xdavhome;
      
      /** port */
      String port;
      
      /** host */
      String host;
      
      
      /** hold all the variable defined **/
      KnownVariablesHashtable knownVariables = new KnownVariablesHashtable();
      
      
      /** holds all configuration **/
      XConf xdavConfiguration = null;
      
      /** specify where to write the xml results **/
      private XMLOutput xmlresult = new XMLOutput(System.out);
      
      /** count all executed test elements **/
      private long testElementsExecuted = 0;
      
      /** count all executed test elements **/
      private long testElementsExecutedWithError = 0;
      
      /** The absolute path name of the execute input file **/
      private String globalAbsolutePath = null;
      
      /**
       * Constructor
       */
      
      public  TProcessors (){
          
          xdavhome = System.getProperty("xdav.home");
          host = System.getProperty("xdav.host");
          port = System.getProperty("xdav.port");
          if (host == null) {
              System.out.println("xdav.host is not set!");
              throw new Error("xdav.host is not set!");
          }
          if (xdavhome == null) {
              System.out.println("xdav.home is not set!");
              throw new Error("xdav.home is not set!");
          }
          if (port == null) {
              System.out.println("xdav.port is not set!");
              throw new Error("xdav.port is not set!");
          }
          
          // Set some defaults
          startUp = new Hashtable();
          startUp.put("host", host);
          startUp.put("port", new Integer(port));
          startUp.put("user", "guest");
          
          
          try { xdavConfiguration = new XConf(new File(xdavhome +
                                                           File.separator + "testsuite"+
                                                           File.separator + "junit"+
                                                           File.separator + "tprocessor.xml")); }
          catch (Exception e) { e.printStackTrace(); }
          
          
      }
      
      
      
      /**
       * main method
       */
      public static void main(String[] args)
      {
          if (!mainExecuter(args, null, null)) {
              System.exit (-1);
          }
      }
      
      
      
      
      
      /**
       * main executer method to be called from outside
       */
      public static boolean mainExecuter(String[] args, java.io.PrintStream xmlresult, int[] counters)
      {
          
          
          String stestName = "";
          String url;
          boolean result = true;
          TArgs arg = new TArgs (args);
          
          
          TProcessors tp = new TProcessors();
          if(!tp.processStartUp( args )){
              System.exit(-1);
          }
          
          if (arg.isOptionSet ("name")) {
              stestName = arg.get ("name");
              
          }
          else {
              return false;
          }
          
          
          //      System.out.println("Can read this file: "+ testName.canRead()+ "***" +testName.length());
          //      System.out.println("Can get the name of this file: "+ testName.getName());
          
          
          if (!tp.executeTestCase( new File (stestName), xmlresult )) {
              result = false;
          }
          
          if (counters != null) {
              counters[0] ++;
              if (!result) counters[1] ++;
              //          System.out.println("$$$$$$$$$$$ processed cases     " + counters[0]);
              //          System.out.println("$$$$$$$$$$$ processed cases err " + counters[1]);
              //          System.out.println("");
          }
          
          
          
          return result;
      }
      
      
      
      
      
      
      /**
       * Process the initial args passed to the Class.<br>
       * Currently this should consist of:<br>
       *
       * -host [the host to connect to]</br>
       * -port [the port the host is running webdav on]<br>
       * -u    [username]<br>
       * -p    [password]<br>
       *
       * There are default set if anything is missing.<br>
       *
       * If all goes well, a session will be created and credentials set.
       */
      private boolean processStartUp( String[] args ){
          
          int argsIndex = 0;
          boolean ready = false;
          
          
          TArgs arg = new TArgs (args);
          
          if (arg.isOptionSet ("help")) {
              
              printStartUsage();
              return false;
          }
          if (arg.isOptionSet("host")){
              
              
              startUp.put("host", arg.get("host"));
              
              ready = true;
          }
          if(arg.isOptionSet("port")){
              int val;
              try
              {
                  val = Integer.parseInt( arg.get("port") );
              }
              catch ( NumberFormatException ne )
              {
                  printStartUsage();
                  return false;
              }
              startUp.put("port", new Integer(val) );
              
              
              ready = true;
          }
          if (arg.isOptionSet( "u" ) ) {
              startUp.put("user", arg.get("u") );
              ready = true;
          }
          
          if (arg.isOptionSet( "p" ) ){
              startUp.put("password", arg.get("password") );
              ready = true;
          }
          
          if (arg.isOptionSet( "name" ) ){
              ready = true;
          }
          
          
          return ready;
      }
      /**
       * Print the commands options from startup
       */
      private static void printStartUsage()
      {
          
          System.out.println("XDAV Tprocessor Startup args:");
          System.out.println("  -name <The name of testcase, full path should be given>");
          System.out.println("  -host <host to connect to>");
          System.out.println("  -port <post to conect on>");
          System.out.println("  -u    <username>");
          System.out.println("  -p    <password>");
          System.out.println("  -help");
          
          
      }
      // -------------------------------------------------------- Private Methods
      
      /**
       * Construct a document (tree) out of given XML file. Execute testStep given in the
       * file
       * @param WeddavClient client, File
       */
      
      private boolean executeTestCase( File testfile, PrintStream xmlresultPar ){
          boolean result= true;
          long time = System.currentTimeMillis();
          
          if (xmlresultPar != null){
              this.xmlresult = new XMLOutput(xmlresultPar);
          }
          
          
          System.out.println("");
          System.out.println("Starting test case: " + testfile.getAbsolutePath());
          
          xmlresult.writeElementStart("testCase");
          xmlresult.writeElement("fileName", testfile.getAbsolutePath());
          xmlresult.flush();
          
          try{
              
              globalAbsolutePath = testfile.getAbsolutePath();
              globalAbsolutePath = testfile.getParent();
              //          globalAbsolutePath = testfile.;
              result = exceuteStepOrRepeater(new SAXBuilder(true).build(testfile).getRootElement().getChildren().iterator());
              
              
          } catch (JDOMException e){
              result = false;
              xmlresult.writeElement("domException", e.toString());
              e.printStackTrace();
          }
          
          
          xmlresult.writeElement("result",  ((testElementsExecutedWithError!=0)?"ERROR":"Success"));
          xmlresult.writeElement("time",  ((System.currentTimeMillis() - time)));
          xmlresult.writeElement("testElementCount",  testElementsExecuted);
          xmlresult.writeElement("testElementErrors",  testElementsExecutedWithError);
          xmlresult.writeElementEnd("testCase");
          xmlresult.flush();
          
          
          if (testElementsExecutedWithError!=0) System.out.println("FAILED test case: " + testfile.getAbsolutePath());
          //      System.out.println("Ending test case: " + testfile.getAbsolutePath());
          //      System.out.println("");
          //      try {System.in.read();} catch (Exception e) {}
          
          
          
          return testElementsExecutedWithError==0;
          
      }
      
      
      private boolean exceuteStepOrRepeater(Iterator items) {
          boolean result           = true;
          Vector  threadsToExceute = new Vector(10);
          Vector  cleanUpThreads   = new Vector(10);
          
          try {
              
              result = exceuteStepOrRepeater(items, threadsToExceute, cleanUpThreads);
              
              // now execute all collected threads in parallel
              for (int i = 0 ; i<threadsToExceute.size(); i++) {
                  ((Thread)threadsToExceute.elementAt(i)).start();
              }
              for (int i = 0 ; i<threadsToExceute.size(); i++) {
                  ((Thread)threadsToExceute.elementAt(i)).join();
              }
              
              // now do the clean up tasks
              // now execute all collected threads in parallel
              for (int i = 0 ; i<cleanUpThreads.size(); i++) {
                  ((Thread)cleanUpThreads.elementAt(i)).start();
              }
              for (int i = 0 ; i<cleanUpThreads.size(); i++) {
                  ((Thread)cleanUpThreads.elementAt(i)).join();
              }
          }
          catch (Exception e){
              e.printStackTrace();
          }
          
          return result;
          
      }
      
      
      
      private boolean exceuteStepOrRepeater(Iterator items, Vector threadsToExceute, Vector cleanUpThreads) {
          boolean result = true;
          try {
              while(items.hasNext()){
                  Element item = (Element) items.next();
                  //              System.out.println("**** Execute of Step Element:  "+ item.getName());
                  if (item.getName().equals("step")){
                      if(!executeStep(item)){
                          result = false;
                      }
                  } else if(item.getName().equals("thread")){
                      threadsToExceute.add(new Thread(new Runner(item.getChildren().iterator(), Thread.currentThread()), "parallelThread-" + (threadsToExceute.size()+1)));
                  } else if(item.getName().equals("cleanup")){
                      cleanUpThreads.add(new Thread(new Runner(item.getChildren().iterator(), Thread.currentThread()), "cleanUpThread"));
                  } else if(item.getName().equals("repeater")){
                      String varName = "repeatCounter";
                      if (item.getAttribute("varDefinition") != null &&
                          !item.getAttributeValue("varDefinition").equals("") ) {
                          varName = item.getAttributeValue("varDefinition");
                      }
                      knownVariables.put(varName, "undefined");
                      int stackMarker = knownVariables.size();
                      long maximum = new Long(replaceKnownVariable(item, item.getAttribute("repeatCount").getValue(), "0")).longValue();
                      for (long i = 0; i < maximum; i++){
                          knownVariables.removeAllFramedVariables(stackMarker);
                          knownVariables.put(varName, new Long(i+1).toString());
                          result = exceuteStepOrRepeater(item.getChildren().iterator(), threadsToExceute, cleanUpThreads) && result;
                      }
                  } else if(item.getName().equals("specification")){
                      // do nothing in case of docu
                  } else {
                      System.out.println("#########################");
                      System.out.println("Illegal entry in XML = " + item.getName() );
                      System.out.println("Received response code = " + getElementString(item) );
                      System.out.println("#########################");
                  }
              }
              
              
          }
          catch (Exception e){
              e.printStackTrace();
          }
          
          return result;
      }
      
      
      private void assignVariables(List varDefinitions ){
          if (varDefinitions != null) {
              Iterator iter = varDefinitions.iterator();
              while (iter.hasNext()) {
                  Element element = (Element)iter.next();
                  if (element.getAttributeValue("varDefinition") != null)
                      knownVariables.put(element.getAttributeValue("varDefinition"), replaceKnownVariable(element));
              }
          }
      }
      
      
      
      
      
      /**
       * Execute a given request for a testStep
       * @param Element
       */
      
      private boolean executeStep(Element elt ){
          
          boolean result      = false;
          long time           = System.currentTimeMillis();
          HttpMethod method   = null;
          
          assignVariables(elt.getChildren("assign"));
          
          String user         = replaceKnownVariable(elt.getChild("user"), (String)startUp.get("user"));
          String password     = replaceKnownVariable(elt.getChild("password"), (String)startUp.get("password"));
          HttpClient client = new HttpClient();
          client.startSession((String)startUp.get("host"), ((Integer)startUp.get("port") ).intValue());
          client.setCredentials(new Credentials(user, password));
          client.setState(new WebdavState());  // neede in the next version of Slide !!!! [jpl]
          client.setDebug(0);
          
          //      System.out.println("############### user " + user);
          //      System.out.println("############### pwd  " + password);
          
          xmlresult.writeElementStart("exceuteStep");
          
          try{
              method = executeRequest((Element) elt.getChild("request"));
              
              if (method == null){
                  System.out.println("#########################");
                  System.out.println("Method pointer is null = " + getElementString(elt.getChild("request")) );
                  System.out.println("#########################");
                  return false;
              }
              
              
              xmlresult.writeElement("method", method.getName());
              xmlresult.writeElement("url", method.getPath());
              
              
              client.executeMethod(method);
              client.endSession();
              //          System.out.println("Status Code "+ m.getStatusCode());
              //          System.out.println("Status Text "+ m.getStatusText());
              
              
              //          if (method instanceof PropFindMethod) {
              //              System.out.println("###################");
              //              System.out.println("###################");
              //              System.out.println("###################");
              //              if (((PropFindMethod)method).getResponseDocument() != null) System.out.println("body " + getElementString(((PropFindMethod)method).getResponseDocument().getDocumentElement()));
              //              System.out.println("###################");
              //              System.out.println("###################");
              //              System.out.println("###################");
              //          }
              
              fillAutomatedVariables(method);
              
              result = (responseAssert(method, elt));
              
              
          }catch(Exception e){
              xmlresult.writeException( e );
              e.printStackTrace();
          }
          
          if (!result) testElementsExecutedWithError ++;
          testElementsExecuted ++;
          
          
          xmlresult.writeElement("result", (!result?"ERROR":"Success"));
          xmlresult.writeElement("time",  ((System.currentTimeMillis() - time)));
          xmlresult.writeElementEnd("exceuteStep");
          xmlresult.flush();
          
          
          return result;
      }
      
      /**
       * Constructs from request the method associated to the given request
       * @param Element
       */
      
      private HttpMethod executeRequest(Element request){
          HttpMethod method = null;
          List list = request.getChildren();
          Iterator items = list.iterator();
          
          
          while(items.hasNext()){
              Element item = (Element) items.next();
              
              if(item.getName().equals("command")){
                  method = fillMethodName(item, method);
              }
              else if(item.getName().equals("header")){
                  method = fillHeader(item, method);
              } else if(item.getName().equals("body")){
                  method = fillBody(item, method);
              }
              
          }
          return(method);
      }
      
      
      /**
       * This method is used to replace variables in a element
       * @param element the element to replacement should be applied
       * @return String the value of the element, with all applied replacements, if element is null return null
       */
      private  String replaceKnownVariable(Element element){
          return replaceKnownVariable(element, null);
      }
      
      
      /**
       * This method checks if a name points to a valid file
       * @param fileName
       * @return true if the file name is valid
       */
      private  boolean checkFileName(String name){
          return new File(name).isFile();
      }
      
      
      
      /**
       * This method is used to replace variables in a string
       * @param element the element to replacement should be applied
       * @param defaultValue if element is null, return this default
       * @return String the value of the element, with all applied replacements, if element is null return defaultValue
       */
      private  String getBodyValue(Element body){
          String result = body.getText();
          String fileName = body.getAttributeValue("fileReference");
          if (fileName != null && fileName.length() > 1) {
              
              try {
                  if (globalAbsolutePath != null) {
                      if (checkFileName(fileName)) {
                          fileName = fileName;
                      } else if (checkFileName(globalAbsolutePath+File.separatorChar+fileName)) {
                          fileName = globalAbsolutePath+File.separatorChar+fileName;
                      }
                      
                  }
                  Reader input  = new BufferedReader(new FileReader(fileName));
                  StringWriter output = new StringWriter();
                  char[] buffer = new char[1024];
                  int numberOfBytesRead;
                  
                  while ((numberOfBytesRead=input.read(buffer)) > 0) {
                      output.write (buffer, 0, numberOfBytesRead);
                  }
                  
                  result = output.toString();
                  input.close();
                  output.close();
                  
              }
              catch (Exception e) {
                  e.printStackTrace();
              }
              
              
          }
          return result;
      }
      
      /**
       * This method is used to replace variables in a string
       * @param element the element to replacement should be applied
       * @param defaultValue if element is null, return this default
       * @return String the value of the element, with all applied replacements, if element is null return defaultValue
       */
      private  String replaceKnownVariable(Element element, String defaultValue){
          if (element == null) return defaultValue;
          return replaceKnownVariable(element, getBodyValue(element), defaultValue);
      }
      
      
      /**
       * This method is used to replace variables in a string
       * @param element the element to replacement should be applied
       * @param defaultValue if element is null, return this default
       * @return String the value of the element, with all applied replacements, if element is null return defaultValue
       */
      private  String replaceKnownVariable(Element element, String line, String defaultValue){
          
          if (element == null) return defaultValue;
          
          if (element.getAttributeValue("varUsage") != null && !element.getAttributeValue("varUsage").equals("")){
              
              if (element.getAttributeValue("varUsage").indexOf(",") == (-1)) {
                  line = replace(line, "%varUsage%", knownVariables.get(element.getAttributeValue("varUsage")));
                  line = replace(line, "%"+element.getAttributeValue("varUsage")+"%", knownVariables.get(element.getAttributeValue("varUsage")));
              } else {
                  StringTokenizer varNames = new StringTokenizer(element.getAttributeValue("varUsage"), ",");
                  while (varNames.hasMoreElements()) {
                      String varName = (String)varNames.nextElement();
                      line = replace(line, "%"+varName+"%", knownVariables.get(varName));
                  }
              }
          }
          return line;
      }
      
      /**
       * This method is used to replace variables in a string
       * @param line the string which will be modified
       * @param pattern search string to be replaced
       * @param value value of the replace string
       * @return value of line, with all applied replacements
       */
      public static String replace(String line, String pattern, String value){
          
          while (line.indexOf(pattern) != -1){
              line = line.substring(0, line.indexOf(pattern)) +
                  value +
                  line.substring(line.indexOf(pattern) + pattern.length());
          }
          //      System.out.println("#### Replaced " + pattern + " with " + value + " --> " + line);
          return line;
      }
      
      
      
      
      /**
       * This method is used to find out the name of the Resquest Method
       * @param List
       */
      private  HttpMethod fillMethodName(Element methodElement, HttpMethod method){
          StringTokenizer st = new StringTokenizer(replaceKnownVariable(methodElement));
          method = HttpMethodFactory(st.nextToken(), st.nextToken());
          return method;
      }
      
      
      
      
      /**
       * This method is used to set the Header in request Method
       * @param List
       */
      private  HttpMethod fillHeader (Element header, HttpMethod method){
          Header headerToSet = this.getResponseHeader(replaceKnownVariable(header));
          method.setHeader(headerToSet.getName(), headerToSet.getValue());
          return method;
      }
      
      
      
      
      /**
       * This method is used to set the Header in request Method
       * @param List
       */
      private  HttpMethod fillBody (Element element, HttpMethod method){
          //      if (method instanceof PutMethod) {
          //          ((PutMethod)method).sendData(replaceKnownVariable(element));
          //      } else {
          method.setQuery(replaceKnownVariable(element));
          //      }
          return method;
          
      }
      
      
      
      
      
      
      
      
      /**
       * This method is used to return body as String
       * @param String
       */
      public boolean responseAssert (HttpMethod m, Element elt){
          boolean firstPart = false;
          boolean secondPart = false;
          Iterator header = responseHeader(elt.getChild("response"));
          
          
          List expectedResponseCodes = responseStatus(elt.getChild("response").getChildText("command"));
          
          if (expectedResponseCodes != null && !expectedResponseCodes.contains(new Integer(m.getStatusCode()))) {
              
              xmlresult.writeElementStart("responseError");
              xmlresult.writeElement("receivedValue", WebdavStatus.getStatusText(m.getStatusCode()) +
                                         "   " + m.getStatusCode());
              xmlresult.writeElement("expectedValue", getStatusText(expectedResponseCodes) +
                                         "   " + expectedResponseCodes);
              xmlresult.writeElementEnd("responseError");
              
              if (m instanceof XMLResponseMethodBase && m.getStatusCode()==207 ) {
                  System.out.println("#################");
                  System.out.println(getElementString(((XMLResponseMethodBase)m).getResponseDocument().getDocumentElement()));
                  System.out.println("#################");
              }
              
              return false;
          }
          
          // a received response code of 404 will not compare the headers
          ResponseBodyAssert methodAssert = assertFactory(m, elt);
          secondPart = (m.getStatusCode() == 404 && expectedResponseCodes != null &&
                            expectedResponseCodes.size() != 1 &&
                            expectedResponseCodes.contains(new Integer(404)))
              ||
              responseHeaderAssert(m, elt, header);
          firstPart  = (methodAssert!=null)?methodAssert.assert():true;
          
          
          return ( firstPart && secondPart);
      }
      
      
      
      
      /**
       * This method is used to set the Header in request Method
       * @param List
       */
      private  String getStatusText (List responseCodes){
          
          String result = "";
          
          Iterator iter = responseCodes.iterator();
          while (iter.hasNext()) {
              result = result + " " + WebdavStatus.getStatusText(((Integer)iter.next()).intValue());
          }
          
          return result;
          
      }
      
      
      /**
       * This method is used to set the Header in request Method
       * @param List
       */
      private  Header getResponseHeader (String headerString){
          
          Header result = new Header();
          String name;
          String value;
          StringTokenizer st = new StringTokenizer(headerString);
          int size = st.nextToken().length();
          name = headerString.substring(0,size-1);
          if (size >= headerString.length()) {
              value = "";
          } else {
              value = headerString.substring(size+1);
          }
          value = value.trim();
          
          
          
          
          result.setName(name);
          result.setValue(value);
          
          return result;
          
      }
      
      /**
       * This method is used to return body as String
       * @param String
       */
      private boolean  responseHeaderAssert(HttpMethod m, Element elt, Iterator header){
          boolean result = false;
          try{
              
              result = verifyHeader(xdavConfiguration.getPropertyList ("excludedHeaderProperties", m.getName()), m, header);
              
          }catch(Exception e){
              e.printStackTrace();
          }
          
          
          return result;
      }
      
      
      
      
      
      /**
       * This method is used to check if all the given headers are returned by the WebDav method
       * @param String
       */
      private boolean  verifyHeader(List allowHeaders, HttpMethod m, Iterator header){
          boolean result = true;
          int i = 0;
          
          
          while (header.hasNext()){
              
              Header  headToMatch      = (Header) header.next();
              boolean oneHeaderMatched = allowHeaders.contains(headToMatch.getName()) ||  // head to be compared
                  verifyOneHeader(headToMatch, m.getHeaders());     // compare it
              
              if (!oneHeaderMatched){
                  if (result) {
                      xmlresult.writeElementStart("headerErrors");
                  }
                  if (m.getHeader(headToMatch.getName()) == null){
                      xmlresult.writeElement("nonExistingHeader", "name", headToMatch.getName(), headToMatch.getValue().trim());
                  }
                  else{
                      xmlresult.writeElementStart("nonMatchingHeader",  "name", headToMatch.getName());
                      xmlresult.writeElement("expectedValue", headToMatch.getValue().trim());
                      xmlresult.writeElement("receivedValue", m.getHeader(headToMatch.getName()).getValue().trim());
                      xmlresult.writeElementEnd("nonMatchingHeader");
                  }
              }
              
              result = result && oneHeaderMatched;
              
          }
          if (!result) {
              xmlresult.writeElementEnd("headerErrors");
          }
          return result;
      }
      
      
      
      
      
      private boolean  verifyOneHeader(Header h, Enumeration enum){
          boolean result = false;
          while(enum.hasMoreElements()){
              Header temp1 = ((Header) enum.nextElement());
              String hName1 = temp1.getName();
              String hValue1 = temp1.getValue();
              if(hName1.equalsIgnoreCase(h.getName()) && hValue1.equalsIgnoreCase(h.getValue())){
                  result = true;
                  //break;
              }
          }
          return result;
      }
      
      
      private Iterator responseHeader(Element response){
          ArrayList result = new ArrayList();
          Iterator iter = response.getChildren("header").iterator();
          while (iter.hasNext()){
              Element element = (Element)iter.next();
              result.add(getResponseHeader(element.getTextTrim()));
          }
          return result.iterator();
      }
      
      
      
      
      
      public static List responseStatus (String response){
          List result = new ArrayList();
          StringTokenizer st = new StringTokenizer(response);
          st.nextToken(); // ignore the first 'http' element
          String resonseString = st.nextToken();
          if (resonseString.equals("*"))       return null;
          if (!resonseString.startsWith("("))  result.add(new Integer(resonseString));
          if (resonseString.startsWith("(")) {
              StringTokenizer responseCodes = new StringTokenizer(resonseString, ",");
              while (responseCodes.hasMoreElements()) {
                  String element = (String)responseCodes.nextElement();
                  if (element.startsWith("(")) element = element.substring(1, element.length());
                  if (element.endsWith(")")) element = element.substring(0, element.length()-1);
                  if (!element.startsWith(")"))  result.add(new Integer(element));
              }
          }
          return result;
      }
      
      
      
  //
      
      
      /**
       *
       */
      public static String getElementString (org.w3c.dom.Element e) {
          return getElementString(new org.jdom.input.DOMBuilder().build(e));
      }
      
      
      /**
       *
       */
      public static String getElementString (Element e) {
          XMLOutputter out = new XMLOutputter("  ", true);
          String result = null;
          
          if (e == null) return "null";
          
          try {
              result = out.outputString (e);
          }
          catch (Exception ex) {}
          
          return result;
      }
      
      /**
       * Extract from expected response it body
       */
      protected  Element getElementFromString (String  input){
          
          if (input == null) return null;
          
          Element result = null;
          //      System.out.println("######");
          //      System.out.println("######" + element);
          //      System.out.println("######");
          //      System.out.println("");
          //      System.out.println("");
          //      System.out.println("");
          
          if (input.trim().equals("")) return null;
          
          try {
              // WAM get rid of deprecated StringBufferInputStream
              //          result = (new org.jdom.input.DOMBuilder().build
              //                        (new StringBufferInputStream(element.trim()))).getRootElement();
              
              result = (new org.jdom.input.DOMBuilder().build
                            (new ByteArrayInputStream (input.trim().getBytes()))).getRootElement();
          }
          catch (Exception e){
              System.out.println("#####################");
              System.out.println(input.trim());
              System.out.println("#####################");
              e.printStackTrace();
          }
          
          return result;
      }
      
      
      
      
      
      
      /**
       *
       */
      private void fillAutomatedVariables (HttpMethod m) {
          List possibleAutomatedVariables;
          
          if (m instanceof XMLResponseMethodBase){
              
              try{
                  
                  List possible = xdavConfiguration.getPropertyList("automatedVariables", m.getName());
                  Iterator iter = possible.iterator();
                  while (iter.hasNext()){
                      String searchPattern = (String)iter.next();
                      if (((XMLResponseMethodBase)m).getResponseDocument() != null){
                          fillAutomatedVariables(findElementList(new org.jdom.input.DOMBuilder().build(((XMLResponseMethodBase)m).getResponseDocument().getDocumentElement()),
                                                                 searchPattern));
                      }
                  }
                  
                  
              } catch(Exception e){
                  e.printStackTrace();
              }
          }
          
      }
      
      private void fillAutomatedVariables (List valueList) {
          Iterator iter = valueList.iterator();
          while (iter.hasNext()){
              Element e = ((Element)iter.next());
              String varName  = "automaticVariable" + knownVariables.size();
              String varValue = e.getText();
              knownVariables.put(varName, varValue);
              
          }
      }
      
      
      private List findElementList (Element rootElement, String key) {
          
          List result = new ArrayList();
          
          if (key == null || key.equals("")) return result;
          if (rootElement.getName().equals(key)) {
              result.add(rootElement);
              return result;
          }
          if (key.indexOf("/") == -1) return result;
          
          String head = key.substring(0, key.indexOf("/"));
          String tail = key.substring(key.indexOf("/")+1);
          String child = null;
          
          //      System.out.println("@@@@@@@@@ xml   "  + rootElement.getName());
          
          if (!rootElement.getName().equals(head)) return result;
          
          if (tail.indexOf("/") == (-1)){
              child = tail;
          }
          else{
              child = tail.substring(0, tail.indexOf("/"));
          }
          
          //      System.out.println("@@@@@@@@@ head  "  + head);
          //      System.out.println("@@@@@@@@@ child "  + child);
          //      System.out.println("@@@@@@@@@ tail  "  + tail);
          
          
          Iterator iter = rootElement.getChildren().iterator();
          while (iter.hasNext()){
              Element e = (Element)iter.next();
              if (e.getName().equals(child))
                  result.addAll(findElementList(e, tail));
          };
          
          
          return result;
      }
      
      
      private Element expectedResponseAsDOM(Element expectedResponse) {
          return getElementFromString(expectedResponseAsString(expectedResponse));
      }
      
      
      private Reader expectedResponseAsStream(Element expectedResponse) {
          return new StringReader(expectedResponseAsString(expectedResponse));
      }
      
      private String expectedResponseAsString(Element expectedResponse) {
          if (expectedResponse.getChild("response").getChild("body") != null) {
              return replaceKnownVariable(expectedResponse.getChild("response").getChild("body"));
          }
          return null;
      }
      
      
      
      private ResponseBodyAssert assertFactory(HttpMethod m, Element expectedResponse) {
          
          ResponseBodyAssert result = null;
          if(m instanceof PropFindMethod){
              result = new PropfindAssert((XMLResponseMethodBase) m, expectedResponseAsDOM(expectedResponse), xdavConfiguration, xmlresult);
          } else if (m instanceof LockMethod){
              result = new LockAssert((XMLResponseMethodBase) m, expectedResponseAsDOM(expectedResponse), xdavConfiguration, xmlresult);
          } else if (m instanceof PropPatchMethod){
              result = new PropPatchAssert((XMLResponseMethodBase) m, expectedResponseAsDOM(expectedResponse), xdavConfiguration, xmlresult);
          } else if (m instanceof DeleteMethod){
              result = new DeleteAssert ((XMLResponseMethodBase) m, expectedResponseAsDOM(expectedResponse), xdavConfiguration, xmlresult);
          } else if (m instanceof MoveMethod){
              result = new MoveAssert ((XMLResponseMethodBase) m, expectedResponseAsDOM(expectedResponse), xdavConfiguration, xmlresult);
          } else if (m instanceof CopyMethod){
              result = new CopyAssert ((XMLResponseMethodBase) m, expectedResponseAsDOM(expectedResponse), xdavConfiguration, xmlresult);
          } else if (m instanceof AclMethod){
              result = new AclAssert ((XMLResponseMethodBase) m, expectedResponseAsDOM(expectedResponse), xdavConfiguration, xmlresult);
          } else if (m instanceof GetMethod){
              result = new GetAssert ( m, expectedResponseAsStream(expectedResponse), xdavConfiguration, xmlresult);
          }
          return result;
      }
      
      
      
      /**
       * Factory method to return a method object based on the methodName.
       * If the method name is not known, null is returned
       */
      public static HttpMethod HttpMethodFactory(String methodName) {
          HttpMethod result = null;
          if (methodName.equalsIgnoreCase("COPY")){
              result = new CopyMethod();
          }
          else if(methodName.equalsIgnoreCase("DELETE")){
              result = new DeleteMethod();
          }
          else if(methodName.equalsIgnoreCase("GET")){
              result = new GetMethod();
              ((GetMethod)result).setUseDisk(false);
          }
          else if(methodName.equalsIgnoreCase("HEAD")){
              result = new HeadMethod();
          }
          else if(methodName.equalsIgnoreCase("LOCK")){
              result = new LockMethod();
          }
          else if(methodName.equalsIgnoreCase("MKCOL")){
              result = new MkcolMethod();
          }
          else if(methodName.equalsIgnoreCase("MOVE")){
              result = new MoveMethod();
          }
          else if(methodName.equalsIgnoreCase("OPTIONS")){
              result = new OptionsMethod();
          }
          else if(methodName.equalsIgnoreCase("POST")){
              result = new PostMethod();
          }
          else if(methodName.equalsIgnoreCase("PROPFIND")){
              result = new PropFindMethod();
          }
          else if(methodName.equalsIgnoreCase("PROPPATCH")){
              result = new PropPatchMethod();
          }
          else if(methodName.equalsIgnoreCase("PUT")){
              result = new PutMethod();
          }
          else if(methodName.equalsIgnoreCase("POST")){
              result = new PostMethod();
          }
          else if(methodName.equalsIgnoreCase("UNLOCK")){
              result = new UnlockMethod();
          }
          else if(methodName.equalsIgnoreCase("ACL")){
              result = new AclMethod();
          }
          return result;
      }
      
      
      
      
      /**
       * Factory method to return a method object based on the methodName.
       * If the method name is not known, null is returned
       */
      public static HttpMethod HttpMethodFactory(String methodName, String path) {
          HttpMethod result = HttpMethodFactory(methodName);
          if (result != null){
              result.setPath(path);
          }
          return result;
      }
      
      
      
      
      
      /**************************************************************/
      /* Inner class to help the thread to execute the function     */
      /**************************************************************/
      public class Runner implements Runnable{
          Iterator       items;
          String         name;
          HashtableStack varsToBeUsed;
          public Runner(Iterator items, Thread varsToBeUsed) {
              this.items = items;
              this.name = varsToBeUsed.getName();
              this.varsToBeUsed = new HashtableStack(knownVariables.getEnvironment(varsToBeUsed));
          }
          public void run() {
              knownVariables.createNewEnvironment(varsToBeUsed, name);
              try {exceuteStepOrRepeater(items);}
              catch (Exception e) {e.printStackTrace();};
              knownVariables.removeEnvironment();
          }
      }
      
      
      
      
      
      /**************************************************************/
      /* Inner class to contain all variable sorted by thread name  */
      /**************************************************************/
      private class KnownVariablesHashtable {
          private Hashtable knownVarsByThread = new Hashtable();
          public String get(String key) {
              String    result = "";
              
              if (key.startsWith("globalVariable")) {
                  return System.getProperty("xdav." + key);
              }
              else {
                  HashtableStack vars   = (HashtableStack)knownVarsByThread.get(Thread.currentThread().getName());
                  if (vars != null){
                      result = (String)vars.get(key);
                  }
              }
              System.out.println("***VAR reading " + key + " = " + result + "  in Thread " + Thread.currentThread().getName());
              return result;
          }
          public void put(String key, String value) {
              getEnvironment().put(key, value);
              System.out.println("***VAR setting " + key + " = " + value + "  in Thread " + Thread.currentThread().getName());
          }
          public int size() {
              return getEnvironment().size()+1;
          }
          public void removeAllFramedVariables(int stackMarker) {
              if (size() <= stackMarker) return;
              int max = size();
              for (int i = stackMarker; i <= max; i++)    {
                  getEnvironment().pop();
              }
          }
          public HashtableStack createNewEnvironment(HashtableStack varsToBeUsed, String name) {
              HashtableStack vars;
              if (varsToBeUsed != null) {
                  vars = new HashtableStack(varsToBeUsed);
              } else {
                  vars = new HashtableStack();
              }
              knownVarsByThread.put(Thread.currentThread().getName(), vars);
              System.out.println("***********Frame("+knownVarsByThread.size()+"): created new Variable frame for " + Thread.currentThread().getName() + " based on  " + name);
              return vars;
          }
          public void removeEnvironment() {
              knownVarsByThread.remove(Thread.currentThread().getName());
              System.out.println("***********Frame("+knownVarsByThread.size()+"): removed Variable frame for " + Thread.currentThread().getName() );
          }
          public HashtableStack getEnvironment(Thread scope) {
              HashtableStack vars  = (HashtableStack)knownVarsByThread.get(scope.getName());
              if (vars == null){
                  vars = createNewEnvironment(null, scope.getName());
              }
              return vars;
          }
          private HashtableStack getEnvironment() {
              return getEnvironment(Thread.currentThread());
          }
      }
      
      
      
      /**************************************************************/
      /* Inner class to have a HashMap act as a stack too           */
      /**************************************************************/
      private class HashtableStack extends Hashtable {
          private Stack stack = new Stack();
          public HashtableStack() {
              super();
          }
          public HashtableStack(Hashtable initValues) {
              super.putAll(initValues);
          }
          public Object put(Object key, Object value) {
              if (super.get(key) == null) {
                  stack.push(key);
              }
              return super.put(key, value);
          }
          public Object pop() {
              System.out.println("***VAR removing " + stack.peek() + " = " + super.get(stack.peek()) + "  in Thread " + Thread.currentThread());
              return super.remove(stack.pop());
          }
      }
      
      
      
      
      
      
      
  }
  
  
  
  
  
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/XMLOutput.java
  
  Index: XMLOutput.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/XMLOutput.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  //java
  import java.io.*;
  import java.util.*;
  
  
  
  /**
   * Helper class to output XML fragments
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class XMLOutput {
      
      
      private Hashtable knownXMLStringsByThread = new Hashtable();
      private Hashtable level = new Hashtable();
      private static int LINE_FIT = 100;
      private PrintStream xmlResult;
      
      public XMLOutput(PrintStream out) {
          xmlResult = out;
      }
      
      public void writeException(Exception e) {
          StringWriter sw = new StringWriter();
          e.printStackTrace( new PrintWriter(sw, true) ); //autoFlush=true
          String s = sw.toString();
          s = TProcessors.replace(s, "<", "&lt;");  // some specific XML adoptions
          s = TProcessors.replace(s, ">", "&gt;");
          writeElement("exception", s );
      }
      
      public void writeElement(String elementName, long value) {
          writeElement(elementName, new Long(value).toString());
      }
      
      public void writeElementStart(String elementName, String attrName, String attrValue) {
          putStringByThread(
              getStringByThread() +
                  getIndend() + "<" + elementName +  getAttribute(attrName, attrValue) + ">");
          incrementLevelByThread();
      }
      public void writeElementStart(String elementName) {
          writeElementStart(elementName, null, null);
      }
      
      public void writeElementEnd(String elementName) {
          decrementLevelByThread();
          putStringByThread(
              getStringByThread() +
                  getIndend() + "</" + elementName + ">");
      }
      
      
      public void writeElement(String elementName, String value) {
          writeElement(elementName, null, null, value);
      }
      
      
      
      public void writeElement(String elementName, String attrName, String attrValue, String value) {
          putStringByThread(
              getStringByThread() +
                  getIndend() + "<" + elementName + getAttribute(attrName, attrValue) + ">" +
                  getIndend(value) + value +
                  getIndend(value) + "</" + elementName + ">" );
      }
      
      
      public void flush() {
          synchronized (xmlResult) {
              xmlResult.println();
              xmlResult.println(getStringByThread());
              xmlResult.println();
          }
          putStringByThread("");
      }
      
      private String getStringByThread() {
          String result = (String)knownXMLStringsByThread.get(Thread.currentThread().getName());
          if (result == null) {
              result = "";
          }
          return result;
      }
      
      private int getLevelByThread() {
          Integer result = (Integer)level.get(Thread.currentThread().getName());
          if (result == null) {
              result = new Integer(1);
          }
          return result.intValue();
      }
      
      private void incrementLevelByThread() {
          level.put(Thread.currentThread().getName(), new Integer(getLevelByThread()+1));
      }
      private void decrementLevelByThread() {
          level.put(Thread.currentThread().getName(), new Integer(getLevelByThread()-1));
      }
      
      
      
      private void putStringByThread(String result) {
          knownXMLStringsByThread.put(Thread.currentThread().getName(), result);
      }
      
      
      private String getIndend() {
          String result = "\n";
          for (int i = 0; i < getLevelByThread(); i++){
              result += "   ";
          }
          return result;
      }
      
      
      private String getIndend(String value) {
          String result = (value.length()>LINE_FIT?getIndend():"");
          return result;
      }
      
      
      private String getAttribute(String attrName, String attrValue) {
          String result = "";
          if (attrName != null) {
              result = " " + attrName + "=\"" + attrValue +"\"";
          }
          return result;
      }
      
      
      
  }
  
  
  
  
  
  
  
  
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/XMLResponseBodyAssert.java
  
  Index: XMLResponseBodyAssert.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/XMLResponseBodyAssert.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tprocessor;
  
  //java
  import java.io.*;
  import java.util.*;
  // Slide
  import org.apache.webdav.lib.methods.*;
  // jdom
  import org.jdom.*;
  //test package
  import org.apache.slide.testsuite.testtools.tutil.*;
  
  
  
  public abstract class XMLResponseBodyAssert extends ResponseBodyAssert {
      
      
      
      protected XMLResponseMethodBase   method;
      protected Element                 expectedXmlTree;
      
      /** constructer
       * @param WebdavMethodBase Element
       */
      public XMLResponseBodyAssert(XMLResponseMethodBase method, Element expectedXmlTree, XConf xconf, XMLOutput xmlresult){
          
          super(xconf, method.getName(), xmlresult);
          this.method = method;
          this.expectedXmlTree = expectedXmlTree;
          
      }
      
      
      
  //
  //
      public org.jdom.Document responseDocument(){
          org.jdom.Document jdom = null;
          
          
          
          try{
              
              StringWriter  xmlStringWriter = new StringWriter();
              org.w3c.dom.Document dDoc = method.getResponseDocument();
              if (dDoc == null) return null;
              jdom = (new org.jdom.input.DOMBuilder().build(dDoc));
              
              new org.jdom.output.XMLOutputter().output(jdom, xmlStringWriter);
              
          } catch(Exception e){
              e.printStackTrace();
          }
          
          
          return jdom;
      }
      
      
      /**
       * checks if Expected Response and Response are same
       */
      public boolean assert(){
          if (method.getStatusCode() == 400  || // something really wrong in the response
              method.getStatusCode() == 409  ){ // 409/conflict never delievers a XML body
              return true;
          }
          
          if (expectedXmlTree == null ||
              responseDocument() == null ||
              responseDocument().getRootElement()== null)
              return true;
          return compareTrees(expectedXmlTree, responseDocument().getRootElement());
      }
      
      
      
      
      
      public boolean compareTrees(Element element1, Element element2) {
          return compareTrees("", element1, element2);
      }
      
      
      
      private boolean compareTrees(String pathName, Element element1, Element element2) {
          boolean result = true;
          List children1 = new ArrayList(element1.getChildren());
          List children2 = new ArrayList(element2.getChildren());
          
          Comparator nameCompare = new Comparator() {
              public int compare(Object o1, Object o2) {
                  Element e1 = (Element) o1;
                  Element e2 = (Element) o2;
                  return e1.getName().compareTo(e2.getName());
              }
          };
          
          Collections.sort(children1, nameCompare);
          Collections.sort(children2, nameCompare);
          
          // check the name of the element
          if (!element1.getName().equals(element2.getName())){
              xmlresult.writeElementStart("XMLNameError");
              xmlresult.writeElement("path", pathName);
              xmlresult.writeElement("expectedName", element1.getName());
              xmlresult.writeElement("receivedName>", element2.getName());
              xmlresult.writeElementEnd("XMLNameError");
  //          return false;
          }
          
          // check the value of the element
          result = compareValues(pathName, element1.getName(), element1.getTextTrim(), element2.getTextTrim());
          
          // check the count of children
          if (element1.getChildren().size() != element2.getChildren().size()){
              reportDifferentSizeError(element1, element2, pathName, element1.getName());
              children1 = repairElementList(element1, element2, getPathName(pathName, element1.getName()));
              children2 = repairElementList(element2, element1, getPathName(pathName, element2.getName()));
              //result = false;
          }
          
          // check if repair was sucessfull
          if (children1.size() != children2.size()){
              return false;
          }
          // finally check all children too via recursion
          Iterator iter1 = children1.iterator();
          Iterator iter2 = children2.iterator();
          while (iter1.hasNext()){
              try {
                  if (!compareTrees(getPathName(pathName, element1), (Element)iter1.next(), (Element)iter2.next()))
                      result = false;
              } catch (Exception e) { e.printStackTrace();
                  System.out.println("###################");
                  System.out.println("################### list1 = " + getChildNames(children1, getPathName(pathName, element1.getName())));
                  System.out.println("################### list2 = " + getChildNames(children2, getPathName(pathName, element1.getName())));
                  System.out.println("###################");
              }
          }
          
          return result;
      }
      
      private void reportDifferentSizeError(Element element1, Element element2, String path, String name) {
          String pathName = getPathName(path, name);
          List expectedAndNotReceived = getChildNames(element1, pathName);
          List receivedAndNotExpected = getChildNames(element2, pathName);
          expectedAndNotReceived.removeAll(getChildNames(element2, pathName));
          receivedAndNotExpected.removeAll(getChildNames(element1, pathName));
          
          List illegalElements = new ArrayList(expectedAndNotReceived);
          illegalElements.addAll(receivedAndNotExpected);
          illegalElements = removeLegalNamesFromList(pathName, illegalElements);
          
          if (illegalElements.size() > 0 ||
              repairElementList(element1, element2, getPathName(pathName, element1.getName())).size() !=
              repairElementList(element2, element1, getPathName(pathName, element2.getName())).size()) {
              
              xmlresult.writeElementStart("XMLSizeError");
              xmlresult.writeElement("path", pathName);
              xmlresult.writeElement("expectedSize", element1.getChildren().size());
              xmlresult.writeElement("receivedSize", element2.getChildren().size());
              xmlresult.writeElement("expectedElements", getChildNames(element1, pathName).toString());
              xmlresult.writeElement("receivedElements", getChildNames(element2, pathName).toString());
              expectedAndNotReceived = removeLegalNamesFromList(pathName, expectedAndNotReceived);
              if (expectedAndNotReceived.size() > 0){
                  xmlresult.writeElement("expectedAndNotReceived",  expectedAndNotReceived.toString());
              }
              receivedAndNotExpected = removeLegalNamesFromList(pathName, receivedAndNotExpected);
              if (receivedAndNotExpected.size() > 0){
                  xmlresult.writeElement("receivedAndNotExpected", receivedAndNotExpected.toString());
              }
              xmlresult.writeElementEnd("XMLSizeError");
          }
      }
      
      
      private List repairElementList(Element element1, Element element2, String pathName) {
          List result = element1.getChildren();
          
          
          List elementNamesToBeRemoved = getChildNames(element1, pathName);
          elementNamesToBeRemoved.removeAll(getChildNames(element2, pathName));
          List res = getChildNames(element1, pathName);
          res.removeAll(elementNamesToBeRemoved);
          
          //      System.out.println("############# Set1      " + getChildNames(element1, pathName));
          //      System.out.println("############# Set2      " + getChildNames(element2, pathName));
          //      System.out.println("############# to remove " + elementNamesToBeRemoved);
          //      System.out.println("############# expected  " + res);
          
          Iterator iter = elementNamesToBeRemoved.iterator();
          while (iter.hasNext()){
              String pattern = (String)iter.next();
              result.removeAll(getElementsWithDisplayName(result, pattern, pathName));
          }
          
          result = sort(result, pathName);
          
          //      System.out.println("#### sorted remaining = " + getChildNames(result, pathName));
          
          return result;
          
      }
      
      
      
      
      private boolean existsInConfig(String path, String name) {
          return this.configuration.contains(getPathName(path, name)) || this.configuration.contains("//"+name);
      }
      
      private List removeLegalNamesFromList(String path, List names) {
          List result = new ArrayList(names);
          Iterator iter = names.iterator();
          while (iter.hasNext()){
              String name = (String)iter.next();
              if (existsInConfig(path, name)){
                  result.remove(name);;
              }
          }
          return result;
      }
      
      
      private Integer getSingleResponseCode(List codes) {
          Integer result = null;
          if (codes.size() == 1) {
              Iterator iter = codes.iterator();
              result = (Integer)iter.next();
          }
          return result;
      }
      
      
      public boolean compareValues(String path, String name, String expectedValue, String receivedValue) {
          boolean result = true;
          
          // check now if this name is excluded from checking
          if (existsInConfig(path, name)) {
              return true;
          }
          
          // hard coded for now, should be configurable in the config file:
          //    allow multiple response codes to be checked against
          if (getPathName(path, name).equals("/multistatus/response/status")) {
              List    expectedResponseCodes = TProcessors.responseStatus(expectedValue);
              Integer receivedResponseCode  = getSingleResponseCode(TProcessors.responseStatus(receivedValue));
              //          System.out.println("#### " + getPathName(path, name));
              //          System.out.println("#### " + value1 + " --> " + expectedResponseCodes);
              //          System.out.println("#### " + value2 + " --> " + receivedResponseCode);
              if (receivedResponseCode != null &&
                  expectedResponseCodes.contains(receivedResponseCode)) return true;
          }
          
          // now perform the check and print out the error message
          if (!expectedValue.equals(receivedValue) && !expectedValue.equals("*")){
              xmlresult.writeElementStart("XMLValueError");
              xmlresult.writeElement("path", getPathName(path, name));
              xmlresult.writeElement("expectedValue", expectedValue);
              xmlresult.writeElement("receivedValue", receivedValue);
              xmlresult.writeElementEnd("XMLValueError");
              return false;
          }
          return result;
      }
      
      
      private List getChildNames(Element e, String pathName) {
          return getChildNames(e.getChildren(), pathName);
      }
      
      private List getChildNames(List l, String pathName) {
          List result = new ArrayList();
          Iterator iter = l.iterator();
          while (iter.hasNext()){
              result.add(getDisplayName((Element)iter.next(), pathName));
          }
          return result;
      }
      
      
      private String getPathName(String path, String element) {
          return path + "/" + element;
      }
      
      
      private String getPathName(String path, Element element) {
          return getPathName(path, element.getName());
      }
      
      
      private List sort(List l, String pathName) {
          Collections.sort(l, new ElementComparator(pathName));
          return l;
      }
      
      
      
      
      private String getDisplayName(Element e, String pathName) {
          String result = null;
          if (pathName.equals("/multistatus")){
              if (e.getChild("href", e.getNamespace()) == null) return "Error in reading href for XMLResponseAssert.getDisplayName";
              result = e.getChild("href", e.getNamespace()).getTextTrim();
              if (result.endsWith("/")){
                  result = result.substring(0,result.length()-1);
              }
          } else {
              result = e.getName();
          }
          return result;
      }
      
      
      
      private List getElementsWithDisplayName(List l, String searchPattern, String pathName) {
          List result = new ArrayList();
          Iterator iter = l.iterator();
          while (iter.hasNext()){
              Element e = (Element)iter.next();
              if (getDisplayName(e, pathName).equals(searchPattern)) {
                  result.add(e);
              }
          }
          return result;
      }
      
      
      
      
      /**************************************************************/
      /* Inner class to help to create a suitable comparator        */
      /**************************************************************/
      public class ElementComparator implements Comparator {
          String pathName;
          public ElementComparator(String pathName) {
              this.pathName = pathName;
          }
          public int compare(Object o1, Object o2){
              String s1 = getDisplayName(((Element)o1), pathName);
              String s2 = getDisplayName(((Element)o2), pathName);
              return (s1.compareTo(s2));
          }
      }
      
      
      
      
      
  }
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/ClassName.java
  
  Index: ClassName.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/ClassName.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tutil;
  
  import java.util.*;
  
  
  /**
   * Utility class for Java class names.
   *
   * @author    peter.nevermann@softwareag.com
   *
   * @version   0.1
   */
  public class ClassName {
      
      /**
       * The tokens
       */
      private List tokens = new ArrayList();
  
      
      /**
       * Default contructor
       *
       * @param      name   the fully qualified class name
       */
      public ClassName( String name ) {
          StringTokenizer st = new StringTokenizer( name, "." );
          
          while( st.hasMoreTokens() ) {
              tokens.add( st.nextToken() );
          }
      }
      
      /**
       * Return the un-qualified name.
       *
       * @return     the plain (un-qualified) class name
       */
      public String getPlainName() {
          if( tokens.isEmpty() ) {
              return null;
          }
          else {
              return (String) tokens.get( tokens.size() - 1 );
          }
      }
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/ExecuteHttpGet.java
  
  Index: ExecuteHttpGet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/ExecuteHttpGet.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tutil;
  
  import java.net.URL;
  import java.net.URLConnection;
  import java.io.InputStream;
  
  
  
  /**
   * Perform a test http get
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class ExecuteHttpGet {
      private static final String httpPrefix = "http://";
      
      // The method executing the task
      public void execute (String httpCmd) throws Exception {
          
          if (!httpCmd.startsWith (httpPrefix))
              httpCmd = httpPrefix + httpCmd;
          
          System.out.println("executing command: " + httpCmd);
          
          URL url = new URL (httpCmd);
          URLConnection connection = url.openConnection();
          connection.connect();
          
          int length = connection.getContentLength();
          byte [] buf = new byte [length];
          
          InputStream in = connection.getInputStream();
          
          int sum = 0;
          int bytesRead = 0;
          
          do {
              bytesRead = in.read (buf);
              System.out.write (buf, 0, bytesRead);
              sum += bytesRead;
          } while (sum < length);
          
          System.out.flush();
          in.close();
          
      }
      
      
      public static void main (String [] a) {
          String command = a [0];
          try {
              ExecuteHttpGet executer = new ExecuteHttpGet ();
              executer.execute (command);
          }
          
          catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/TArgs.java
  
  Index: TArgs.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/TArgs.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tutil;
  
  import java.util.*;
  
  
  
  /********************************************************************************
  *  Args.java
  *  <BR><BR><B><U> General description of Args.java </U></B><BR>
  *  <UL>
  *   provides a simple mechanism for reading command line arguments
  *  <p>
  *  The command line options are read into a hashmap and can be retrieved.
  *  <LI> A command line option having a value must start with '/' or '-' </LI>
  *  <LI> The value must be separated from option with one or more blanks (-d directory)</LI>
  *  <LI> An option need not to have a value  (-x)</LI>
  *  <LI> if an option is expected but does not start with '/' or '-', it is treated as
  *       option without a value (nodebug) </LI>
  *  <LI> The option is stored without the leading '/' or '-'</LI>
  *
  *  </UL>
  *  <BR><BR><B><U> <font color=red>Planned</font> features </U></B><BR>
  *  <UL>
  *  <LI>  </LI>
  *  </UL>
  * <B>History:</B><UL>
  * <LI>19981119 wam  Initial version</LI>
  * </UL>
   * @author Software AG
   * @version $Revision: 1.1 $
  ********************************************************************************/
  
  
  
  public class TArgs {
    private List  allowedTokens = new ArrayList ();
    private Map   container = new HashMap();
    private String[] args = null;
    
    
    /**
    * constructor.
    */
    public TArgs (String [] args) {
      String s;
      String key = null;
      String val = null;
      
      this.args = args;
      
      for (int i = 0; i < args.length; i++) {
        s = args[i];
        if (isOption (s)) {
          key = s.substring (1);
          if (i + 1 >= args.length) {
            val = null;
            container.put (key, val);
            // [PZA] does not work with break here !!!
            return;
          }
          
          if (isOption (args[i+1]))
            val = null;
          else
            val = args [++i];
        }
        else {
          key = s;
          val = null;
        }
        container.put (key, val);
      }
    }
  
    /**
     ** args
     **
     ** @pre
     ** @post
     **
     ** @return  the arguments as String array
     **
     **/
    public String[] args() {
      return args;
    }
    
    /**
    * checks, if the specified option is set
    */
    public boolean isOptionSet (String option) {
      return container.containsKey (option);
    }
    
    /*
    * returns the value of an option or null, if either not set or option has no value
    */
    public String get (String option) {
      return (String) container.get (option);
    }
    
    public static void main (String [] argv) {
      TArgs args = new TArgs (argv);
      
      System.out.println ("-d  is: " + args.get ("d"));
      System.out.println ("-x set? " + args.isOptionSet ("x"));
    }
  
    private boolean isOption (String s) {
      return (s.startsWith ("-") || s.startsWith("/")) ? true : false;
    }
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/XConf.java
  
  Index: XConf.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/XConf.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.tutil;
  
  import java.util.*;
  import java.io.*;
  import org.jdom.*;
  import org.jdom.input.*;
  
  /**
   * Reads the indicated XML file. This config file shall look like this:
   * <pre><code>
   * <config>
   *  <prop1>valueOfProp1</prop1>
   *  <
   *
   *
   *
   *
   * </config>
   
   
   * </code></pre>
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   *
   * @invariant
   *
   * @see
   *
   */
  public class XConf {
      
      /**
       * represents the configuration document
       *
       * @invariant (document != null)
       * @see        java.lang.String#equals
       */
      private Document cfgDoc;
      
      private Element rootElement;
      
      /**
       * Creates the document
       *
       * @pre        anInteger != 0
       * @post
       *
       * @param      confFile   the content object to be made persistent
       *
       * @exception  IOException
       * @exception  JDOMException
       *
       * @see
       */
      public XConf (File cfgFile) throws IOException, JDOMException {
          SAXBuilder sb = new SAXBuilder();
          cfgDoc = sb.build (cfgFile);
          rootElement = cfgDoc.getRootElement();
      }
      
      
      /**
       * Creates the document
       *
       * @pre        anInteger != 0
       * @post
       *
       * @param      confFile   the content object to be made persistent
       *
       * @exception  IOException
       * @exception  JDOMException
       *
       * @see
       */
      public XConf (Document doc) throws IOException, JDOMException {
          SAXBuilder sb = new SAXBuilder();
          cfgDoc = doc;
          rootElement = cfgDoc.getRootElement();
      }
      
      /**
       * returns the text value of an element. Key may contain '/'
       * (for example 'db/connectionstring')
       *
       * @pre        element != null
       * @post
       *
       * @param      element the elements name
       *
       * @return     the value of that property or null, if not in config
       * @exception  JDOMException
       *
       *
       * @see
       */
      public String getProperty (String key) {
          Element el = getElement(key);
          return (el == null) ? null : el.getTextTrim();
      }
      
      /**
       * Returns a List of properties. Key may contain '/'
       * (for example 'db/connectionstring'). The element identified
       * by 'key' must have 0 or more nested elements, the text value
       * of those elements will be returned.
       *
       *
       * @pre        element != null
       * @post
       *
       * @param      element the elements name
       *
       * @return     the value of that property or null, if not in config
       * @exception  JDOMException
       *
       *
       * @see
       */
      public List getPropertyList (String key) {
          
          List result = new ArrayList();
          
          Element father = getElement (key);
          if (father == null)
              return result;
          
          List children = father.getChildren();
          for (int i = 0; i < children.size(); i++)
              result.add( ((Element)children.get(i)).getTextTrim() );
          
          return result;
      }
      
      /**
       * Returns a List of properties. fatherKey may contain '/'
       * (for example 'db/connectionstring'). The element identified
       * by 'father' must have 0 or more nested elements, the text value
       * of those elements plus the values of father combined with key
       * will be returned.
       *
       *
       * @pre        key != null
       * @pre        father != null
       * @post       result != null
       *
       * @param      fatherKey the key of the father path (may contain /)
       * @param      key       the key combined with father and added to the result
       *
       * @return     the values of that properties or empty, if not in config
       * @exception  JDOMException
       *
       *
       */
      public List getPropertyList (String fatherKey, String key) {
          
          List result  = getPropertyList(fatherKey);
          result.addAll(getPropertyList(fatherKey+"/"+key));
          
          return result;
      }
      
      
      
      
      
      private Element getElement (String key) {
          StringTokenizer st = new StringTokenizer(key, "/");
          
          Element father = rootElement;
          Element child = null;
          while (st.hasMoreTokens()) {
              String childKey = st.nextToken();
              child = father.getChild (childKey);
              if (child == null)
                  return null;
              father = child;
          }
          return father;
      }
      
      
      public static void main (String [] a) throws Exception {
          XConf conf = new XConf (new File (a[0]));
          System.out.println (conf.getPropertyList ("otto/taminobase"));
          System.out.println (conf.getProperty ("tamino/taminobase"));
          
          System.out.println(conf.getPropertyList ("excludedHeaderProperties", "propfind"));
          System.out.println(conf.getPropertyList ("excludedHeaderProperties/propfind"));
      }
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/DirectoryWalker.java
  
  Index: DirectoryWalker.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/DirectoryWalker.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.walker;
  
  //Java import
  import java.io.*;
  
  
  /**
   * Walk a directory and perform a specified job on selected files
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class DirectoryWalker {
      private WalkerFilter filter;
      
      /**
       * Constructor. The starting path (eg C:\, D:\TEMP\) is passed to start the Walker
       * @param     String        Path where to start
       * @param     String[]      Files to be filtered
       * @param     String[]      Files to be excluded
       */
      public DirectoryWalker(String path, String[] filterValues, String[] excludeList, WalkerJob job) {
          filter = new WalkerFilter();
          for (int i = 0; i < filterValues.length; i++) {
              filter.includeFileName(filterValues[i]);
          }
          for (int i = 0; i < excludeList.length; i++) {
              filter.excludeFileName(excludeList[i]);
          }
          walkDirectory(path,job);
      }
      
      /**
       * Constructor. The starting path (eg C:\, D:\TEMP\) is passed to start the Walker
       * @param     String        Path where to start
       * @param     String[]      Files to be filtered
       */
      public DirectoryWalker(String path, String[] filterValues, WalkerJob job)
      {
          filter = new WalkerFilter();
          for (int i = 0; i < filterValues.length; i++) {
              filter.includeFileName(filterValues[i]);
          }
          walkDirectory(path,job);
      }
      
      /**
       * This allows Walker to walk through the directories looking for files of the given filter
       * @param     String
       * @param     int
       * @param     String
       */
      public void walkDirectory(String path, WalkerJob job) {
          try {
              File rootFile = new File(path);
              String[] fileList = rootFile.list();
              for (int i = 0; i < fileList.length; i++)
              {
                  File currentFile = new File(path+File.separatorChar+fileList[i]);
                  if (!currentFile.isDirectory() && filter.accept(currentFile,path)) {
                      job.job(currentFile.getPath());
                  }
                  if (currentFile.isDirectory()) {
                      walkDirectory(path+File.separatorChar+currentFile.getName(), job);
                  }
              }
          }
          catch (Exception e) {e.printStackTrace();}
      }
      
      
      
      
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/MultiTProcessorExecuter.java
  
  Index: MultiTProcessorExecuter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/MultiTProcessorExecuter.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.walker;
  
  //TProcessor import
  import org.apache.slide.testsuite.testtools.tprocessor.TProcessors;
  //java
  import java.io.PrintStream;
  import java.io.FileOutputStream;
  
  
  /**
   * Call T_Processor for a set of specified patterns
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class MultiTProcessorExecuter {
      
      private String xdavHome = System.getProperty("xdav.home");
      private String xdavHost = System.getProperty("xdav.host");
      private String xdavPort = System.getProperty("xdav.port");
      
      private static PrintStream  resultOutput = null;
      private static boolean      result       = true;
      
      
      /**
       ** Constructor that creates the GenericBeanContextChildTest with the given name.
       ** Constructor description
       **
       ** @pre        true
       ** @post       true
       **
       ** @param      name the given name
       **
       ** @category   procedure
       **/
      public MultiTProcessorExecuter() {
          if (xdavHome == null) {
              System.out.println("xdav.home is not set!");
              throw new Error("xdav.home is not set!");
          }
          xdavHome = xdavHome+java.io.File.separatorChar+"testsuite";
          xdavHome = xdavHome+java.io.File.separatorChar+"junit";
          xdavHome = xdavHome+java.io.File.separatorChar+"xmltestcases";
      }
      
      
      
      public void exceuteAllSpecifiedXMLFileByTProcessor(String[] filter) throws Exception {
          
          final int[] testCaseCount = new int[2];
          
          testCaseCount[0] = 0;
          testCaseCount[1] = 0;
          
          resultOutput = new java.io.PrintStream(new FileOutputStream(xdavHome+java.io.File.separatorChar+".."+java.io.File.separatorChar+"testCasesResults.xml"));
          
          long time = System.currentTimeMillis();
          java.util.Date startDate = new java.util.Date();
          
          resultOutput.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
          resultOutput.println("<!DOCTYPE testSuite SYSTEM \"\\\\bolrep2\\projects\\xdavNC\\TaTooDev\\xdav\\testsuite\\junit\\testCasesResults.dtd\">");
          resultOutput.println("<testSuite>");
          resultOutput.println("   <excecutionDate>" + new java.text.SimpleDateFormat("dd.MM.yy HH:mm").format(startDate) + "</excecutionDate>");
          resultOutput.println("   <resultFileName>" + xdavHome+java.io.File.separatorChar+".."+java.io.File.separatorChar+"testCasesResults.xml" + "</resultFileName>");
          
          String[] exclude = new String[1];
          exclude[0] = "CVS";
          DirectoryWalker walker = new DirectoryWalker(xdavHome, filter, exclude, new WalkerJob() {
                      public void job(String jobName) {
                          String[] parameters = new String[2];
                          parameters[0] = "-name";
                          parameters[1] = jobName;
  //                      System.out.println(jobName);
                          if (!TProcessors.mainExecuter(parameters, resultOutput, testCaseCount))
                              result = false;
                              //assert("Wrong extension found " + jobName, jobName.endsWith("xml"));
                      }
                  }
              );
          
          
          resultOutput.println("   <result>" + (!result?"ERROR":"Success") + "</result>");
          resultOutput.println("   <time>" + ((System.currentTimeMillis() - time)) + "</time>");
          resultOutput.println("   <testElementCount>" + testCaseCount[0] + "</testElementCount>");
          resultOutput.println("   <testElementErrors>" + testCaseCount[1] + "</testElementErrors>");
          resultOutput.println("</testSuite>");
          resultOutput.close();
          
          
          
          System.out.println();
          System.out.println();
          System.out.println();
          System.out.println();
          System.out.println();
          System.out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
          System.out.println("<!DOCTYPE testSuite SYSTEM \"\\\\bolrep2\\projects\\xdavNC\\TaTooDev\\xdav\\testsuite\\junit\\testCasesResults.dtd\">");
          System.out.println("<testSuite>");
          System.out.println("   <excecutionDate>" + new java.text.SimpleDateFormat("dd.MM.yy HH:mm").format(startDate) + "</excecutionDate>");
          System.out.println("   <resultFileName>" + xdavHome+java.io.File.separatorChar+".."+java.io.File.separatorChar+"testCasesResults.xml" + "</resultFileName>");
          System.out.println("   <result>" + (!result?"ERROR":"Success") + "</result>");
          System.out.println("   <time>" + ((System.currentTimeMillis() - time)) + "</time>");
          System.out.println("   <testElementCount>" + testCaseCount[0] + "</testElementCount>");
          System.out.println("   <testElementErrors>" + testCaseCount[1] + "</testElementErrors>");
          System.out.println("</testSuite>");
          System.out.println();
          System.out.println();
          
          
      }
      
      
      public static void main(String[] args) {
          for (int i=0; i < args.length; i++) {
              if (!args[i].endsWith(".xml")) args[i] = args[i] + ".xml";
              if (!args[i].startsWith("*"))  args[i] = "*" + args[i];
              System.out.println("Arguments found : " + args[i]);
          }
          try { new MultiTProcessorExecuter().exceuteAllSpecifiedXMLFileByTProcessor(args); }
          catch (Exception e) { e.printStackTrace(); }
      }
      
      
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/TProcessorTestExecuter.java
  
  Index: TProcessorTestExecuter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/TProcessorTestExecuter.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.walker;
  
  
  import junit.framework.*;
  import org.apache.slide.testsuite.testtools.tprocessor.TProcessors;
  import java.io.File;
  import java.io.*;
  
  //import org.apache.slide.testsuite.common.*;
  //import org.apache.slide.testsuite.jdomobjects.*;
  
  import org.jdom.*;
  import org.jdom.input.*;
  
  
  /**
   * Call T_Processor for all XML files located in a specified directory
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class TProcessorTestExecuter extends TestCase {
      
      
      
      private String xdavHome = System.getProperty("xdav.home");
      private String xdavHost = System.getProperty("xdav.host");
      private String xdavPort = System.getProperty("xdav.port");
      
      
      /**
       ** Constructor that creates the GenericBeanContextChildTest with the given name.
       ** Constructor description
       **
       ** @pre        true
       ** @post       true
       **
       ** @param      name the given name
       **
       ** @category   procedure
       **/
      public TProcessorTestExecuter(String name) {
          super( name );
          if (xdavHome == null) {
              System.out.println("xdav.home is not set!");
              throw new Error("xdav.home is not set!");
          }
          
          xdavHome = xdavHome+java.io.File.separatorChar+"testsuite";
          xdavHome = xdavHome+java.io.File.separatorChar+"junit";
          xdavHome = xdavHome+java.io.File.separatorChar+"xmltestcases";
      }
      
      
      
      
      static PrintStream  resultOutput = null;
      static boolean      result       = true;
      public void testExceuteAllXMLFileByTProcessor() throws Exception {
          
          final int[] testCaseCount = new int[2];
          
          testCaseCount[0] = 0;
          testCaseCount[1] = 0;
          
          resultOutput = new java.io.PrintStream(new FileOutputStream(xdavHome+java.io.File.separatorChar+".."+java.io.File.separatorChar+"testCasesResults.xml"));
          
          long time = System.currentTimeMillis();
          java.util.Date startDate = new java.util.Date();
          
          resultOutput.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
          resultOutput.println("<!DOCTYPE testSuite SYSTEM \"\\\\bolrep2\\projects\\xdavNC\\TaTooDev\\xdav\\testsuite\\junit\\testCasesResults.dtd\">");
          resultOutput.println("<testSuite>");
          resultOutput.println("   <excecutionDate>" + new java.text.SimpleDateFormat("dd.MM.yy HH:mm").format(startDate) + "</excecutionDate>");
          resultOutput.println("   <resultFileName>" + xdavHome+java.io.File.separatorChar+".."+java.io.File.separatorChar+"testCasesResults.xml" + "</resultFileName>");
          
          
          String[] filter = new String[1];
          filter[0] = "*.xml";
          String[] exclude = new String[1];
          exclude[0] = "CVS";
          DirectoryWalker walker = new DirectoryWalker(xdavHome, filter, exclude, new WalkerJob()
                                                       {
                      public void job(String jobName)
                      {
                          String[] parameters = new String[2];
                          parameters[0] = "-name";
                          parameters[1] = jobName;
                          if (!TProcessors.mainExecuter(parameters, resultOutput, testCaseCount))
                              result = false;
                          assert("Wrong extension found " + jobName, jobName.endsWith("xml"));
                      }
                  }
                                                      );
          
          resultOutput.println("   <result>" + (!result?"ERROR":"Success") + "</result>");
          resultOutput.println("   <time>" + ((System.currentTimeMillis() - time)) + "</time>");
          resultOutput.println("   <testElementCount>" + testCaseCount[0] + "</testElementCount>");
          resultOutput.println("   <testElementErrors>" + testCaseCount[1] + "</testElementErrors>");
          resultOutput.println("</testSuite>");
          resultOutput.close();
          
          
          
          System.out.println();
          System.out.println();
          System.out.println();
          System.out.println();
          System.out.println();
          System.out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
          System.out.println("<!DOCTYPE testSuite SYSTEM \"\\\\bolrep2\\projects\\xdavNC\\TaTooDev\\xdav\\testsuite\\junit\\testCasesResults.dtd\">");
          System.out.println("<testSuite>");
          System.out.println("   <excecutionDate>" + new java.text.SimpleDateFormat("dd.MM.yy HH:mm").format(startDate) + "</excecutionDate>");
          System.out.println("   <resultFileName>" + xdavHome+java.io.File.separatorChar+".."+java.io.File.separatorChar+"testCasesResults.xml" + "</resultFileName>");
          System.out.println("   <result>" + (!result?"ERROR":"Success") + "</result>");
          System.out.println("   <time>" + ((System.currentTimeMillis() - time)) + "</time>");
          System.out.println("   <testElementCount>" + testCaseCount[0] + "</testElementCount>");
          System.out.println("   <testElementErrors>" + testCaseCount[1] + "</testElementErrors>");
          System.out.println("</testSuite>");
          System.out.println();
          System.out.println();
          
          
          
      }
      
      
      
  }
  
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/WalkerFilter.java
  
  Index: WalkerFilter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/WalkerFilter.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.walker;
  
  //Java imports
  import java.util.*;
  import java.io.*;
  // pattern matcher
  import org.apache.oro.text.awk.*;
  import org.apache.oro.text.regex.*;
  
  
  /**
   * Implement a Filter class (include, exclude) to check file name against
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class WalkerFilter {
      
      private ArrayList   includeFilter   = new ArrayList();
      private ArrayList   excludeFilter   = new ArrayList();
      private AwkCompiler patternCompiler = new AwkCompiler();
      private AwkMatcher  patternMatcher  = new AwkMatcher();
      
      
      /**
       * Add a fileName to the filter. Eg. *.*, *.xml, WalkerFilter.java etc
       * @param     String        Name of the file to include
       */
      public void includeFileName(String fileName) {
          try {
              if (fileName != null)
                  includeFilter.add(patternCompiler.compile(standardPattern(fileName)));
          }
          catch (Exception e) { e.printStackTrace(); }
      }
      
      public void excludeFileName(String fileName) {
          try {
              if (fileName != null)
                  excludeFilter.add(patternCompiler.compile(standardPattern(fileName)));
          }
          catch (Exception e) { e.printStackTrace(); }
      }
      
      /**
       * Is the given file acceptable part of the filter.
       * @param     java.io.File
       * @param     String
       * @return    boolean
       */
      public boolean accept(java.io.File file, String path) {
          boolean result = false;
          String fileName = path + File.separatorChar + file.getName();
          
          //Check to see if the file name is part of the filter
          Iterator include = includeFilter.iterator();
          while (include.hasNext()) {
              Pattern element = (Pattern)include.next();
  //          System.out.println("Include (" + element.getPattern() + " , " + fileName + " )= " + patternMatcher.matches(fileName, element));
              if (patternMatcher.matches(fileName, element)) result = true;
          }
          
          //Check to see if the file name is part of the filter
          Iterator exclude = excludeFilter.iterator();
          while (exclude.hasNext()) {
              Pattern element = (Pattern)exclude.next();
              if (patternMatcher.matches(fileName, element)) result = false;
  //          System.out.println("Exclude (" + element.getPattern() + " , " + fileName + " )= " + patternMatcher.matches(fileName, element));
          }
          
  //      System.out.println("RESULT = " + result);
  //      System.out.println();
          
          return result;
      }
      
      
      /**
       * This method is used to replace variables in a string
       * @param line the string which will be modified
       * @param pattern search string to be replaced
       * @param value value of the replace string
       * @return value of line, with all applied replacements
       */
      private static String standardPattern(String line){
          return replace(replace(line, ".", "\\."), "*", ".*");
      }
      
      
      
      /**
       * This method is used to replace variables in a string
       * @param line the string which will be modified
       * @param pattern search string to be replaced
       * @param value value of the replace string
       * @return value of line, with all applied replacements
       */
      private static String replace(String line, String pattern, String value){
          int lastFound = line.indexOf(pattern);
          while (lastFound != -1){
              line = line.substring(0, lastFound) +
                  value +
                  line.substring(lastFound + pattern.length());
              lastFound = line.indexOf(pattern, lastFound+pattern.length()+1);
          }
          //      System.out.println("#### Replaced " + pattern + " with " + value + " --> " + line);
          return line;
      }
      
      
      
      
  }
  
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/WalkerJob.java
  
  Index: WalkerJob.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/WalkerJob.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.walker;
  
  /**
   * Job interface for the Walkers
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public interface WalkerJob {
    public void job (String fileName);
  }
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/WalkerTest.java
  
  Index: WalkerTest.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/WalkerTest.java,v 1.1 2001/11/20 14:35:31 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2001/11/20 14:35:31 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.testsuite.testtools.walker;
  
  
  import junit.framework.*;
  
  /**
   * Junit test for the file Walker
   *
   * @author Software AG
   * @version $Revision: 1.1 $
   */
  public class WalkerTest extends TestCase {
      
      
      
      private String xdavHome = System.getProperty("xdav.home");
      private String xdavHost = System.getProperty("xdav.host");
      private String xdavPort = System.getProperty("xdav.port");
      
      
      
      /**
       ** Constructor WalkerTest.
       **/
      public WalkerTest(String name) {
          super( name );
          if (xdavHome == null) {
              System.out.println("xdav.home is not set!");
              throw new Error("xdav.home is not set!");
          }
          xdavHome = xdavHome+java.io.File.separatorChar+"testsuite";
          xdavHome = xdavHome+java.io.File.separatorChar+"src";
          xdavHome = xdavHome+java.io.File.separatorChar+"com";
          xdavHome = xdavHome+java.io.File.separatorChar+"softwareag";
          xdavHome = xdavHome+java.io.File.separatorChar+"xtools";
          xdavHome = xdavHome+java.io.File.separatorChar+"xdav";
          xdavHome = xdavHome+java.io.File.separatorChar+"testtools";
          xdavHome = xdavHome+java.io.File.separatorChar+"walker";
          xdavHome = xdavHome+java.io.File.separatorChar+"toBeWalked1";
          
      }
      
      /**
       * walk a directory and check for extensions w1 and w2
       */
      public void testWalker() throws Exception {
          String[] filter = new String[2];
          filter[0] = "*.w1";
          filter[1] = "*.w2";
          String[] exclude = new String[1];
          exclude[0] = "CVS";
          DirectoryWalker walker = new DirectoryWalker(xdavHome, filter, exclude, new WalkerJob() {
                      public void job(String jobName) {
                          //System.out.println(jobName);
                          assert("Wrong extension found " + jobName, jobName.endsWith("w1") || jobName.endsWith("w2"));
                      }
                  }
                                                      );
      }
      
      
      
      
  }
  
  
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/toBeWalked1/WalkerTest.w1
  
  	<<Binary file>>
  
  
  1.1                  jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/walker/toBeWalked1/toBeWalked2/WalkerTest.w2
  
  	<<Binary file>>
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>