jakarta-slide-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From juer...@apache.org
Subject cvs commit: jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor XMLResponseBodyAssert.java
Date Fri, 02 Aug 2002 12:12:22 GMT
juergen     2002/08/02 05:12:22

  Modified:    testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor
                        XMLResponseBodyAssert.java
  Log:
  1) 409 may deliver a response body.
  2) report an error if only one of received and expected response body is available
  
  Revision  Changes    Path
  1.12      +41 -15    jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/XMLResponseBodyAssert.java
  
  Index: XMLResponseBodyAssert.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/XMLResponseBodyAssert.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XMLResponseBodyAssert.java	1 Aug 2002 13:32:17 -0000	1.11
  +++ XMLResponseBodyAssert.java	2 Aug 2002 12:12:22 -0000	1.12
  @@ -124,14 +124,47 @@
        * checks if Expected Response and Response are same
        */
       public boolean assertResponseBody(){
  -        if (method.getStatusCode() == 409  ){ // 409/conflict never delievers a XML body
  +
  +        // check if both expected and received bodies are not available
  +        if ((expectedXmlTree == null) &&
  +                ((responseDocument() == null) || responseDocument().getRootElement() ==
null) )
               return true;
  -        }
           
  +//      // some debugging output
  +//      // START
  +//      System.out.println("#########################");
  +//      System.out.println("####### method = " + method.getName());
  +//      System.out.println("####### expected ########");
  +//      if (expectedXmlTree != null)
  +//          System.out.println(TProcessors.getElementString(expectedXmlTree));
  +//      else
  +//          System.out.println("####### NOT PRESENT");
  +//      System.out.println("####### received ########");
  +//      if (responseDocument() != null && responseDocument().getRootElement() !=
null)
  +//          System.out.println(TProcessors.getElementString(responseDocument().getRootElement()));
  +//      else
  +//          System.out.println("####### NOT PRESENT");
  +//      System.out.println("#########################");
  +//      System.out.println();
  +//      // STOP
  +//      // some debugging output
  +
  +        
  +        
  +        // check if either expected and received bodies are not available
           if (expectedXmlTree == null ||
               responseDocument() == null ||
  -            responseDocument().getRootElement()== null)
  -            return true;
  +            responseDocument().getRootElement()== null) {
  +            
  +            xmlresult.writeElementStart("XMLValueError");
  +            xmlresult.writeElement("expectedValue", expectedXmlTree==null?"not present":"present");
  +            xmlresult.writeElement("receivedValue", responseDocument()==null?"not present":"present");
  +            xmlresult.writeElementEnd("XMLValueError");
  +            
  +            return false;
  +        }
  +        
  +        // both expected and received bodies are now available
           return compareTrees(expectedXmlTree, responseDocument().getRootElement());
       }
       
  @@ -140,14 +173,6 @@
       
       
       public boolean compareTrees(Element element1, Element element2) {
  -//      System.out.println("#########################");
  -//      System.out.println("####### method = " + method.getName());
  -//      System.out.println("####### expected ########");
  -//      System.out.println(TProcessors.getElementString(element1));
  -//      System.out.println("####### received ########");
  -//      System.out.println(TProcessors.getElementString(element2));
  -//      System.out.println("#########################");
  -//      System.out.println();
           return compareTrees("", element1, element2);
       }
       
  @@ -439,5 +464,6 @@
       
       
   }
  +
   
   
  
  
  

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


Mime
View raw message