1 16 package org.apache.pluto.portalImpl.portlet.test; 17 18 import java.io.IOException ; 19 20 import javax.portlet.PortletContext; 21 import javax.portlet.PortletException; 22 import javax.portlet.PortletRequest; 23 import javax.portlet.PortletRequestDispatcher; 24 import javax.portlet.PortletResponse; 25 import javax.portlet.RenderRequest; 26 import javax.portlet.RenderResponse; 27 28 34 public class DispatcherRenderParameterTest 35 extends AbstractReflectivePortletTest { 36 37 public static final String KEY_A = "includedTestKey"; 38 public static final String VAL_A = "includedTestVal"; 39 public static final String KEY_B = "bTestKey"; 40 public static final String VAL_B = "bTestVal"; 41 public static final String RESULT_KEY = "org.apache.pluto.testsuite.RESULTKEY"; 42 43 44 public DispatcherRenderParameterTest() { 45 46 } 47 48 public String getTestSuiteName() { 49 return "Dispatcher Render Parameter Test"; 50 } 51 52 protected TestResult checkIncludedParameterTest(PortletContext ctx, 53 PortletRequest req, 54 PortletResponse res) 55 throws IOException , PortletException { 56 PortletRequestDispatcher disp = 57 ctx.getRequestDispatcher("/tests/include?"+KEY_A+"="+VAL_A+"&"+KEY_B+"="+VAL_B); 58 59 disp.include((RenderRequest)req, (RenderResponse)res); 60 61 TestResult result = new TestResult(); 62 result.setName("Dispatcher Render Parameter Test"); 63 result.setDesc("Ensure query parameters added during dispatching are attached to the request."); 64 if(req.getAttribute(RESULT_KEY)!=null && Boolean.TRUE.equals(req.getAttribute(RESULT_KEY))) { 65 result.setReturnCode(TestResult.PASSED); 66 } 67 else { 68 result.setReturnCode(TestResult.FAILED); 69 result.setResults("Unable to find expected parameter"); 70 } 71 return result; 72 } 73 74 75 } 76 77 | Popular Tags |