cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r326852 - /cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/Bug36872HttpHeaderActionTestCase.java
Date Thu, 20 Oct 2005 07:53:34 GMT
Author: bdelacretaz
Date: Thu Oct 20 00:53:27 2005
New Revision: 326852

URL: http://svn.apache.org/viewcvs?rev=326852&view=rev
Log:
Test modified to reflect the current behaviour: internal requests do not allow HTTP headers
to be set. See http://issues.apache.org/bugzilla/show_bug.cgi?id=36872#c6

Added:
    cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/Bug36872HttpHeaderActionTestCase.java

Added: cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/Bug36872HttpHeaderActionTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/Bug36872HttpHeaderActionTestCase.java?rev=326852&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/Bug36872HttpHeaderActionTestCase.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/Bug36872HttpHeaderActionTestCase.java
Thu Oct 20 00:53:27 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ * Licensed  under the  Apache License,  Version 2.0  (the "License");
+ * you may not use  this file  except in  compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed  under the  License is distributed on an "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon;
+
+public class Bug36872HttpHeaderActionTestCase 
+	extends HtmlUnitTestCase {
+
+    static final String BASE_URL = "/samples/test/http-header-action/";
+    
+    static final String HEADER = "X-HttpHeaderActionTest";
+    
+    /** some pages must return the X-HttpHeaderActionTest header with the value "from-" +
page */
+    private void assertHeaderPresent(String page) throws Exception {
+        loadResponse(BASE_URL + page);
+        final String value = response.getResponseHeaderValue(HEADER);
+        assertNotNull("Header '" + HEADER + "' must be present in'" + page + "' response",value);
+        final String expected = "from-" + page;
+        assertEquals("Header '" + HEADER + "' must match expected value in'" + page + "'
response",expected,value);
+    }
+    
+    private void assertHeaderNotPresent(String page) throws Exception {
+        loadResponse(BASE_URL + page);
+        final String value = response.getResponseHeaderValue(HEADER);
+        assertNull("Header '" + HEADER + "' must not be present in'" + page + "' response",value);
+    }
+    
+    public void testMountedSitemap() throws Exception {
+    		assertHeaderPresent("mounted-sitemap");
+    }
+
+    public void testInternalRequestNoFlow()  throws Exception {
+    		// currently, internal requests do not allow HTTP headers to be set, see bugzilla 36872
+		assertHeaderNotPresent("internal-request");
+}
+
+    public void testInternalRequestWithFlow()  throws Exception {
+		assertHeaderPresent("internal-request-flow");
+}
+
+}



Mime
View raw message