01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon;
18:
19: /**
20: * Check redirects.
21: *
22: * @version $Id: $
23: */
24: public class RedirectTestCase extends HtmlUnitTestCase {
25: final String pageurl = "/samples/test/redirect/";
26:
27: public void testRedirectToFromSitemap() throws Exception {
28: loadResponse(pageurl + "redirect-to-from-sitemap");
29: assertEquals("Status code", 302, response.getStatusCode());
30: }
31:
32: public void testRedirectToInternalFromSitemap() throws Exception {
33: loadResponse(pageurl + "redirect-to-internal-from-sitemap");
34: assertEquals("Status code", 200, response.getStatusCode());
35: }
36:
37: public void testRedirectToFromFlow() throws Exception {
38: loadResponse(pageurl + "redirect-to-from-flow");
39: assertEquals("Status code", 302, response.getStatusCode());
40: }
41:
42: public void testSendStatus() throws Exception {
43: loadResponse(pageurl + "send-status");
44: assertEquals("Status code", 204, response.getStatusCode());
45: }
46:
47: public void testSendPage() throws Exception {
48: loadResponse(pageurl + "send-page");
49: assertEquals("Status code", 200, response.getStatusCode());
50: }
51:
52: public void testDoNothingFromSitemap() throws Exception {
53: loadResponse(pageurl + "donothing-from-sitemap");
54: assertEquals("Status code", 404, response.getStatusCode());
55: }
56:
57: public void testDoNothingFromFlow() throws Exception {
58: loadResponse(pageurl + "donothing-from-flow");
59: assertEquals("Status code", 500, response.getStatusCode());
60: }
61: }
|