KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > WebdavDavmapTestCase


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon;
17
18 /**
19  * Check davmap samples.
20  *
21  * @version $Id: $
22  */

23 public class WebdavDavmapTestCase
24     extends HtmlUnitTestCase
25 {
26     static final String JavaDoc pageurl = "/samples/blocks/webdav/davmap/";
27     static final String JavaDoc davmapTitle = "repo";
28
29     static final String JavaDoc contentB =
30         "<page>\n"+
31         "<title>Page 2</title>\n"+
32         "<content>\n"+
33         " <para>Paragraph 1</para>\n"+
34         " <para>Paragraph 2</para>\n"+
35         "</content>\n"+
36         "</page>\n";
37
38     public void testDavmapTitle()
39         throws Exception JavaDoc
40     {
41         loadHtmlPage(pageurl+"repo/");
42         assertXPath("/html/head/title", davmapTitle);
43     }
44
45     public void testPutReadDelete()
46         throws Exception JavaDoc
47     {
48         loadPutResponse(pageurl+"repo/contentB.xml", contentB);
49         assertEquals("Status code", 201, response.getStatusCode());
50
51         loadXmlPage(pageurl+"repo/contentB.xml");
52         assertXPath("/page/title", "Page 2");
53
54         loadDeleteResponse(pageurl+"repo/contentB.xml");
55         assertEquals("Status code", 200, response.getStatusCode());
56     }
57 }
58
Popular Tags