Skip to main content
Last updated June 04, 2013 12:34, by Martin Scott Nicklous
Feedicon  
===JSR 286 Parameter Handling Tests - Action Phase Tests=== (Note that the parameter "ActionTest" controls what test the portlet performs and should be ignored.) <table border="1"> <tr> <th>Preconditions</th> <th>Pluto</th> </tr><tr> <td colspan="3" align="left"> Test 1: Set and attempt to delete public render parameter on ActionResponse <br/>actionResponse.setRenderParameter("publicRenderParameter1", "15"); <br/>try {actionResponse.setRenderParameter("publicRenderParameter1", (String) null); } <br/>catch(Exception e) {writer.write("remove publicRenderParameter1 from ActionResponse failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[1] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[1] </td><td> Action Phase: <br/>remove publicRenderParameter1 from ActionResponse failed. <br/>java.lang.IllegalArgumentException: Illegal Argument: value (argument should not be null) <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>key=[publicRenderParameter1] values[0]=[15] <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[1] <br/>mapName=parameterMap: <br/>key=[publicRenderParameter1] values[0]=[15] <br/>key=[ActionTest] values[0]=[1] </td> </tr><tr> <td colspan="3" align="left"> Test 2: Set and attempt to delete private render parameter on ActionResponse <br/>actionResponse.setRenderParameter("privateRenderParameter1", "1"); <br/>try {actionResponse.setRenderParameter("privateRenderParameter1", (String) null); } <br/>catch(Exception e) {writer.write("remove privateRenderParameter1 from ActionResponse failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[2] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[2]) </td><td> Action Phase: <br/>remove privateRenderParameter1 from ActionResponse failed. <br/>java.lang.IllegalArgumentException: Illegal Argument: value (argument should not be null) <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[privateRenderParameter1] values[0]=[1] <br/>key=[ActionTest] values[0]=[2] <br/>mapName=parameterMap: <br/>key=[privateRenderParameter1] values[0]=[1] <br/>key=[ActionTest] values[0]=[2] </td> </tr><tr> <td colspan="3" align="left"> Test 3: <br/>// Set and try to delete private render parameter from ActionResponse thru values[] - <br/>actionResponse.setRenderParameter("privateRenderParameter2", "1"); <br/>try {String[] values = {null}; actionResponse.setRenderParameter("privateRenderParameter2", values);} <br/>catch(Exception e) {writer.write("remove privateRenderParameter2 from ActionResponse using values[] failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[3] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[3] </td><td> Action Phase: <br/>remove privateRenderParameter2 from ActionResponse using values[] failed. <br/>java.lang.IllegalStateException: Illegal Argument: values array is empty or contains only null values <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[privateRenderParameter2] values[0]=[1] <br/>key=[ActionTest] values[0]=[3] <br/>mapName=parameterMap: <br/>key=[privateRenderParameter2] values[0]=[1] <br/>key=[ActionTest] values[0]=[3] </td> </tr><tr> <td colspan="3" align="left"> Test 4: <br/>// Set Parameters using map directly (initial map empty) - <br/>String[] values = {"Fred", "Wilma", "Pebbles"}; <br/>try {actionResponse.getRenderParameterMap().put("privateRenderParameter3", values);} <br/>catch(Exception e) {writer.write("Putting map values directly failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[4] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[4] </td><td> Action Phase: <br/>(No exception) <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[4] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[4] </td> </tr><tr> <td colspan="3" align="left"> Test 5: <br/>// Set Parameters using map directly (initial map non-empty) - <br/>actionResponse.setRenderParameter("privateRenderParameter2", "1"); <br/>String[] values = {"Fred", "Wilma", "Pebbles"}; <br/>try {actionResponse.getRenderParameterMap().put("privateRenderParameter3", values);} <br/>catch(Exception e) {writer.write("Putting map values directly failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[5] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[5] </td><td> Action Phase: <br/>(no exception) <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[privateRenderParameter2] values[0]=[1] <br/>key=[ActionTest] values[0]=[5] <br/>mapName=parameterMap: <br/>key=[privateRenderParameter2] values[0]=[1] <br/>key=[ActionTest] values[0]=[5] </td> </tr><tr> <td colspan="3" align="left"> Test 6: <br/>// Set Parameters using setParameters() (initial map empty) - <br/>String[] values2 = {"Barney", "Betty"}; <br/>try { <br/> Map&lt;String, String[]&gt; parmMap = actionResponse.getRenderParameterMap(); <br/> parmMap.put("privateRenderParameter4", values2); <br/> actionResponse.setRenderParameters(parmMap); <br/>} <br/>catch(Exception e) {writer.write("setRenderParameters() failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[6] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[6] </td><td> Action Phase: <br/>(no exception) <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[6] <br/>key=[privateRenderParameter4] values[0]=[Barney] <br/>key=[privateRenderParameter4] values[1]=[Betty] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[6] <br/>key=[privateRenderParameter4] values[0]=[Barney] <br/>key=[privateRenderParameter4] values[1]=[Betty] </td> </tr><tr> <td colspan="3" align="left"> Test 7: <br/>// Set Parameters using setParameters() (initial map non-empty) - <br/>actionResponse.setRenderParameter("privateRenderParameter2", "1"); <br/>String[] values2 = {"Barney", "Betty"}; <br/>try { <br/> Map&lt;String, String[]&gt; parmMap = actionResponse.getRenderParameterMap(); <br/> parmMap.put("privateRenderParameter4", values2); <br/> actionResponse.setRenderParameters(parmMap); <br/>} <br/>catch(Exception e) {writer.write("setRenderParameters() failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[7] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[7] </td><td> Action Phase: <br/>(no exception) <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[privateRenderParameter2] values[0]=[1] <br/>key=[privateRenderParameter4] values[0]=[Barney] <br/>key=[privateRenderParameter4] values[1]=[Betty] <br/>key=[ActionTest] values[0]=[7] <br/>mapName=parameterMap: <br/>key=[privateRenderParameter2] values[0]=[1] <br/>key=[privateRenderParameter4] values[0]=[Barney] <br/>key=[privateRenderParameter4] values[1]=[Betty] <br/>key=[ActionTest] values[0]=[7] </td> </tr><tr> <td colspan="3" align="left"> Test 8: <br/>// Set parameters on response and remove them using cleared map - <br/>actionResponse.setRenderParameter("privateRenderParameter2", "177"); <br/>actionResponse.setRenderParameter("publicRenderParameter1", "354"); <br/>Map&lt;String, String[]&gt; parmMap = actionResponse.getRenderParameterMap(); <br/>try {parmMap.clear();} <br/>catch(Exception e) {writer.write("parmMap.clear() failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} <br/>try {actionResponse.setRenderParameters(parmMap);} <br/>catch(Exception e) {writer.write("setRenderParameters() failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[8] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[8] </td><td> Action Phase: <br/>(no exception) <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[8] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[8] </td> </tr><tr> <td colspan="3" align="left"> Test 9: <br/>// Set parameters on response and remove them using map of nulled values - <br/>actionResponse.setRenderParameter("privateRenderParameter2", "177"); <br/>actionResponse.setRenderParameter("publicRenderParameter1", "354"); <br/>Map&lt;String, String[]&gt; parmMap = actionResponse.getRenderParameterMap(); <br/>Set&lt;String&gt; keySet = parmMap.keySet(); <br/>for (String key : keySet){ <br/> String[] values = {null}; <br/> try {parmMap.put(key, values);} <br/> catch(Exception e) {writer.write("parmMap.put(key, values) failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} <br/>} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[9] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[9] </td><td> Action Phase: <br/>setRenderParameters() failed. <br/>java.lang.IllegalStateException: parameters map contains a values array which is empty or contains only null values <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>key=[publicRenderParameter1] values[0]=[354] <br/>mapName=privateParameterMap: <br/>key=[privateRenderParameter2] values[0]=[177] <br/>key=[ActionTest] values[0]=[9] <br/>mapName=parameterMap: <br/>key=[privateRenderParameter2] values[0]=[177] <br/>key=[publicRenderParameter1] values[0]=[354] <br/>key=[ActionTest] values[0]=[9] </td> </tr><tr> <td colspan="3" align="left"> Test 10: <br/>// Copy all parameters on ActionRequest to ActionResponse - <br/>Map&lt;String, String[]&gt; parmMap = actionRequest.getParameterMap(); <br/>try {actionResponse.setRenderParameters(parmMap);} <br/>catch(Exception e) {writer.write("setRenderParameters() failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>key=[publicRenderParameter1] values[0]=[15] <br/>mapName=privateParameterMap: <br/>key=[actionURLParameter1] values[0]=[342] <br/>key=[publicRenderParameter1] values[0]=[157] <br/>key=[ActionTest] values[0]=[10] <br/>mapName=parameterMap: <br/>key=[actionURLParameter1] values[0]=[342] <br/>key=[publicRenderParameter1] values[0]=[157] <br/>key=[publicRenderParameter1] values[1]=[15] <br/>key=[ActionTest] values[0]=[10] </td><td> Action Phase: <br/>(no exception) <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>key=[publicRenderParameter1] values[0]=[157] <br/>key=[publicRenderParameter1] values[1]=[15] <br/>mapName=privateParameterMap: <br/>key=[actionURLParameter1] values[0]=[342] <br/>key=[ActionTest] values[0]=[10] <br/>mapName=parameterMap: <br/>key=[actionURLParameter1] values[0]=[342] <br/>key=[publicRenderParameter1] values[0]=[157] <br/>key=[publicRenderParameter1] values[1]=[15] <br/>key=[ActionTest] values[0]=[10] </td> </tr><tr> <td colspan="3" align="left"> Test 11: <br/>// Remove public render parameter from ActionResponse - <br/>try {actionResponse.removePublicRenderParameter("publicRenderParameter1"); } <br/>catch(Exception e) {writer.write("removePublicRenderParameter() from ActionResponse failed.&lt;br/&gt;" + e.toString() + "&lt;br/&gt;");} </td> </tr><tr> <td> Messages from Action Phase: <br/>mapName=publicParameterMap: <br/>key=[publicRenderParameter1] values[0]=[15] <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[11] <br/>mapName=parameterMap: <br/>key=[publicRenderParameter1] values[0]=[15] <br/>key=[ActionTest] values[0]=[11] </td><td> Action Phase: <br/>(no exception) <br/>Render Phase: <br/>mapName=publicParameterMap: <br/>mapName=privateParameterMap: <br/>key=[ActionTest] values[0]=[11] <br/>mapName=parameterMap: <br/>key=[ActionTest] values[0]=[11] </td> </tr><tr> <td colspan="3" align="left"> Test 12: </td> </tr><tr> <td> (no parameters set) </td><td> Action Phase: Render Phase: </td> </tr> </table>
 
 
Close
loading
Please Confirm
Close