KickJava   Java API By Example, From Geeks To Geeks.

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


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  * HtmlUnit TestCase for Content type headers returned by Cocoon readers.
20  *
21  * Each httpRequest is repeated twice to check caching pipeline.
22  * Check for text/xml instead of text/html in order not to be fooled
23  * by 404 or 500 error pages.
24  *
25  * @version $Id: $
26  */

27 public class ReaderMimeTypeTestCase
28     extends HtmlUnitTestCase
29 {
30     static final String JavaDoc pageurl = "/samples/test/reader-mime-type/";
31
32     /**
33      * Check that content-type is <I>not</I> derived from URL extension.
34      */

35     public void test10()
36         throws Exception JavaDoc
37     {
38         call10();
39         call10();
40     }
41
42     private void call10()
43         throws Exception JavaDoc
44     {
45         loadResponse(pageurl+"test10.xml");
46         assertEquals("Content type should be undefined", "", response.getContentType());
47     }
48
49     /**
50      * Check content-type derived from map:read/@src.
51      */

52     public void test20()
53         throws Exception JavaDoc
54     {
55         call20();
56         call20();
57     }
58
59     private void call20()
60         throws Exception JavaDoc
61     {
62         loadResponse(pageurl+"test20.x20");
63         assertEquals("Content type", "text/xml", response.getContentType());
64     }
65
66     /**
67      * Check content-type derived from map:read/@mime-type.
68      */

69     public void test30()
70         throws Exception JavaDoc
71     {
72         call30();
73         call30();
74     }
75
76     private void call30()
77         throws Exception JavaDoc
78     {
79         loadResponse(pageurl+"test30.x30");
80         assertEquals("Content type", "text/xml", response.getContentType());
81     }
82
83     /**
84      * Check content-type derived from map:reader/@mime-type.
85      */

86     public void test40()
87         throws Exception JavaDoc
88     {
89         call40();
90         call40();
91     }
92
93     private void call40()
94         throws Exception JavaDoc
95     {
96         loadResponse(pageurl+"test40.x40");
97         assertEquals("Content type", "text/xml", response.getContentType());
98     }
99
100     /**
101      * Check that content-type is <I>not</I> inherited across cocoon:/
102      * indirections
103      */

104     public void test50()
105         throws Exception JavaDoc
106     {
107         call50();
108         call50();
109     }
110
111     private void call50()
112         throws Exception JavaDoc
113     {
114         loadResponse(pageurl+"test50.xml");
115         assertEquals("Content type should be undefined", "", response.getContentType());
116     }
117
118     /**
119      * Check content-type derived from map:read/@src.
120      */

121     public void test60()
122         throws Exception JavaDoc
123     {
124         call60();
125         call60();
126     }
127
128     private void call60()
129         throws Exception JavaDoc
130     {
131         loadResponse(pageurl+"test60.x60");
132         assertEquals("Content type", "text/xml", response.getContentType());
133     }
134
135     /**
136      * Check content-type derived from map:read/@mime-type.
137      */

138     public void test70()
139         throws Exception JavaDoc
140     {
141         call70();
142         call70();
143     }
144
145     private void call70()
146         throws Exception JavaDoc
147     {
148         loadResponse(pageurl+"test70.x70");
149         assertEquals("Content type", "text/xml", response.getContentType());
150     }
151 }
152
Popular Tags