1 16 17 package org.apache.cocoon.acting; 18 19 import java.util.Map ; 20 21 import org.apache.avalon.framework.parameters.Parameters; 22 import org.apache.cocoon.SitemapComponentTestCase; 23 24 30 public class RequestParamActionTestCase extends SitemapComponentTestCase { 31 32 public void testRequestAction() throws Exception { 33 34 getRequest().setRequestURI("test.xml?abc=def&ghi=jkl"); 35 getRequest().setQueryString("abc=def&ghi=jkl"); 36 getRequest().setContextPath("servlet"); 37 getRequest().addParameter("abc", "def"); 38 39 Parameters parameters = new Parameters(); 40 parameters.setParameter("parameters", "true"); 41 42 Map result = act("request", null, parameters); 43 44 assertNotNull("Test if resource exists", result); 45 assertEquals("Test for parameter", "test.xml?abc=def&ghi=jkl", result.get("requestURI")); 46 assertEquals("Test for parameter", "?abc=def&ghi=jkl", result.get("requestQuery")); 47 assertEquals("Test for parameter", "servlet", result.get("context")); 48 assertEquals("Test for parameter", "def", result.get("abc")); 49 assertNull("Test for parameter", result.get("ghi")); 50 } 51 } 52 | Popular Tags |