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 Tue, 18 Dec 2001 18:58:21 GMT
rlubke      01/12/18 10:58:21

  Modified:    src/tools/org/apache/tomcat/task GTest.java
  Log:
  Relocated code to display server response and goldenfile contents
  in response to an error into the compareweak() Method.
  
  Revision  Changes    Path
  1.6       +24 -7     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GTest.java	2001/12/18 03:39:40	1.5
  +++ GTest.java	2001/12/18 18:58:20	1.6
  @@ -941,12 +941,17 @@
       private boolean compareWeak( byte[] fromServer, byte[] fromGoldenFile ) {
           if ( fromServer == null || fromGoldenFile == null ) {
               return false;
  -	}
  +	    }
   
  -        StringTokenizer st1 = new StringTokenizer( new String( fromServer ) );
  +        boolean status = true;
   
  -        StringTokenizer st2 = new StringTokenizer( new String( fromGoldenFile ) );
  +        String server = new String( fromServer );
  +        String golden = new String( fromGoldenFile );
   
  +        StringTokenizer st1 = new StringTokenizer( server );
  +
  +        StringTokenizer st2 = new StringTokenizer( golden );
  +
           while ( st1.hasMoreTokens() && st2.hasMoreTokens() ) {
               String tok1 = st1.nextToken();
               String tok2 = st2.nextToken();
  @@ -954,15 +959,27 @@
               if ( !tok1.equals( tok2 ) ) {
                   System.out.println( "\t FAIL*** : Rtok1 = " + tok1
                                       + ", Etok2 = " + tok2 );
  -                return false;
  +                status = false;
               }
           }
   
           if ( st1.hasMoreTokens() || st2.hasMoreTokens() ) {
  -            return false;
  -        } else {
  -            return true;
  +             status = false;
  +        }
  +
  +        if ( !status ) {
  +            StringBuffer sb = new StringBuffer( 255 );
  +            sb.append( "ERROR: Server's response and configured goldenfile do not match!\n"
);
  +            sb.append( "Response received from server:\n" );
  +            sb.append( "---------------------------------------------------------\n" );
  +            sb.append( server );
  +            sb.append( "\nContent of Goldenfile:\n" );
  +            sb.append( "---------------------------------------------------------\n" );
  +            sb.append( golden );
  +            sb.append( "\n" );
  +            System.out.println( sb.toString() );
           }
  +        return status;
       }
   
       /**
  
  
  

--
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