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/16 19:02:06 UTC
cvs commit: jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/store/webdav ReportRequestTest.java PropertiesTest.java MultistatusResponseTest.java
pnever 2003/05/16 10:02:06
Modified: proposals/wvcm/test/junit/src/org/apache/wvcm
WorkspaceTest.java SearchTest.java
ResourceTest.java ProviderTest.java
LocationTest.java FolderTest.java
ControllableResourceTest.java AbstractTest.java
proposals/wvcm/test/junit/src/org/apache/webdav/methods
VersionControlMethodTest.java ReportMethodTest.java
PutMethodTest.java ProppatchMethodTest.java
PropfindMethodTest.java AbstractTest.java
proposals/wvcm/test/junit/src/org/apache/wvcm/store/webdav
ReportRequestTest.java PropertiesTest.java
MultistatusResponseTest.java
Log:
Next bunch for WVCM
Revision Changes Path
1.7 +2 -2 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
1.2 +0 -0 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
1.8 +277 -37 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ResourceTest.java 5 May 2003 09:19:27 -0000 1.7
+++ ResourceTest.java 16 May 2003 17:02:05 -0000 1.8
@@ -79,6 +79,9 @@
public class ResourceTest extends AbstractTest {
private String resourcePath = null;
+ private String destinationPath = null;
+ private String reference1Path = null;
+ private String reference2Path = null;
/**
* Default cosntructor
@@ -86,6 +89,9 @@
public ResourceTest(String testName) throws Exception {
super(testName);
resourcePath = rootFolderPath()+"/test.xml";
+ destinationPath = rootFolderPath()+"/test_copy.xml";
+ reference1Path = rootFolderPath()+"/test_ref_1.xml";
+ reference2Path = rootFolderPath()+"/test_ref_2.xml";
}
/**
@@ -129,7 +135,7 @@
resource.doDelete();
assertFalse( resourceExistsOnServer(resourcePath) );
}
-
+
public void testDoWriteContent() throws Exception {
Location location = provider.location( resourcePath );
ControllableResource resource = location.controllableResource();
@@ -142,7 +148,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();
@@ -157,7 +163,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 );
@@ -168,7 +174,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();
@@ -177,14 +183,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
@@ -200,7 +206,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;
@@ -215,7 +221,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();
@@ -228,7 +234,7 @@
resource.doWriteContent(
getClass().getResourceAsStream("/org/apache/webdav/resources/test.xml"), cid );
resource.doControl();
-
+
PropertyName[] vrPnames = {
PropertyName.DISPLAY_NAME,
PropertyName.VERSION_NAME
@@ -245,10 +251,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() );
@@ -261,17 +267,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
@@ -287,7 +293,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 );
@@ -303,7 +309,7 @@
assertEquals( "test.xml", v.getDisplayName() );
assertEquals( "1.0", v.getVersionName() );
}
-
+
public void testGetContentType() throws Exception {
Location location = provider.location( resourcePath );
ControllableResource resource = location.controllableResource();
@@ -315,15 +321,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();
@@ -336,15 +342,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();
@@ -356,15 +362,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();
@@ -376,15 +382,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();
@@ -396,28 +402,43 @@
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" );
resource.setContentLanguage( new Locale("de","") );
resource.setAttribute( att, "My Attribute Value" );
+ PropertyNameList updatedProps = resource.getUpdatedPropertyList();
+ PropertyName[] pnames = updatedProps.getPropertyNames();
+ int n = pnames.length;
+ assertTrue( n == 4 );
+ System.out.println("\nUpdated properties (#="+n+"):");
+ 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);
@@ -425,6 +446,225 @@
assertEquals( "My Display Name", resource.getDisplayName() );
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" );
+ resource.setDisplayName( "My Display Name" );
+ resource.setContentLanguage( new Locale("de","") );
+ resource.setAttribute( att1, "Hello" );
+ resource.setAttribute( att2, "World" );
+ resource.doWriteProperties();
+
+ PropertyNameList attnames = resource.getAttributeNameList();
+ int n = attnames.getPropertyNames().length;
+ assertTrue( n == 2 );
+ System.out.println("\nAttribute names:");
+ 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" );
+ resource.setDisplayName( "My Display Name" );
+ resource.setContentLanguage( new Locale("de","") );
+ 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();
+ resource = (ControllableResource)resource.doReadContent( wantedprops, content );
+ String contentAsString = content.toString();
+ System.out.println("Origin: "+resource.location().string());
+ System.out.println("- Comment: "+resource.getComment());
+ System.out.println("- Display-Name: "+resource.getDisplayName());
+ System.out.println("- Content-Language: "+resource.getContentLanguage());
+ System.out.println("- att-1: "+resource.getAttribute(att1));
+ System.out.println("- att-2: "+resource.getAttribute(att2));
+ System.out.println("- Content: "+contentAsString);
+ content = new ByteArrayOutputStream();
+ destresource = (ControllableResource)destresource.doReadContent( wantedprops, content );
+ String destcontentAsString = content.toString();
+ System.out.println("Destination: "+destresource.location().string());
+ System.out.println("- Comment: "+destresource.getComment());
+ System.out.println("- Display-Name: "+destresource.getDisplayName());
+ System.out.println("- Content-Language: "+destresource.getContentLanguage());
+ 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" );
+ resource.setDisplayName( "My Display Name" );
+ resource.setContentLanguage( new Locale("de","") );
+ resource.setAttribute( att1, "Hello" );
+ resource.setAttribute( att2, "World" );
+ resource.doWriteProperties();
+
+ resource.doMove(destinationPath, true);
+
+ 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();
+ System.out.println("Destination: "+destresource.location().string());
+ System.out.println("- Comment: "+destresource.getComment());
+ System.out.println("- Display-Name: "+destresource.getDisplayName());
+ System.out.println("- Content-Language: "+destresource.getContentLanguage());
+ 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);
+ }
+
+ public void testObjectValuedAttributes() throws Exception {
+ Location location = provider.location( resourcePath );
+ ControllableResource resource = location.controllableResource();
+ resource.doDelete();
+ resource.doCreateResource();
+ resource.doControl();
+ location = provider.location( reference1Path );
+ ControllableResource ref1resource = location.controllableResource();
+ ref1resource.doDelete();
+ ref1resource.doCreateResource();
+ location = provider.location( reference2Path );
+ ControllableResource ref2resource = location.controllableResource();
+ ref2resource.doDelete();
+ ref2resource.doCreateResource();
+
+ AttributeName attsingle = new AttributeName("http://my.namespace.org", "att-single");
+ AttributeName attlist = new AttributeName("http://my.namespace.org", "att-list");
+ AttributeName attdate = new AttributeName("http://my.namespace.org", "att-date");
+ AttributeName attstring = new AttributeName("http://my.namespace.org", "att-string");
+ List reflist = new ArrayList();
+ reflist.add( ref1resource );
+ reflist.add( ref2resource );
+ resource.setAttribute( attsingle, ref1resource );
+ resource.setAttribute( attlist, reflist );
+ 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}
+ );
+ resource = (ControllableResource)resource.doReadProperties( wantedProperties );
+ ref1resource = (ControllableResource)resource.getAttribute( attsingle );
+ reflist = (List)resource.getAttribute( attlist );
+ Version v = resource.getCheckedIn();
+ System.out.println("Single reference: "+ref1resource.location().string());
+ System.out.println("Multiple reference: ");
+ for( Iterator i = reflist.iterator(); i.hasNext(); )
+ System.out.println("- "+((Resource)i.next()).location().string());
+ 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})
+ );
+ NestedPropertyName attlistNested = new NestedPropertyName(
+ attlist,
+ new PropertyNameList(new PropertyName[]{PropertyName.DISPLAY_NAME})
+ );
+ wantedProperties = new PropertyNameList(
+ new PropertyName[]{PropertyName.DISPLAY_NAME, attsingleNested, attlistNested, attdate}
+ );
+ resource = (ControllableResource)resource.doReadProperties( wantedProperties );
+ ref1resource = (ControllableResource)resource.getAttribute( attsingle );
+ reflist = (List)resource.getAttribute( attlist );
+ System.out.println("Single reference: "+ref1resource.location().string());
+ System.out.println("- "+ref1resource.getDisplayName());
+ System.out.println("Multiple reference: ");
+ for( Iterator i = reflist.iterator(); i.hasNext(); ) {
+ Resource r = (Resource)i.next();
+ System.out.println("- "+r.location().string());
+ System.out.println(" * "+r.getDisplayName());
+ }
+ System.out.println("Date: "+resource.getAttribute(attdate));
}
}
1.6 +3 -3 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ProviderTest.java 2 May 2003 16:06:34 -0000 1.5
+++ ProviderTest.java 16 May 2003 17:02:05 -0000 1.6
@@ -75,7 +75,7 @@
* @version $Revision$
*/
public class ProviderTest extends AbstractTest {
-
+
private String resourcePath = null;
/**
1.2 +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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
1.6 +28 -4 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FolderTest.java 2 May 2003 16:06:34 -0000 1.5
+++ FolderTest.java 16 May 2003 17:02:05 -0000 1.6
@@ -78,6 +78,7 @@
public class FolderTest extends AbstractTest {
private String folderPath = null;
+ private String boundrPath = null;
/**
* Default cosntructor
@@ -85,6 +86,7 @@
public FolderTest(String testName) throws Exception {
super(testName);
folderPath = rootFolderPath()+"/foo";
+ boundrPath = rootFolderPath()+"/bar";
}
/**
@@ -311,6 +313,28 @@
resource.doCreateResource();
resource.doControl();
assertTrue( resourceExistsOnServer(folderPath+"/bar/c.xml") );
+
+ Iterator members = folder.doReadMemberList( null, false );
+ System.out.println("** folder.doReadMemberList( null, false ):");
+ while( members.hasNext() ) {
+ Resource r = (Resource)members.next();
+ System.out.println(r);
+ }
+ }
+
+ public void testDoBind() throws Exception {
+ Location location = provider.location( folderPath );
+ 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();
+ folder.doBind( "bar1", boundResource );
Iterator members = folder.doReadMemberList( null, false );
System.out.println("** folder.doReadMemberList( null, false ):");
1.6 +111 -20 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ControllableResourceTest.java 2 May 2003 16:06:34 -0000 1.5
+++ ControllableResourceTest.java 16 May 2003 17:02:05 -0000 1.6
@@ -67,6 +67,7 @@
import junit.framework.TestSuite;
import javax.wvcm.*;
import javax.wvcm.PropertyNameList.*;
+import java.util.*;
/**
* Tests ControllableResourceImpl.
@@ -79,6 +80,7 @@
private String resourcePath = null;
private String folderPath = null;
private String resourceInFolderPath = null;
+ private String missingFolderPath = null;
private String resourceInMissingFolderPath = null;
/**
@@ -89,6 +91,7 @@
resourcePath = rootFolderPath()+"/test.xml";
folderPath = rootFolderPath()+"/foo";
resourceInFolderPath = folderPath+"/test.xml";
+ missingFolderPath = rootFolderPath()+"/bar";
resourceInMissingFolderPath = rootFolderPath()+"/bar/test.xml";
}
@@ -131,30 +134,20 @@
resource.doCreateResource();
assertTrue( resourceExistsOnServer(resourcePath) );
}
-
+
public void testDoCreateResourceInFolder() throws Exception {
Location location = provider.location( folderPath );
Folder folder = location.folder();
folder.doDelete();
folder.doCreateResource();
assertTrue( resourceExistsOnServer(folderPath) );
-
+
location = provider.location( resourceInFolderPath );
ControllableResource resource = location.controllableResource();
resource.doCreateResource();
assertTrue( resourceExistsOnServer(resourceInFolderPath) );
}
-
- public void testDoCreateControllableResourceMissingFolder() throws Exception {
- Location location = provider.location( resourceInMissingFolderPath );
- ControllableResource resource = location.controllableResource();
- try {
- resource.doDelete();
- resource.doCreateResource();
- assertTrue( "Should have thrown CONFLICT", false );
- } catch (Exception e) {}
- }
-
+
public void testPreResourceMustBeNull() throws Exception {
Location location = provider.location( resourcePath );
ControllableResource resource = location.controllableResource();
@@ -169,7 +162,7 @@
assertEquals( WvcmException.CANNOT_CREATE_RESOURCE_MUST_BE_NULL, e.getReasonCode() );
}
}
-
+
public void testDoCheckout() throws Exception {
Location location = provider.location( resourcePath );
ControllableResource resource = location.controllableResource();
@@ -184,7 +177,7 @@
resource = (ControllableResource)resource.doReadProperties( wantedprops );
assertTrue( resource.getIsCheckedOut() );
}
-
+
public void testDoCheckin() throws Exception {
Location location = provider.location( resourcePath );
ControllableResource resource = location.controllableResource();
@@ -213,7 +206,7 @@
resource = (ControllableResource)resource.doReadProperties( wantedprops );
assertTrue( resource.getVersionControllable() );
}
-
+
public void testGetVersionControllableFolder() throws Exception {
Location location = provider.location( folderPath );
Folder folder = location.folder();
@@ -224,5 +217,103 @@
folder = (Folder)folder.doReadProperties( wantedprops );
assertFalse( folder.getVersionControllable() );
}
+
+ public void testGetCheckedInNested() throws Exception {
+ Location location = provider.location( resourcePath );
+ ControllableResource resource = location.controllableResource();
+ resource.doDelete();
+ resource.doCreateResource();
+ resource.doControl();
+ PropertyName[] vPNames = {PropertyName.VERSION_NAME};
+ PropertyNameList wantedprops =
+ new PropertyNameList( new PropertyName[]{new NestedPropertyName(PropertyName.CHECKED_IN, new PropertyNameList(vPNames))} );
+ resource = (ControllableResource)resource.doReadProperties( wantedprops );
+ Version version = resource.getCheckedIn();
+ System.out.println("Version: "+version.location().string());
+ System.out.println("- version-name: "+version.getVersionName());
+ }
+
+ public void testGetCheckedInPlain() 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());
+ }
+
+ public void testDoUncheckout() throws Exception {
+ Location location = provider.location( resourcePath );
+ ControllableResource resource = location.controllableResource();
+ resource.doDelete();
+ resource.doCreateResource();
+ resource.doControl();
+ PropertyNameList wantedprops =
+ new PropertyNameList( new PropertyName[]{PropertyName.IS_CHECKED_OUT} );
+ resource = (ControllableResource)resource.doReadProperties( wantedprops );
+ assertFalse( resource.getIsCheckedOut() );
+ resource.doCheckout();
+ resource = (ControllableResource)resource.doReadProperties( wantedprops );
+ assertTrue( resource.getIsCheckedOut() );
+ resource.doUncheckout();
+ resource = (ControllableResource)resource.doReadProperties( wantedprops );
+ assertFalse( resource.getIsCheckedOut() );
+ }
+
+ public void testDoUpdate() throws Exception {
+ Location location = provider.location( resourcePath );
+ ControllableResource resource = location.controllableResource();
+ resource.doDelete();
+ resource.doCreateResource();
+ resource.doControl();
+ AttributeName myatt = new AttributeName( "http://my.namespace.org", "my-att" );
+ PropertyName[] rPNames = {PropertyName.CHECKED_IN, myatt};
+ PropertyNameList wantedprops =
+ new PropertyNameList( rPNames );
+ resource = (ControllableResource)resource.doReadProperties( wantedprops );
+ Version version_1_0 = resource.getCheckedIn();
+ System.out.println("Version: "+version_1_0.location().string());
+ try {
+ System.out.println("my-att: "+resource.getAttribute(myatt));
+ assertTrue( "Should have thrown exception", false );
+ } catch (WvcmException e) {}
+ resource.doCheckout();
+ resource.setAttribute( myatt, "Poooooohhhhh!" );
+ resource.doWriteProperties();
+ resource.doCheckin();
+ resource = (ControllableResource)resource.doReadProperties( wantedprops );
+ Version version_1_1 = resource.getCheckedIn();
+ System.out.println("Version: "+version_1_1.location().string());
+ System.out.println("my-att: "+resource.getAttribute(myatt));
+ Iterator i = resource.doUpdate( version_1_0, wantedprops );
+ while( i.hasNext() ) {
+ ControllableResource r = (ControllableResource)i.next();
+ Version v = r.getCheckedIn();
+ System.out.println("Version: "+v.location().string());
+ try {
+ System.out.println("my-att: "+r.getAttribute(myatt));
+ assertTrue( "Should have thrown exception", false );
+ } catch (WvcmException e) {}
+ }
+ }
+
+ public void testDoCreateControllableResourceMissingFolder() throws Exception {
+ Location location = provider.location( resourceInMissingFolderPath );
+ ControllableResource resource = location.controllableResource();
+ location = provider.location( missingFolderPath );
+ Folder missingFolder = location.folder();
+ try {
+ missingFolder.doDelete();
+ resource.doDelete();
+ resource.doCreateResource();
+ assertTrue( "Should have thrown CONFLICT", false );
+ } catch (Exception e) {}
+ }
+
}
1.5 +0 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
1.5 +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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
1.5 +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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
1.5 +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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
1.2 +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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
1.5 +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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
1.5 +0 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
1.5 +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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
1.2 +4 -4 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
1.5 +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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org