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 pn...@apache.org on 2003/05/26 14:46:09 UTC

cvs commit: jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/resources test3.xml

pnever      2003/05/26 05:46:09

  Modified:    proposals/wvcm/test/junit/src/org/apache/wvcm/store/webdav
                        MultistatusResponseTest.java PropertiesTest.java
                        ReportRequestTest.java
               proposals/wvcm/test/junit/src/org/apache/webdav/methods
                        AbstractTest.java PropfindMethodTest.java
                        ProppatchMethodTest.java PutMethodTest.java
                        ReportMethodTest.java VersionControlMethodTest.java
               proposals/wvcm/test/junit/src/org/apache/wvcm
                        AbstractTest.java ControllableResourceTest.java
                        FolderTest.java LocationTest.java ProviderTest.java
                        ResourceTest.java SearchTest.java
                        WorkspaceTest.java
               proposals/wvcm/test/junit/src/org/apache/webdav
                        test.properties
               proposals/wvcm/test/junit/src/org/apache/webdav/resources
                        test3.xml
  Log:
  Next bunch for WVCM. New:
  - upgraded to newer version of WVCM API
  - doUpdate, doUncheckout
  - support for BIND (!!! not yet standard !!!)
  - support for XPATH-based DASL queries (!!! not yet standard !!!)
  - support for Object-valued attributes (!!! not yet standard !!!)
  - ProviderFactory.Callback.getAuthentication() is now called for each WebDAV request
  
  Revision  Changes    Path
  1.6       +0 -0      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/store/webdav/MultistatusResponseTest.java
  
  Index: MultistatusResponseTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/store/webdav/MultistatusResponseTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  
  
  
  1.3       +0 -0      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/store/webdav/PropertiesTest.java
  
  Index: PropertiesTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/store/webdav/PropertiesTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  
  
  
  1.6       +0 -0      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/store/webdav/ReportRequestTest.java
  
  Index: ReportRequestTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/store/webdav/ReportRequestTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  
  
  
  1.6       +5 -7      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/AbstractTest.java
  
  Index: AbstractTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/AbstractTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractTest.java	16 May 2003 17:02:05 -0000	1.5
  +++ AbstractTest.java	26 May 2003 12:46:08 -0000	1.6
  @@ -121,10 +121,8 @@
           client = new HttpClient();
           client.getHostConfiguration().setHost(host, port, "http");
           HttpState state = new HttpState();
  -//        state.setCredentials(
  -//            "Basic realm=\"Tamino WebDAV Server\"", host, new UsernamePasswordCredentials(username, password) );
           state.setCredentials(
  -            null, host, new UsernamePasswordCredentials(username, password) );
  +            realm, host, new UsernamePasswordCredentials(username, password) );
           client.setState( state );
       }
       
  
  
  
  1.6       +0 -0      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/PropfindMethodTest.java
  
  Index: PropfindMethodTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/PropfindMethodTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  
  
  
  1.3       +0 -0      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/ProppatchMethodTest.java
  
  Index: ProppatchMethodTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/ProppatchMethodTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  
  
  
  1.6       +0 -0      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/PutMethodTest.java
  
  Index: PutMethodTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/PutMethodTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  
  
  
  1.6       +0 -0      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/ReportMethodTest.java
  
  Index: ReportMethodTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/ReportMethodTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  
  
  
  1.6       +0 -0      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/VersionControlMethodTest.java
  
  Index: VersionControlMethodTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods/VersionControlMethodTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  
  
  
  1.6       +13 -11    jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/AbstractTest.java
  
  Index: AbstractTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/AbstractTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractTest.java	16 May 2003 17:02:05 -0000	1.5
  +++ AbstractTest.java	26 May 2003 12:46:09 -0000	1.6
  @@ -76,7 +76,7 @@
    * @version $Revision$
    */
   public abstract class AbstractTest extends org.apache.webdav.methods.AbstractTest {
  -
  +    
       protected ProviderFactory.Callback callback = null;
       protected Provider provider = null;
       
  @@ -90,9 +90,8 @@
           Hashtable h = new Hashtable();
           h.put( "host", host );
           h.put( "port", String.valueOf(port) );
  -        h.put( "realm", realm );
  -        h.put( "context", context );
  -        h.put( "rootfolder", rootfolder );
  +        if( realm != null ) h.put( "realm", realm );
  +        if( context != null ) h.put( "context", context );
           provider = ProviderFactory.createProvider(
               "org.apache.wvcm.ProviderImpl", callback, h );
       }
  @@ -116,15 +115,18 @@
        */
       class CallbackImpl implements ProviderFactory.Callback {
           
  +        Authentication authentication = new AuthenticationImpl();
  +        
           /**
            * Return authentication information for the current user.
            * @param realm The authentication realm for the provider.
            */
  -        public ProviderFactory.Callback.Authentication getAuthentication(String realm) {
  -            return new Authentication();
  +        public ProviderFactory.Callback.Authentication getAuthentication(String realm, Integer retryCount) {
  +            //            System.out.println("@@@ getAuthentication("+realm+","+retryCount+")");
  +            return authentication;
           }
           
  -        class Authentication implements ProviderFactory.Callback.Authentication {
  +        class AuthenticationImpl implements ProviderFactory.Callback.Authentication {
               
               /** Return the password of the current user. */
               public String password() {
  
  
  
  1.7       +39 -6     jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/ControllableResourceTest.java
  
  Index: ControllableResourceTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/ControllableResourceTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ControllableResourceTest.java	16 May 2003 17:02:05 -0000	1.6
  +++ ControllableResourceTest.java	26 May 2003 12:46:09 -0000	1.7
  @@ -67,6 +67,7 @@
   import junit.framework.TestSuite;
   import javax.wvcm.*;
   import javax.wvcm.PropertyNameList.*;
  +import javax.wvcm.WvcmException.*;
   import java.util.*;
   
   /**
  @@ -159,7 +160,7 @@
               assertTrue( "Exception expected", false );
           }
           catch (WvcmException e) {
  -            assertEquals( WvcmException.CANNOT_CREATE_RESOURCE_MUST_BE_NULL, e.getReasonCode() );
  +            assertEquals( ReasonCode.RESOURCE_ALREADY_EXISTS_AT_LOCATION, e.getReasonCode() );
           }
       }
   
  @@ -264,7 +265,7 @@
           resource = (ControllableResource)resource.doReadProperties( wantedprops );
           assertFalse( resource.getIsCheckedOut() );
       }
  -    
  +
       public void testDoUpdate() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -313,6 +314,38 @@
               resource.doCreateResource();
               assertTrue( "Should have thrown CONFLICT", false );
           } catch (Exception e) {}
  +    }
  +
  +    public void testDoCreateVersionControlledResource() throws Exception {
  +        Location location = provider.location( resourcePath );
  +        ControllableResource resource = location.controllableResource();
  +        resource.doDelete();
  +        resource.doCreateResource();
  +        resource.doControl();
  +        PropertyName[] rPNames = {PropertyName.CHECKED_IN};
  +        PropertyNameList wantedprops =
  +            new PropertyNameList( rPNames );
  +        resource = (ControllableResource)resource.doReadProperties( wantedprops );
  +        Version version = resource.getCheckedIn();
  +        System.out.println("Version: "+version.location().string());
  +        // create workspace
  +        List wfl = provider.serverWorkspaceFolderList( null );
  +        assertNotNull( wfl );
  +        assertFalse( wfl.size() == 0 );
  +        String workspacePath = wfl.get(0)+"/ws1";
  +        location = provider.location( workspacePath );
  +        Workspace workspace = location.workspace();
  +        workspace.doDelete();
  +        workspace.doCreateResource();
  +        String anotherresourcePath = workspacePath+"/test.xml";
  +        location = provider.location( anotherresourcePath );
  +        ControllableResource anotherresource = location.controllableResource();
  +        anotherresource.doDelete();
  +        anotherresource.doCreateVersionControlledResource( version );
  +        anotherresource = (ControllableResource)anotherresource.doReadProperties( wantedprops );
  +        Version version2 = anotherresource.getCheckedIn();
  +        System.out.println("Version_2: "+version2.location().string());
  +        assertEquals(version.location().string(), version2.location().string());
       }
       
   }
  
  
  
  1.7       +29 -14    jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/FolderTest.java
  
  Index: FolderTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/FolderTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FolderTest.java	16 May 2003 17:02:05 -0000	1.6
  +++ FolderTest.java	26 May 2003 12:46:09 -0000	1.7
  @@ -65,9 +65,10 @@
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  -import javax.wvcm.*;
   import java.util.*;
  +import javax.wvcm.*;
   import javax.wvcm.PropertyNameList.*;
  +import javax.wvcm.WvcmException.*;
   
   /**
    * Tests FolderImpl.
  @@ -140,7 +141,7 @@
               assertTrue( "Exception expected", false );
           }
           catch (WvcmException e) {
  -            assertEquals( WvcmException.CANNOT_CREATE_RESOURCE_MUST_BE_NULL, e.getReasonCode() );
  +            assertEquals( ReasonCode.RESOURCE_ALREADY_EXISTS_AT_LOCATION, e.getReasonCode() );
           }
       }
       
  @@ -214,7 +215,7 @@
               try {
                   System.out.println(r.getDisplayName());
               } catch (WvcmException e) {
  -                if( e.getReasonCode() == WvcmException.VALUE_UNAVAILABLE )
  +                if( e.getReasonCode() == ReasonCode.VALUE_UNAVAILABLE )
                       System.out.println("<not available>");
                   else
                       throw e;
  @@ -223,7 +224,7 @@
               try {
                   System.out.println(r.getContentType());
               } catch (WvcmException e) {
  -                if( e.getReasonCode() == WvcmException.VALUE_UNAVAILABLE )
  +                if( e.getReasonCode() == ReasonCode.VALUE_UNAVAILABLE )
                       System.out.println("<not available>");
                   else
                       throw e;
  @@ -232,7 +233,7 @@
               try {
                   System.out.println(r.getLastModified());
               } catch (WvcmException e) {
  -                if( e.getReasonCode() == WvcmException.VALUE_UNAVAILABLE )
  +                if( e.getReasonCode() == ReasonCode.VALUE_UNAVAILABLE )
                       System.out.println("<not available>");
                   else
                       throw e;
  @@ -327,21 +328,35 @@
           Folder folder = location.folder();
           folder.doDelete();
           folder.doCreateResource();
  -        location = provider.location( folderPath+"/a.xml" );
  -        ControllableResource resource = location.controllableResource();
  -        resource.doCreateResource();
           location = provider.location( boundrPath );
           Folder boundResource = location.folder();
           boundResource.doDelete();
           boundResource.doCreateResource();
  +        location = provider.location( boundrPath+"/a.xml" );
  +        ControllableResource resource = location.controllableResource();
  +        resource.doCreateResource();
  +        
  +        System.out.println("** bind "+folder.location().string()+" (bar1 -> "+boundResource.location().string()+")");
           folder.doBind( "bar1", boundResource );
           
  -        Iterator members = folder.doReadMemberList( null, false );
  -        System.out.println("** folder.doReadMemberList( null, false ):");
  +        location = provider.location( folderPath+"/bar1" );
  +        Folder subfolder = location.folder();
  +        Iterator members = subfolder.doReadMemberList( null, false );
  +        System.out.println("** ("+subfolder.location().string()+").doReadMemberList( null, false ):");
  +        while( members.hasNext() ) {
  +            Resource r = (Resource)members.next();
  +            System.out.println(r);
  +        }
  +        
  +        members = boundResource.doReadMemberList( null, false );
  +        System.out.println("** ("+boundResource.location().string()+").doReadMemberList( null, false ):");
           while( members.hasNext() ) {
               Resource r = (Resource)members.next();
               System.out.println(r);
           }
  +        
  +        System.out.println("** unbind "+folder.location().string()+" (bar1)");
  +        folder.doUnbind( "bar1" );
       }
   }
   
  
  
  
  1.3       +0 -0      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/LocationTest.java
  
  Index: LocationTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/LocationTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  
  
  
  1.7       +6 -5      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/ProviderTest.java
  
  Index: ProviderTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/ProviderTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProviderTest.java	16 May 2003 17:02:05 -0000	1.6
  +++ ProviderTest.java	26 May 2003 12:46:09 -0000	1.7
  @@ -66,6 +66,7 @@
   import junit.framework.Test;
   import junit.framework.TestSuite;
   import javax.wvcm.*;
  +import javax.wvcm.WvcmException.*;
   import java.util.*;
   
   /**
  @@ -130,7 +131,7 @@
           }
           catch (WvcmException e) {
               assertEquals( resourcePath, e.getLocation() );
  -            assertEquals( e.UNAUTHORIZED, e.getReasonCode() );
  +            assertEquals( ReasonCode.UNAUTHORIZED, e.getReasonCode() );
           }
       }
       
  
  
  
  1.9       +130 -67   jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/ResourceTest.java
  
  Index: ResourceTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/ResourceTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ResourceTest.java	16 May 2003 17:02:05 -0000	1.8
  +++ ResourceTest.java	26 May 2003 12:46:09 -0000	1.9
  @@ -67,6 +67,7 @@
   import junit.framework.TestSuite;
   import javax.wvcm.*;
   import javax.wvcm.PropertyNameList.*;
  +import javax.wvcm.WvcmException.*;
   import java.util.*;
   import java.io.*;
   
  @@ -135,7 +136,7 @@
           resource.doDelete();
           assertFalse( resourceExistsOnServer(resourcePath) );
       }
  -
  +    
       public void testDoWriteContent() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -148,7 +149,7 @@
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
       }
  -
  +    
       public void testDoWriteContentWrongContentIdentifier() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -163,7 +164,7 @@
           // should not update
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test2.xml"), "" );
  -
  +        
           ByteArrayOutputStream content = new ByteArrayOutputStream();
           Resource r = resource.doReadContent(null, content);
           assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
  @@ -174,7 +175,7 @@
               "IGNORE FOR NOW! This testcase may fail while the server does not yet properly process the If: ([etag]) header",
               c.indexOf("World!") < 0 );
       }
  -
  +    
       public void testDoReadPropertiesWithNullList() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -183,14 +184,14 @@
           PropertyNameList wantedprops = null;
           Resource r = resource.doReadProperties(wantedprops);
       }
  -
  +    
       public void testDoReadProperties() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
           resource.doDelete();
           resource.doCreateResource();
           resource.doControl();
  -
  +        
           PropertyName[] vrPnames = {
               PropertyName.DISPLAY_NAME,
                   PropertyName.VERSION_NAME
  @@ -206,7 +207,7 @@
                   PropertyName.VERSION_HISTORY, new PropertyNameList(vhrPnames) )
           };
           PropertyNameList wantedprops = new PropertyNameList( pnames );
  -
  +        
           Resource r = resource.doReadProperties(wantedprops);
           assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
           ControllableResource r2 = (ControllableResource)r;
  @@ -221,7 +222,7 @@
           assertEquals( "test.xml", v.getDisplayName() );
           assertEquals( "1.0", v.getVersionName() );
       }
  -
  +    
       public void testDoReadContent() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -234,7 +235,7 @@
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
           resource.doControl();
  -
  +        
           PropertyName[] vrPnames = {
               PropertyName.DISPLAY_NAME,
                   PropertyName.VERSION_NAME
  @@ -251,10 +252,10 @@
                   PropertyName.VERSION_HISTORY, new PropertyNameList(vhrPnames) )
           };
           wantedprops = new PropertyNameList( pnames );
  -
  +        
           ByteArrayOutputStream content = new ByteArrayOutputStream();
           Resource r = resource.doReadContent(wantedprops, content);
  -
  +        
           assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
           ControllableResource r2 = (ControllableResource)r;
           assertEquals( "test.xml", r2.getDisplayName() );
  @@ -267,17 +268,17 @@
           Version v = (Version)vl.get(0);
           assertEquals( "test.xml", v.getDisplayName() );
           assertEquals( "1.0", v.getVersionName() );
  -
  +        
           System.out.println("\nContent was: "+content.toString());
       }
  -
  +    
       public void testDoReadPropertiesAndDetermineType() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
           resource.doDelete();
           resource.doCreateResource();
           resource.doControl();
  -
  +        
           PropertyName[] vrPnames = {
               PropertyName.DISPLAY_NAME,
                   PropertyName.VERSION_NAME
  @@ -293,7 +294,7 @@
                   PropertyName.VERSION_HISTORY, new PropertyNameList(vhrPnames) )
           };
           PropertyNameList wantedprops = new PropertyNameList( pnames );
  -
  +        
           Resource rtop = location.resource();
           Resource r = rtop.doReadProperties(wantedprops);
           assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
  @@ -309,7 +310,45 @@
           assertEquals( "test.xml", v.getDisplayName() );
           assertEquals( "1.0", v.getVersionName() );
       }
  +    
  +    public void testAllAttributes() throws Exception {
  +        Location location = provider.location( resourcePath );
  +        ControllableResource resource = location.controllableResource();
  +        resource.doDelete();
  +        resource.doCreateResource();
  +        
  +        AttributeName att1 = new AttributeName("http://my.namespace.org", "att-1");
  +        AttributeName att2 = new AttributeName("http://my.namespace.org", "att-2");
  +        resource.setAttribute( att1, "Hello" );
  +        resource.setAttribute( att2, "World" );
  +        resource.doWriteProperties();
  +        
  +        PropertyNameList allattributes;
  +        int n;
  +        allattributes = resource.getAttributeNameList();
  +        n = allattributes.getPropertyNames().length;
  +        System.out.println("\nAll attributes:");
  +        for( int i=0; i<n; i++)
  +            System.out.println("- "+allattributes.getPropertyNames()[i].getString());
  +
  +        assertTrue( "Found "+n+" attributes, expected 2", n == 2 );
  +        
  +        resource = (ControllableResource)resource.doReadProperties(
  +            new PropertyNameList(new PropertyName[]
  +                                 {PropertyName.DISPLAY_NAME,
  +                                 PropertyName.ALL_ATTRIBUTES}
  +                                 )
  +        );
  +        allattributes = resource.getAttributeNameList();
  +        n = allattributes.getPropertyNames().length;
  +        System.out.println("\nAll attributes after do-read-all-attributes of: "+
  +                               resource.getDisplayName());
  +        for( int i=0; i<n; i++)
  +            System.out.println("- "+allattributes.getPropertyNames()[i].getString());
   
  +        assertTrue( "Found "+n+" attributes, expected at least 2", n >= 2 );
  +    }
  +    
       public void testGetContentType() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -321,15 +360,15 @@
           String cid = resource.getContentIdentifier();
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
  -
  +        
           wantedprops = new PropertyNameList( new PropertyName[]{PropertyName.CONTENT_TYPE} );
  -
  +        
           Resource r = resource.doReadProperties(wantedprops);
           assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
           ControllableResource r2 = (ControllableResource)r;
           assertEquals( "text/xml", r2.getContentType() );
       }
  -
  +    
       public void testGetCreatorDisplayName() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -342,15 +381,15 @@
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
           resource.doControl();
  -
  +        
           wantedprops = new PropertyNameList( new PropertyName[]{PropertyName.CREATOR_DISPLAY_NAME} );
  -
  +        
           Resource r = resource.doReadProperties(wantedprops);
           assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
           ControllableResource r2 = (ControllableResource)r;
           assertTrue(r2.getCreatorDisplayName().endsWith(username));
       }
  -
  +    
       public void testGetCreationDate() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -362,15 +401,15 @@
           String cid = resource.getContentIdentifier();
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
  -
  +        
           wantedprops = new PropertyNameList( new PropertyName[]{PropertyName.CREATION_DATE} );
  -
  +        
           Resource r = resource.doReadProperties(wantedprops);
           assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
           ControllableResource r2 = (ControllableResource)r;
           System.out.println("\ncreation-date: "+r2.getCreationDate());
       }
  -
  +    
       public void testGetLastModified() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -382,15 +421,15 @@
           String cid = resource.getContentIdentifier();
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
  -
  +        
           wantedprops = new PropertyNameList( new PropertyName[]{PropertyName.LAST_MODIFIED} );
  -
  +        
           Resource r = resource.doReadProperties(wantedprops);
           assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
           ControllableResource r2 = (ControllableResource)r;
           System.out.println("\nlast-modified: "+r2.getLastModified());
       }
  -
  +    
       public void testGetContentLanguage() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
  @@ -402,21 +441,21 @@
           String cid = resource.getContentIdentifier();
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
  -
  +        
           wantedprops = new PropertyNameList( new PropertyName[]{PropertyName.CONTENT_LANGUAGE} );
  -
  +        
           Resource r = resource.doReadProperties(wantedprops);
           assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
           ControllableResource r2 = (ControllableResource)r;
           System.out.println("\ncontent-language: "+r2.getContentLanguage());
       }
  -
  +    
       public void testDoWriteProperties() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
           resource.doDelete();
           resource.doCreateResource();
  -
  +        
           AttributeName att = new AttributeName("http://my.namespace", "myAttribute");
           resource.setComment( "My Comment" );
           resource.setDisplayName( "My Display Name" );
  @@ -430,15 +469,15 @@
           for (int i=0; i<n; i++) {
               System.out.println("- "+pnames[i].getString());
           }
  -
  +        
           resource.doWriteProperties();
  -
  +        
           updatedProps = resource.getUpdatedPropertyList();
           pnames = updatedProps.getPropertyNames();
           n = pnames.length;
           assertTrue( n == 0 );
           System.out.println("\nUpdated properties after doWriteProperties (#="+n+"):");
  -
  +        
           PropertyNameList wantedprops =
               new PropertyNameList( new PropertyName[]{PropertyName.COMMENT, PropertyName.DISPLAY_NAME, PropertyName.CONTENT_LANGUAGE, att} );
           resource = (ControllableResource)resource.doReadProperties(wantedprops);
  @@ -447,37 +486,37 @@
           assertEquals( "de", resource.getContentLanguage().toString() );
           assertEquals( "My Attribute Value", resource.getAttribute(att) );
       }
  -
  +    
       public void testSetAndRemoveAttribute() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
           resource.doDelete();
           resource.doCreateResource();
  -
  +        
           AttributeName att1 = new AttributeName("http://my.namespace.org", "att-1");
           AttributeName att2 = new AttributeName("http://my.namespace.org", "att-2");
           resource.setAttribute( att1, "Hello" );
           resource.setAttribute( att2, "World" );
           resource.doWriteProperties();
  -
  +        
           PropertyNameList attnames = resource.getAttributeNameList();
           int n = attnames.getPropertyNames().length;
           assertTrue( n == 2 );
  -
  +        
           resource.removeAttribute( att1 );
           resource.doWriteProperties();
  -
  +        
           attnames = resource.getAttributeNameList();
           n = attnames.getPropertyNames().length;
           assertTrue( n == 1 );
       }
  -
  +    
       public void testGetAttributeNameList() throws Exception {
           Location location = provider.location( resourcePath );
           ControllableResource resource = location.controllableResource();
           resource.doDelete();
           resource.doCreateResource();
  -
  +        
           AttributeName att1 = new AttributeName("http://my.namespace.org", "att-1");
           AttributeName att2 = new AttributeName("http://my.namespace.org", "att-2");
           resource.setComment( "My Comment" );
  @@ -486,7 +525,7 @@
           resource.setAttribute( att1, "Hello" );
           resource.setAttribute( att2, "World" );
           resource.doWriteProperties();
  -
  +        
           PropertyNameList attnames = resource.getAttributeNameList();
           int n = attnames.getPropertyNames().length;
           assertTrue( n == 2 );
  @@ -494,21 +533,21 @@
           for( int i=0; i<n; i++ )
               System.out.println("- "+attnames.getPropertyNames()[i].getString());
       }
  -
  +    
       public void testDoCopy() throws Exception {
           ControllableResource resource = provider.location(resourcePath).controllableResource();
           ControllableResource destresource = provider.location(destinationPath).controllableResource();
           resource.doDelete();
           destresource.doDelete();
           resource.doCreateResource();
  -
  +        
           PropertyNameList wantedprops =
               new PropertyNameList( new PropertyName[]{PropertyName.CONTENT_IDENTIFIER} );
           resource = (ControllableResource)resource.doReadProperties( wantedprops );
           String cid = resource.getContentIdentifier();
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
  -
  +        
           AttributeName att1 = new AttributeName("http://my.namespace.org", "att-1");
           AttributeName att2 = new AttributeName("http://my.namespace.org", "att-2");
           resource.setComment( "My Comment" );
  @@ -517,9 +556,9 @@
           resource.setAttribute( att1, "Hello" );
           resource.setAttribute( att2, "World" );
           resource.doWriteProperties();
  -
  +        
           resource.doCopy(destinationPath, true);
  -
  +        
           wantedprops =
               new PropertyNameList( new PropertyName[]{PropertyName.COMMENT, PropertyName.DISPLAY_NAME,PropertyName.CONTENT_LANGUAGE, att1, att2} );
           ByteArrayOutputStream content = new ByteArrayOutputStream();
  @@ -542,26 +581,26 @@
           System.out.println("- att-1: "+destresource.getAttribute(att1));
           System.out.println("- att-2: "+destresource.getAttribute(att2));
           System.out.println("- Content: "+destcontentAsString);
  -
  +        
           assertEquals(resource.getAttribute(att1),destresource.getAttribute(att1));
           assertEquals(resource.getAttribute(att2),destresource.getAttribute(att2));
           assertEquals(contentAsString,destcontentAsString);
       }
  -
  +    
       public void testDoMove() throws Exception {
           ControllableResource resource = provider.location(resourcePath).controllableResource();
           ControllableResource destresource = provider.location(destinationPath).controllableResource();
           resource.doDelete();
           destresource.doDelete();
           resource.doCreateResource();
  -
  +        
           PropertyNameList wantedprops =
               new PropertyNameList( new PropertyName[]{PropertyName.CONTENT_IDENTIFIER} );
           resource = (ControllableResource)resource.doReadProperties( wantedprops );
           String cid = resource.getContentIdentifier();
           resource.doWriteContent(
               getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
  -
  +        
           AttributeName att1 = new AttributeName("http://my.namespace.org", "att-1");
           AttributeName att2 = new AttributeName("http://my.namespace.org", "att-2");
           resource.setComment( "My Comment" );
  @@ -570,18 +609,12 @@
           resource.setAttribute( att1, "Hello" );
           resource.setAttribute( att2, "World" );
           resource.doWriteProperties();
  -
  +        
           resource.doMove(destinationPath, true);
  -
  +        
  +        assertEquals( destinationPath, resource.location().string() );
           wantedprops =
               new PropertyNameList( new PropertyName[]{PropertyName.COMMENT, PropertyName.DISPLAY_NAME,PropertyName.CONTENT_LANGUAGE, att1, att2} );
  -        try {
  -            resource = (ControllableResource)resource.doReadProperties( wantedprops);
  -            assertTrue("Should have thrown exception",false);
  -        } catch (WvcmException e) {
  -            System.out.println("Origin not found.");
  -            assertTrue(e.getReasonCode() == WvcmException.NOT_FOUND);
  -        }
           ByteArrayOutputStream content = new ByteArrayOutputStream();
           destresource = (ControllableResource)destresource.doReadContent( wantedprops, content );
           String destcontentAsString = content.toString();
  @@ -592,7 +625,7 @@
           System.out.println("- att-1: "+destresource.getAttribute(att1));
           System.out.println("- att-2: "+destresource.getAttribute(att2));
           System.out.println("- Content: "+destcontentAsString);
  -
  +        
           assertEquals("Hello",destresource.getAttribute(att1));
           assertEquals("World",destresource.getAttribute(att2));
           assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><test>Hello</test>",destcontentAsString);
  @@ -625,7 +658,7 @@
           resource.setAttribute( attdate, new Date() );
           resource.setAttribute( attstring, "Pooh and his friends" );
           resource.doWriteProperties();
  -
  +        
           PropertyNameList wantedProperties;
           wantedProperties = new PropertyNameList(
               new PropertyName[]{attsingle, attlist, attdate, attstring, PropertyName.CHECKED_IN}
  @@ -641,7 +674,7 @@
           System.out.println("String: "+resource.getAttribute(attstring));
           System.out.println("Checked-In: "+v.location().string());
           System.out.println("Date: "+resource.getAttribute(attdate));
  -
  +        
           NestedPropertyName attsingleNested = new NestedPropertyName(
               attsingle,
               new PropertyNameList(new PropertyName[]{PropertyName.DISPLAY_NAME})
  @@ -665,6 +698,36 @@
               System.out.println("  * "+r.getDisplayName());
           }
           System.out.println("Date: "+resource.getAttribute(attdate));
  +    }
  +    
  +    public void testGetWorkspaceFolderList() throws Exception {
  +        Location location = provider.location( resourcePath );
  +        ControllableResource resource = location.controllableResource();
  +        resource.doDelete();
  +        resource.doCreateResource();
  +        PropertyNameList wantedprops =
  +            new PropertyNameList( new PropertyName[]{PropertyName.CONTENT_IDENTIFIER} );
  +        resource = (ControllableResource)resource.doReadProperties( wantedprops );
  +        String cid = resource.getContentIdentifier();
  +        resource.doWriteContent(
  +            getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
  +        
  +        wantedprops = new PropertyNameList( new PropertyName[]{PropertyName.WORKSPACE_FOLDER_LIST} );
  +        
  +        Resource r = resource.doReadProperties(wantedprops);
  +        assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
  +        ControllableResource r2 = (ControllableResource)r;
  +        try {
  +            System.out.println("WorkspaceFolderList: "+r2.getWorkspaceFolderList() );
  +        }
  +        catch (WvcmException e) {
  +            if( e.getReasonCode() == ReasonCode.VALUE_UNAVAILABLE )
  +                assertTrue(
  +                    "IGNORE FOR NOW! This testcase may fail while the server does not yet properly implement the DAV:workspace-collection-set property",
  +                    false );
  +            else
  +                throw e;
  +        }
       }
   }
   
  
  
  
  1.3       +37 -3     jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/SearchTest.java
  
  Index: SearchTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/SearchTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SearchTest.java	16 May 2003 17:02:05 -0000	1.2
  +++ SearchTest.java	26 May 2003 12:46:09 -0000	1.3
  @@ -345,6 +345,22 @@
               Resource r = (Resource)ri.next();
               System.out.println(r+" ("+r.getDisplayName()+", "+r.getContentType()+", "+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
           }
  +        
  +        Expression[] orTerms = {
  +            new ContentExpression("/test[text()=\"Hello World!\"]", ContOperator.XPATH),
  +                new ContentExpression("/test[@name=\"tamino\"]", ContOperator.XPATH)
  +        };
  +        expression =
  +            new NestedExpression(orTerms, LogOperator.OR);
  +        searchToken =
  +            new SearchToken(new SearchCondition(expression));
  +        results = folder.doSearch( wantedprops, searchToken );
  +        System.out.println("\n** condition=<content /test[text()=\"Hello World!\"] OR /test[@name=\"tamino\"]>: "+results.size()+" results **");
  +        ri = results.iterator();
  +        while( ri.hasNext() ) {
  +            Resource r = (Resource)ri.next();
  +            System.out.println(r+" ("+r.getDisplayName()+")");
  +        }
       }
       
       public void testContentExpression() throws Exception {
  @@ -425,6 +441,24 @@
           while( ri.hasNext() ) {
               Resource r = (Resource)ri.next();
               System.out.println(r+" ("+r.getDisplayName()+")");
  +        }
  +
  +        String nspUri = "http://my.namespace.org";
  +        AttributeName p_att_1 = new XPathAttributeName(nspUri, "pseudo-1", "/test/a[1]");
  +        AttributeName p_att_2 = new XPathAttributeName(nspUri, "pseudo-2", "/test/@name");
  +        wantedprops =
  +            new PropertyNameList( new PropertyName[]{p_att_1, p_att_2} );
  +        expression = new ContentExpression("/test[@name=\"tamino\"]", ContOperator.XPATH);
  +        searchToken =
  +            new SearchToken(new SearchCondition(expression));
  +        results = folder.doSearch( wantedprops, searchToken );
  +        System.out.println("\n** condition=<content /test[@name=\"tamino\"]>: "+results.size()+" results **");
  +        ri = results.iterator();
  +        while( ri.hasNext() ) {
  +            Resource r = (Resource)ri.next();
  +            System.out.println(r);
  +            System.out.println("- pseudo-1 (/test/a[1]): "+r.getAttribute(p_att_1));
  +            System.out.println("- pseudo-2 (/test/@name): "+r.getAttribute(p_att_2));
           }
       }
   }
  
  
  
  1.8       +8 -7      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/WorkspaceTest.java
  
  Index: WorkspaceTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/WorkspaceTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WorkspaceTest.java	16 May 2003 17:02:05 -0000	1.7
  +++ WorkspaceTest.java	26 May 2003 12:46:09 -0000	1.8
  @@ -66,6 +66,7 @@
   import junit.framework.Test;
   import junit.framework.TestSuite;
   import javax.wvcm.*;
  +import javax.wvcm.WvcmException.*;
   import java.util.*;
   
   /**
  @@ -84,7 +85,7 @@
        */
       public WorkspaceTest(String testName) throws Exception {
           super(testName);
  -        this.invalidWorkspacePath = rootFolderPath()+"/foo";
  +        this.invalidWorkspacePath = contextPath()+"/invalidWsPath";
       }
       
       /**
  @@ -146,7 +147,7 @@
               assertTrue( "Exception expected", false );
           }
           catch (WvcmException e) {
  -            assertEquals( WvcmException.CANNOT_CREATE_RESOURCE_MUST_BE_NULL, e.getReasonCode() );
  +            assertEquals( ReasonCode.RESOURCE_ALREADY_EXISTS_AT_LOCATION, e.getReasonCode() );
           }
       }
       
  @@ -159,7 +160,7 @@
               assertTrue( "Exception expected", false );
           }
           catch (WvcmException e) {
  -            assertEquals( WvcmException.CANNOT_CREATE_RESOURCE_AT_LOCATION, e.getReasonCode() );
  +            assertEquals( ReasonCode.CANNOT_CREATE_AT_THIS_LOCATION, e.getReasonCode() );
           }
       }
   }
  
  
  
  1.6       +6 -6      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/test.properties
  
  Index: test.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/test.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- test.properties	30 Apr 2003 16:28:15 -0000	1.5
  +++ test.properties	26 May 2003 12:46:09 -0000	1.6
  @@ -1,8 +1,8 @@
   org.apache.webdav.test.host=localhost
  -org.apache.webdav.test.port=8080
  -org.apache.webdav.test.username=root
  -org.apache.webdav.test.password=root
  -org.apache.webdav.test.context=slide
  -org.apache.webdav.test.rootfolder=files
  -org.apache.webdav.test.realm=Slide DAV Server
  +org.apache.webdav.test.port=8888
  +org.apache.webdav.test.username=davuser
  +org.apache.webdav.test.password=davuser
  +org.apache.webdav.test.context=taminowebdavserver
  +org.apache.webdav.test.rootfolder=mycoll
  +org.apache.webdav.test.realm=Tamino WebDAV Server
   
  
  
  
  1.2       +5 -1      jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/resources/test3.xml
  
  Index: test3.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/resources/test3.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test3.xml	30 Apr 2003 16:28:17 -0000	1.1
  +++ test3.xml	26 May 2003 12:46:09 -0000	1.2
  @@ -1,2 +1,6 @@
   <?xml version="1.0" encoding="UTF-8"?>
  -<test name="tamino">Hello All!</test>
  +<test name="tamino">
  +Hello All!
  +<a>You are welcome!</a>
  +<a>Where is the champion?</a>
  +</test>
  
  
  

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