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/12/16 17:53:02 UTC

cvs commit: jakarta-slide/src/tests/client TestXMLResponseMethodBase.java

juergen     2002/12/16 08:53:02

  Modified:    src/tests/client TestXMLResponseMethodBase.java
  Log:
  new http client adaptions.
  
  Revision  Changes    Path
  1.6       +55 -55    jakarta-slide/src/tests/client/TestXMLResponseMethodBase.java
  
  Index: TestXMLResponseMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/tests/client/TestXMLResponseMethodBase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestXMLResponseMethodBase.java	11 Oct 2002 01:32:16 -0000	1.5
  +++ TestXMLResponseMethodBase.java	16 Dec 2002 16:53:02 -0000	1.6
  @@ -65,73 +65,73 @@
   
   import java.io.*;
   import java.util.*;
  -import org.apache.commons.httpclient.State;
  +import org.apache.commons.httpclient.HttpState;
   import org.apache.commons.httpclient.HttpException;
   import org.apache.commons.httpclient.HttpMethodBase;
   import org.apache.webdav.lib.*;
   import org.apache.webdav.lib.methods.*;
   import org.apache.util.WebdavStatus;
   
  -public class TestXMLResponseMethodBase 
  +public class TestXMLResponseMethodBase
   {
       /* prevent the gump
  -	public TestXMLResponseMethodBase() { }
  +    public TestXMLResponseMethodBase() { }
   
  -	public void testGetStatusCode(String responseBody) throws Exception
  -	{
  -		XMLResponseMethodBase test1 = new XMLResponseMethodBase();
  -		InputStream data = new ByteArrayInputStream(responseBody.getBytes());
  -		test1.setStatusCode(WebdavStatus.SC_MULTI_STATUS);
  -		test1.parseResponse(data);
  -		test1.setUsed();
  -		test1.setState(new State());
  -		
  -		Enumeration responses = test1.getResponses();
  -		while (responses.hasMoreElements()) {
  -		    ResponseEntity response = (ResponseEntity) responses.nextElement();
  -		    String href = response.getHref();
  -			int status = response.getStatusCode();
  -			System.out.println(href + "   " + status);
  -			
  -			Enumeration responseProperties = response.getProperties();
  -			while (responseProperties.hasMoreElements()) {
  -			    Property property = (Property) responseProperties.nextElement();
  -			    System.out.println("   " + property.getLocalName() + "   " + property.getPropertyAsString() + "   " + property.getStatusCode());
  -			}
  -		}
  -	}
  +    public void testGetStatusCode(String responseBody) throws Exception
  +    {
  +        XMLResponseMethodBase test1 = new XMLResponseMethodBase();
  +        InputStream data = new ByteArrayInputStream(responseBody.getBytes());
  +        test1.setStatusCode(WebdavStatus.SC_MULTI_STATUS);
  +        test1.parseResponse(data);
  +        test1.setUsed();
  +        test1.setState(new State());
  +
  +        Enumeration responses = test1.getResponses();
  +        while (responses.hasMoreElements()) {
  +            ResponseEntity response = (ResponseEntity) responses.nextElement();
  +            String href = response.getHref();
  +            int status = response.getStatusCode();
  +            System.out.println(href + "   " + status);
  +
  +            Enumeration responseProperties = response.getProperties();
  +            while (responseProperties.hasMoreElements()) {
  +                Property property = (Property) responseProperties.nextElement();
  +                System.out.println("   " + property.getLocalName() + "   " + property.getPropertyAsString() + "   " + property.getStatusCode());
  +            }
  +        }
  +    }
   
       public static void main(String[] args)
       {
   
  -    	try 
  -    	{
  +        try
  +        {
               TestXMLResponseMethodBase test = new TestXMLResponseMethodBase();
               test.testGetStatusCode(
  -				"<multistatus xmlns=\"DAV:\"><response>" + 
  -					"<href>/slide/files/</href>" + 
  -					"<propstat>" +
  -						"<prop><displayname>test200</displayname></prop>" +
  -						"<status>HTTP/1.1 200 OK</status>" +
  -					"</propstat>" +
  -					"<propstat>" +
  -						"<prop><displayname2>test201</displayname2></prop>" +
  -						"<status>HTTP/1.1 201 OK</status>" +
  -					"</propstat>" +
  -				"</response></multistatus>");
  -				
  -			test.testGetStatusCode(
  -				"<multistatus xmlns=\"DAV:\"><response>" + 
  -					"<href>/slide/files/</href>" + 
  -					"<href>/slide/files/a</href>" + 
  -					"<status>HTTP/1.1 200 OK</status>" +
  -				"</response></multistatus>");
  -			
  -    	}
  -    	catch (Exception ex) 
  -    	{
  -    		ex.printStackTrace();
  -    	}
  +                "<multistatus xmlns=\"DAV:\"><response>" +
  +                    "<href>/slide/files/</href>" +
  +                    "<propstat>" +
  +                        "<prop><displayname>test200</displayname></prop>" +
  +                        "<status>HTTP/1.1 200 OK</status>" +
  +                    "</propstat>" +
  +                    "<propstat>" +
  +                        "<prop><displayname2>test201</displayname2></prop>" +
  +                        "<status>HTTP/1.1 201 OK</status>" +
  +                    "</propstat>" +
  +                "</response></multistatus>");
  +
  +            test.testGetStatusCode(
  +                "<multistatus xmlns=\"DAV:\"><response>" +
  +                    "<href>/slide/files/</href>" +
  +                    "<href>/slide/files/a</href>" +
  +                    "<status>HTTP/1.1 200 OK</status>" +
  +                "</response></multistatus>");
  +
  +        }
  +        catch (Exception ex)
  +        {
  +            ex.printStackTrace();
  +        }
       }
       */
   }
  
  
  

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