jakarta-watchdog-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rlu...@apache.org
Subject cvs commit: jakarta-watchdog-4.0/src/tools/org/apache/tomcat/task GTest.java
Date Thu, 17 Jan 2002 14:18:46 GMT
rlubke      02/01/17 06:18:46

  Modified:    src/tools/org/apache/tomcat/task GTest.java
  Log:
  Updated GTest per an issue reported on the tomcat-dev list.
  
   - Added a flexible check for a response content-type header.
     Before, if a server appended an encoding onto the content-type
     and GTest wasn't expecting the encoding, the test would fail.
     Now, if GTest is configured to look only for the content-type,
     and it finds the server response contains the encoding, it will
     match the header.
  
  Revision  Changes    Path
  1.11      +23 -2     jakarta-watchdog-4.0/src/tools/org/apache/tomcat/task/GTest.java
  
  Index: GTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-watchdog-4.0/src/tools/org/apache/tomcat/task/GTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- GTest.java	11 Jan 2002 22:01:55 -0000	1.10
  +++ GTest.java	17 Jan 2002 14:18:46 -0000	1.11
  @@ -584,8 +584,29 @@
                
                               for ( int i = 0; i < eSize; i++ ) {
                                   currentHeaderValue = (String) expectValues.get( i );
  -
  -                                if ( headerValues.contains( currentHeaderValue ) ) {
  +				                
  +                                /*
  +                                 * Handle the Content-Type header appropriately
  +                                 * based on the the test is configured to look for.
  +                                 */
  +                                if ( currentHeaderField.equalsIgnoreCase( "content-type"
) ) {
  +                                    String resVal = (String) headerValues.get( 0 );
  +                                    if ( currentHeaderValue.indexOf( ';' ) > -1 ) {
  +                                        if ( debug > 0 ) {
  +                                            System.out.println( " Exact match for Content-Type
header required." );
  +                                        }
  +                                        if ( currentHeaderValue.equals( resVal ) ) {
  +                                            numberFound++;
  +                                            headerValues.remove( 0 );
  +                                        }
  +                                    } else if ( resVal.indexOf( currentHeaderValue ) >
-1 ) {
  +                                        if ( debug > 0 ) {
  +                                            System.out.println( " Approximate match for
Content-Type header required." );
  +                                        }
  +                                        numberFound++;
  +                                        headerValues.remove( 0 );
  +                                    }
  +                                } else if ( headerValues.contains( currentHeaderValue )
) {
                                       numberFound++;
                                       headerValues.remove( headerValues.indexOf( currentHeaderValue
) );
                                   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:watchdog-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:watchdog-dev-help@jakarta.apache.org>


Mime
View raw message