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/08/08 17:41:13 UTC
cvs commit: jakarta-slide/proposals/wvcm/test/junit/src/org/apache/webdav/methods AbstractTest.java PropfindMethodTest.java ProppatchMethodTest.java PutMethodTest.java ReportMethodTest.java VersionControlMethodTest.java
pnever 2003/08/08 08:41:13
Modified: proposals/wvcm/test/junit/src/org/apache/wvcm
LocationTest.java ProviderTest.java
ResourceTest.java SearchTest.java VersionTest.java
WorkspaceTest.java AbstractTest.java
ControllableResourceTest.java FolderTest.java
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
Log:
Next bunch for WVCM
Revision Changes Path
1.7 +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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
1.11 +0 -0 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
1.13 +84 -28 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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ResourceTest.java 23 Jul 2003 16:31:28 -0000 1.12
+++ ResourceTest.java 8 Aug 2003 15:41:12 -0000 1.13
@@ -189,7 +189,7 @@
resource.setContentCharacterSet( "UTF-8" );
resource.doWriteContent(
getClass().getResourceAsStream("/org/apache/webdav/resources/hello.txt"), cid );
-
+
wantedprops =
new PropertyNameList( new PropertyName[]{PropertyName.CONTENT_IDENTIFIER,PropertyName.CONTENT_TYPE,PropertyName.CONTENT_CHARACTER_SET} );
OutputStream out = new ByteArrayOutputStream();
@@ -199,7 +199,7 @@
System.out.println(" - Content-Character-Set: "+resource.getContentCharacterSet());
assertEquals("text/plain", resource.getContentType());
assertEquals("UTF-8", resource.getContentCharacterSet());
-
+
resource.setContentType( "text/xml" );
resource.setContentCharacterSet( null );
resource.doWriteContent(
@@ -238,8 +238,7 @@
PropertyName.VERSION_LIST, new PropertyNameList(vrPnames) )
};
PropertyName[] pnames = {
- PropertyName.DISPLAY_NAME,
- new NestedPropertyName(
+ new NestedPropertyName(
PropertyName.VERSION_HISTORY, new PropertyNameList(vhrPnames) )
};
PropertyNameList wantedprops = new PropertyNameList( pnames );
@@ -247,7 +246,6 @@
Resource r = resource.doReadProperties(wantedprops);
assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
ControllableResource r2 = (ControllableResource)r;
- assertEquals( "test.xml", r2.getDisplayName() );
VersionHistory vh = r2.getVersionHistory();
assertNotNull( vh );
System.out.println("\nvh.getDisplayName() = "+vh.getDisplayName());
@@ -282,8 +280,7 @@
PropertyName.VERSION_LIST, new PropertyNameList(vrPnames) )
};
PropertyName[] pnames = {
- PropertyName.DISPLAY_NAME,
- PropertyName.CONTENT_IDENTIFIER,
+ PropertyName.CONTENT_IDENTIFIER,
new NestedPropertyName(
PropertyName.VERSION_HISTORY, new PropertyNameList(vhrPnames) )
};
@@ -294,7 +291,6 @@
assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
ControllableResource r2 = (ControllableResource)r;
- assertEquals( "test.xml", r2.getDisplayName() );
VersionHistory vh = r2.getVersionHistory();
assertNotNull( vh );
System.out.println("\nvh.getDisplayName() = "+vh.getDisplayName());
@@ -325,8 +321,7 @@
PropertyName.VERSION_LIST, new PropertyNameList(vrPnames) )
};
PropertyName[] pnames = {
- PropertyName.DISPLAY_NAME,
- new NestedPropertyName(
+ new NestedPropertyName(
PropertyName.VERSION_HISTORY, new PropertyNameList(vhrPnames) )
};
PropertyNameList wantedprops = new PropertyNameList( pnames );
@@ -335,7 +330,6 @@
Resource r = rtop.doReadProperties(wantedprops);
assertTrue( "Expecting ControllableResource but got "+r, r instanceof ControllableResource );
ControllableResource r2 = (ControllableResource)r;
- assertEquals( "test.xml", r2.getDisplayName() );
VersionHistory vh = r2.getVersionHistory();
assertNotNull( vh );
System.out.println("\nvh.getDisplayName() = "+vh.getDisplayName());
@@ -366,22 +360,19 @@
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}
- )
+ new PropertyNameList(new PropertyName[] {PropertyName.ALL_ATTRIBUTES})
);
allattributes = resource.getAttributeNameList();
n = allattributes.getPropertyNames().length;
System.out.println("\nAll attributes after do-read-all-attributes of: "+
- resource.getDisplayName());
+ resource.location().string());
for( int i=0; i<n; i++)
System.out.println("- "+allattributes.getPropertyNames()[i].getString());
-
+
assertTrue( "Found "+n+" attributes, expected at least 2", n >= 2 );
}
@@ -519,7 +510,7 @@
ControllableResource r = (ControllableResource)resource.doReadProperties(wantedprops);
System.out.println("\nContent-Character-Set: "+r.getContentCharacterSet());
-
+
ByteArrayOutputStream out = new ByteArrayOutputStream();
r = (ControllableResource)resource.doReadContent(wantedprops, out);
System.out.println("\nContent-Character-Set: "+r.getContentCharacterSet());
@@ -775,6 +766,11 @@
resource.setAttribute( attfloat, new Float(Float.MAX_VALUE) );
resource.doWriteProperties();
+ ref1resource.setAttribute( attstring, "This is ref1" );
+ ref1resource.doWriteProperties();
+ ref2resource.setAttribute( attstring, "This is ref2" );
+ ref2resource.doWriteProperties();
+
PropertyNameList wantedProperties;
wantedProperties = new PropertyNameList(
new PropertyName[] {attsingle,
@@ -832,26 +828,26 @@
NestedPropertyName attsingleNested = new NestedPropertyName(
attsingle,
- new PropertyNameList(new PropertyName[]{PropertyName.DISPLAY_NAME})
+ new PropertyNameList(new PropertyName[]{attstring})
);
NestedPropertyName attlistNested = new NestedPropertyName(
attlist,
- new PropertyNameList(new PropertyName[]{PropertyName.DISPLAY_NAME})
+ new PropertyNameList(new PropertyName[]{attstring})
);
wantedProperties = new PropertyNameList(
- new PropertyName[]{PropertyName.DISPLAY_NAME, attsingleNested, attlistNested, attdate}
+ new PropertyName[]{attsingleNested, attlistNested, attdate}
);
resource = (ControllableResource)resource.doReadProperties( wantedProperties );
ref1resource = (ControllableResource)resource.getAttribute( attsingle );
reflist = (List)resource.getAttribute( attlist );
System.out.println("\nSingle reference: ");
System.out.println("- "+ref1resource.location().string());
- System.out.println(" * "+ref1resource.getDisplayName());
+ System.out.println("- att-string="+ref1resource.getAttribute(attstring));
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("- attstring="+r.getAttribute(attstring));
}
System.out.println("Date: "+resource.getAttribute(attdate));
}
@@ -883,6 +879,66 @@
false );
else
throw e;
+ }
+ }
+
+ public void testGetResourceIdentifier() 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.RESOURCE_ID} );
+
+ ControllableResource r = (ControllableResource)resource.doReadProperties(wantedprops);
+ System.out.println("\nResource-ID: "+r.getResourceIdentifier());
+ }
+
+ public void testGetParentList() throws Exception {
+ Location location = provider.location( rootFolderPath()+"/foo" );
+ Folder folder = location.folder();
+ location = provider.location( rootFolderPath()+"/foo/bar" );
+ Folder subfolder = location.folder();
+ location = provider.location( rootFolderPath()+"/foo/test.xml" );
+ ControllableResource resource = location.controllableResource();
+ location = provider.location( rootFolderPath()+"/foo/bar/test2.xml" );
+ ControllableResource resource2 = location.controllableResource();
+ folder.doDelete();
+ folder.doCreateResource();
+ subfolder.doCreateResource();
+ 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 );
+ subfolder.doBind( "test2.xml", resource, true );
+
+ wantedprops = new PropertyNameList( new PropertyName[]{PropertyName.RESOURCE_ID, PropertyName.PARENT_BINDING_LIST} );
+
+ ControllableResource r = (ControllableResource)resource.doReadProperties(wantedprops);
+ System.out.println("\nResource #1: "+r.location().string());
+ System.out.println("- Resource-ID: "+r.getResourceIdentifier());
+ System.out.println("- Parent-List: "+r.getParentBindingList());
+
+ ControllableResource r2 = (ControllableResource)resource2.doReadProperties(wantedprops);
+ System.out.println("\nResource #2: "+r2.location().string());
+ System.out.println("- Resource-ID: "+r2.getResourceIdentifier());
+ System.out.println("- Parent-List: "+r2.getParentBindingList());
+
+ System.out.println("\nTwins:");
+ Iterator i = r.getParentBindingList().iterator();
+ while (i.hasNext()) {
+ Resource.ParentBinding pb = (Resource.ParentBinding)i.next();
+ Resource br = pb.getBoundResource();
+ System.out.println("- "+br.location().string());
}
}
}
1.7 +17 -17 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SearchTest.java 23 Jul 2003 16:31:28 -0000 1.6
+++ SearchTest.java 8 Aug 2003 15:41:13 -0000 1.7
@@ -130,7 +130,7 @@
PropertyNameList wantedprops =
new PropertyNameList( new PropertyName[]{PropertyName.DISPLAY_NAME} );
List result = resource.doSearch(wantedprops, null);
- assertEquals( "IGNORE FOR NOW! This is a bug in the DASL implementation of Slide", "test.xml", ((ControllableResource)result.get(0)).getDisplayName() );
+ assertEquals( "IGNORE FOR NOW! This is a bug in the DASL implementation of Slide", "test.xml", ((ControllableResource)result.get(0)).location().string() );
}
public void testPropertyExpression() throws Exception {
@@ -169,7 +169,7 @@
List results;
Iterator ri;
PropertyNameList wantedprops =
- new PropertyNameList( new PropertyName[]{PropertyName.DISPLAY_NAME, att} );
+ new PropertyNameList( new PropertyName[]{att} );
// String daslWhereXml = "<d:where xmlns:d=\"DAV:\">"+
// "<s:propcontains xmlns:s=\"http://jakarta.apache.org/slide/\">"+
// "<d:prop><my-att xmlns=\"http://my.namespace\"/></d:prop>"+
@@ -185,7 +185,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getAttribute(att)+")");
+ System.out.println(r+" ("+r.getAttribute(att)+")");
}
searchToken =
@@ -195,7 +195,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getAttribute(att)+")");
+ System.out.println(r+" ("+r.getAttribute(att)+")");
}
SortCriterion[] sortCriteria = {new SortCriterion(PropertyName.DISPLAY_NAME, OrderDirection.DESCENDING, null)};
@@ -206,7 +206,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getAttribute(att)+")");
+ System.out.println(r+" ("+r.getAttribute(att)+")");
}
// ONLY PARTIALLY SUPPORTED BY TAMINO WEBDAV SERVER
@@ -219,7 +219,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getAttribute(att)+")");
+ System.out.println(r+" ("+r.getAttribute(att)+")");
}
}
@@ -265,7 +265,7 @@
List results;
Iterator ri;
PropertyNameList wantedprops =
- new PropertyNameList( new PropertyName[]{PropertyName.DISPLAY_NAME, PropertyName.CONTENT_TYPE, att1, att2} );
+ new PropertyNameList( new PropertyName[]{PropertyName.CONTENT_TYPE, att1, att2} );
Expression[] terms = {
new PropertyExpression(att1, "x", PropOperator.EQ, null),
new PropertyExpression(att2, "y", PropOperator.EQ, null)
@@ -279,7 +279,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
+ System.out.println(r+" ("+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
}
expression = new NestedExpression(terms, LogOperator.AND);
@@ -290,7 +290,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
+ System.out.println(r+" ("+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
}
expression = new NestedExpression(terms, LogOperator.OR);
@@ -301,7 +301,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
+ System.out.println(r+" ("+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
}
sortCriteria = new SortCriterion[]{new SortCriterion(PropertyName.DISPLAY_NAME, OrderDirection.DESCENDING, null)};
@@ -312,7 +312,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
+ System.out.println(r+" ("+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
}
Expression[] upperterms = {
@@ -327,7 +327,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getContentType()+", "+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
+ System.out.println(r+" ("+r.getContentType()+", "+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
}
terms = new Expression[]{
@@ -346,7 +346,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+", "+r.getContentType()+", "+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
+ System.out.println(r+" ("+r.getContentType()+", "+r.getAttribute(att1)+", "+r.getAttribute(att2)+")");
}
Expression[] orTerms = {
@@ -362,7 +362,7 @@
ri = results.iterator();
while( ri.hasNext() ) {
Resource r = (Resource)ri.next();
- System.out.println(r+" ("+r.getDisplayName()+")");
+ System.out.println(r);
}
}
1.4 +0 -0 jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/VersionTest.java
Index: VersionTest.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/wvcm/test/junit/src/org/apache/wvcm/VersionTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
1.12 +0 -0 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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
1.10 +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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
1.11 +0 -0 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
1.11 +7 -9 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FolderTest.java 23 Jul 2003 16:31:27 -0000 1.10
+++ FolderTest.java 8 Aug 2003 15:41:13 -0000 1.11
@@ -177,8 +177,7 @@
PropertyName.VERSION_NAME
};
PropertyName[] pnames = {
- PropertyName.DISPLAY_NAME,
- new NestedPropertyName(
+ new NestedPropertyName(
PropertyName.CHECKED_IN, new PropertyNameList(vrPnames) )
};
PropertyNameList wantedprops = new PropertyNameList( pnames );
@@ -189,11 +188,10 @@
Resource r = (Resource)boundMembers.next();
System.out.println(r);
if( r instanceof Folder ) {
- assertTrue("bar".equals(r.getDisplayName()));
+ assertTrue(r.location().string().endsWith("bar"));
}
else if( r instanceof ControllableResource ) {
ControllableResource cr = (ControllableResource)r;
- assertEquals("a.xml", cr.getDisplayName());
Version v = cr.getCheckedIn();
assertEquals("a.xml", v.getDisplayName());
assertEquals("1.0", v.getVersionName());
@@ -337,7 +335,7 @@
resource.doCreateResource();
System.out.println("** bind "+folder.location().string()+" (bar1 -> "+boundResource.location().string()+")");
- folder.doBind( "bar1", boundResource );
+ folder.doBind( "bar1", boundResource, true );
location = provider.location( folderPath+"/bar1" );
Folder subfolder = location.folder();
1.10 +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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
1.7 +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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
1.10 +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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
1.10 +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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
1.10 +13 -11 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PropfindMethodTest.java 23 Jul 2003 16:31:27 -0000 1.9
+++ PropfindMethodTest.java 8 Aug 2003 15:41:13 -0000 1.10
@@ -68,7 +68,8 @@
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
-import org.jdom.xpath.*;
+import org.apache.wvcm.util.*;
+
/**
* Tests PropfindMethod.
@@ -125,6 +126,7 @@
PutMethod putMethod = new PutMethod( resourcePath );
putMethod.setRequestBody(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><test>Hello</test>" );
+ putMethod.addRequestHeader( "Content-Type", "text/xml; charset=\"utf-8\"" );
client.executeMethod( putMethod );
assertEquals( 201, putMethod.getStatusCode() );
@@ -133,7 +135,7 @@
Element pfindElm = new Element( "propfind", davNsp );
Element propElm = new Element( "prop", davNsp );
pfindElm.addContent( propElm );
- Element dnameElm = new Element( "displayname", davNsp );
+ Element dnameElm = new Element( "getcontenttype", davNsp );
propElm.addContent( dnameElm );
Document pfindBody = new Document( pfindElm );
pfindMethod.setRequestBody(
@@ -144,10 +146,10 @@
new SAXBuilder().build(pfindMethod.getResponseBodyAsStream());
new XMLOutputter(" ", true, "UTF-8").output( mstatusBody, System.out );
Element mstatusElm = mstatusBody.getRootElement();
- XPath xpath = XPath.newInstance(
-// "/d:multistatus/d:response[/d:href=\""+resourcePath+"\"]/d:propstat/d:prop/d:displayname" );
- "/d:multistatus/d:response/d:propstat/d:prop/d:displayname" );
- xpath.addNamespace( davNsp );
- assertEquals( "test.xml", ((Element)xpath.selectSingleNode(mstatusElm)).getText() );
+ XPathWrapper xpath = new XPathWrapper(
+ // "/d:multistatus/d:response[/d:href=\""+resourcePath+"\"]/d:propstat/d:prop/d:displayname" );
+ "/d:multistatus/d:response/d:propstat/d:prop/d:getcontenttype", davNsp );
+
+ assertEquals( "text/xml; charset=\"utf-8\"", ((Element)xpath.selectSingleNode(mstatusElm)).getText() );
}
}
1.7 +7 -8 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ProppatchMethodTest.java 23 Jul 2003 16:31:27 -0000 1.6
+++ ProppatchMethodTest.java 8 Aug 2003 15:41:13 -0000 1.7
@@ -68,8 +68,8 @@
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
-import org.jdom.xpath.*;
import java.util.*;
+import org.apache.wvcm.util.*;
/**
* Tests ProppatchMethod.
@@ -152,11 +152,10 @@
new SAXBuilder().build(ppatchMethod.getResponseBodyAsStream());
new XMLOutputter(" ", true, "UTF-8").output( mstatusBody, System.out );
Element mstatusElm = mstatusBody.getRootElement();
- XPath xpath = XPath.newInstance(
+ XPathWrapper xpath = new XPathWrapper(
// "/d:multistatus/d:response[/d:href=\""+resourcePath+"\"]/d:propstat/d:prop/d:displayname" );
// "string(/d:multistatus/d:response/d:propstat/d:status)" );
- "//d:status" );
- xpath.addNamespace( davNsp );
+ "//d:status", davNsp );
Iterator i = xpath.selectNodes(mstatusElm).iterator();
while( i.hasNext() ) {
String status = ((Element)i.next()).getText();
1.10 +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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
1.10 +13 -13 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ReportMethodTest.java 23 Jul 2003 16:31:27 -0000 1.9
+++ ReportMethodTest.java 8 Aug 2003 15:41:13 -0000 1.10
@@ -68,8 +68,8 @@
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
-import org.jdom.xpath.*;
import java.io.*;
+import org.apache.wvcm.util.*;
/**
* Tests ReportMethod.
@@ -126,6 +126,7 @@
PutMethod putMethod = new PutMethod( resourcePath );
putMethod.setRequestBody(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><test>Hello</test>" );
+ putMethod.addRequestHeader( "Content-Type", "text/xml; charset=\"utf-8\"" );
client.executeMethod( putMethod );
assertEquals( 201, putMethod.getStatusCode() );
@@ -133,7 +134,7 @@
Namespace davNsp = Namespace.getNamespace( "d", "DAV:" );
Element expropElm = new Element( "expand-property", davNsp );
Element dname1Elm = new Element( "property", davNsp );
- dname1Elm.setAttribute( "name", "displayname" );
+ dname1Elm.setAttribute( "name", "getcontenttype" );
expropElm.addContent( dname1Elm );
Element ownerElm = new Element( "property", davNsp );
ownerElm.setAttribute( "name", "owner" );
@@ -145,19 +146,18 @@
new XMLOutputter(" ", true, "UTF-8").output( repBody, System.out );
repMethod.setRequestBody(
new XMLOutputter("", false, "UTF-8").outputString(repBody) );
+ repMethod.addRequestHeader( "Content-Type", "text/xml; charset=\"utf-8\"" );
client.executeMethod( repMethod );
assertEquals( 207, repMethod.getStatusCode() );
Document mstatusBody =
new SAXBuilder().build(repMethod.getResponseBodyAsStream());
new XMLOutputter("", false, "UTF-8").output( mstatusBody, System.out );
Element mstatusElm = mstatusBody.getRootElement();
- XPath xpath = XPath.newInstance(
- "/d:multistatus/d:response/d:propstat/d:prop/d:displayname" );
- xpath.addNamespace( davNsp );
- assertEquals( "test.xml", ((Element)xpath.selectSingleNode(mstatusElm)).getText() );
- xpath = XPath.newInstance(
- "/d:multistatus/d:response/d:propstat/d:prop/d:owner/d:response/d:propstat/d:prop/d:displayname" );
- xpath.addNamespace( davNsp );
+ XPathWrapper xpath = new XPathWrapper(
+ "/d:multistatus/d:response/d:propstat/d:prop/d:getcontenttype", davNsp );
+ assertEquals( "text/xml; charset=\"utf-8\"", ((Element)xpath.selectSingleNode(mstatusElm)).getText() );
+ xpath = new XPathWrapper(
+ "/d:multistatus/d:response/d:propstat/d:prop/d:owner/d:response/d:propstat/d:prop/d:displayname", davNsp );
assertTrue( ((Element)xpath.selectSingleNode(mstatusElm)).getText().endsWith(username) );
}
1.10 +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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10