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 2002/11/01 15:06:36 UTC

cvs commit: jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor UpdateAssert.java

juergen     2002/11/01 06:06:36

  Modified:    testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor
                        UpdateAssert.java
  Log:
  normalised url in the update method.
  
  Revision  Changes    Path
  1.3       +38 -16    jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/UpdateAssert.java
  
  Index: UpdateAssert.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/UpdateAssert.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UpdateAssert.java	14 Aug 2002 15:36:13 -0000	1.2
  +++ UpdateAssert.java	1 Nov 2002 14:06:36 -0000	1.3
  @@ -66,6 +66,7 @@
   
   // Slide
   import org.apache.webdav.lib.methods.XMLResponseMethodBase;
  +import org.apache.util.URLUtil;
   // jdom
   import org.jdom.Element;
   //test package
  @@ -81,22 +82,22 @@
    * @version $Revision$
    */
   public class UpdateAssert extends XMLResponseBodyAssert {
  -    
  -    
  +
  +
       /** constructor
        */
       public UpdateAssert(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 assertResponseBody(){
  -        
  +
   //      if (method.getStatusCode() == 204 ||
   //          method.getStatusCode() == 403 ||
   //          method.getStatusCode() == 409 ||
  @@ -105,11 +106,32 @@
   //          method.getStatusCode() == 412  ){
   //          return true;
   //      }
  -         
  +
           return super.assertResponseBody();
       }
  -    
  -    
  -    
  -    
  +
  +
  +    public boolean compareValues(String path, String name, String value1, String value2) {
  +        // ignore leading and trailing "/" in the href section and un-escape
  +        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());
  +            }
  +            try {value1 = URLUtil.URLDecode(value1, "UTF-8");} catch (Exception e) { }
  +            try {value2 = URLUtil.URLDecode(value2, "UTF-8");} catch (Exception e) { }
  +        }
  +        return super.compareValues(path, name, value1, value2);
  +    }
  +
  +
  +
   }
  
  
  

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