1 16 package org.apache.cocoon; 17 18 public class Bug36872HttpHeaderActionTestCase 19 extends HtmlUnitTestCase { 20 21 static final String BASE_URL = "/samples/test/http-header-action/"; 22 23 static final String HEADER = "X-HttpHeaderActionTest"; 24 25 26 private void assertHeaderPresent(String page) throws Exception { 27 loadResponse(BASE_URL + page); 28 final String value = response.getResponseHeaderValue(HEADER); 29 assertNotNull("Header '" + HEADER + "' must be present in'" + page + "' response",value); 30 final String expected = "from-" + page; 31 assertEquals("Header '" + HEADER + "' must match expected value in'" + page + "' response",expected,value); 32 } 33 34 private void assertHeaderNotPresent(String page) throws Exception { 35 loadResponse(BASE_URL + page); 36 final String value = response.getResponseHeaderValue(HEADER); 37 assertNull("Header '" + HEADER + "' must not be present in'" + page + "' response",value); 38 } 39 40 public void testMountedSitemap() throws Exception { 41 assertHeaderPresent("mounted-sitemap"); 42 } 43 44 public void testInternalRequestNoFlow() throws Exception { 45 assertHeaderNotPresent("internal-request"); 47 } 48 49 public void testInternalRequestWithFlow() throws Exception { 50 assertHeaderPresent("internal-request-flow"); 51 } 52 53 } 54 | Popular Tags |