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.)

PreconditionsPluto
Test 1: Set and attempt to delete public render parameter on ActionResponse
actionResponse.setRenderParameter("publicRenderParameter1", "15");
try {actionResponse.setRenderParameter("publicRenderParameter1", (String) null); }
catch(Exception e) {writer.write("remove publicRenderParameter1 from ActionResponse failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[1]
mapName=parameterMap:
key=[ActionTest] values[0]=[1]
Action Phase:
remove publicRenderParameter1 from ActionResponse failed.
java.lang.IllegalArgumentException: Illegal Argument: value (argument should not be null)
Render Phase:
mapName=publicParameterMap:
key=[publicRenderParameter1] values[0]=[15]
mapName=privateParameterMap:
key=[ActionTest] values[0]=[1]
mapName=parameterMap:
key=[publicRenderParameter1] values[0]=[15]
key=[ActionTest] values[0]=[1]
Test 2: Set and attempt to delete private render parameter on ActionResponse
actionResponse.setRenderParameter("privateRenderParameter1", "1");
try {actionResponse.setRenderParameter("privateRenderParameter1", (String) null); }
catch(Exception e) {writer.write("remove privateRenderParameter1 from ActionResponse failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[2]
mapName=parameterMap:
key=[ActionTest] values[0]=[2])
Action Phase:
remove privateRenderParameter1 from ActionResponse failed.
java.lang.IllegalArgumentException: Illegal Argument: value (argument should not be null)
Render Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[privateRenderParameter1] values[0]=[1]
key=[ActionTest] values[0]=[2]
mapName=parameterMap:
key=[privateRenderParameter1] values[0]=[1]
key=[ActionTest] values[0]=[2]
Test 3:
// Set and try to delete private render parameter from ActionResponse thru values[] -
actionResponse.setRenderParameter("privateRenderParameter2", "1");
try {String[] values = {null}; actionResponse.setRenderParameter("privateRenderParameter2", values);}
catch(Exception e) {writer.write("remove privateRenderParameter2 from ActionResponse using values[] failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[3]
mapName=parameterMap:
key=[ActionTest] values[0]=[3]
Action Phase:
remove privateRenderParameter2 from ActionResponse using values[] failed.
java.lang.IllegalStateException: Illegal Argument: values array is empty or contains only null values
Render Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[privateRenderParameter2] values[0]=[1]
key=[ActionTest] values[0]=[3]
mapName=parameterMap:
key=[privateRenderParameter2] values[0]=[1]
key=[ActionTest] values[0]=[3]
Test 4:
// Set Parameters using map directly (initial map empty) -
String[] values = {"Fred", "Wilma", "Pebbles"};
try {actionResponse.getRenderParameterMap().put("privateRenderParameter3", values);}
catch(Exception e) {writer.write("Putting map values directly failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[4]
mapName=parameterMap:
key=[ActionTest] values[0]=[4]
Action Phase:
(No exception)
Render Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[4]
mapName=parameterMap:
key=[ActionTest] values[0]=[4]
Test 5:
// Set Parameters using map directly (initial map non-empty) -
actionResponse.setRenderParameter("privateRenderParameter2", "1");
String[] values = {"Fred", "Wilma", "Pebbles"};
try {actionResponse.getRenderParameterMap().put("privateRenderParameter3", values);}
catch(Exception e) {writer.write("Putting map values directly failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[5]
mapName=parameterMap:
key=[ActionTest] values[0]=[5]
Action Phase:
(no exception)
Render Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[privateRenderParameter2] values[0]=[1]
key=[ActionTest] values[0]=[5]
mapName=parameterMap:
key=[privateRenderParameter2] values[0]=[1]
key=[ActionTest] values[0]=[5]
Test 6:
// Set Parameters using setParameters() (initial map empty) -
String[] values2 = {"Barney", "Betty"};
try {
Map<String, String[]> parmMap = actionResponse.getRenderParameterMap();
parmMap.put("privateRenderParameter4", values2);
actionResponse.setRenderParameters(parmMap);
}
catch(Exception e) {writer.write("setRenderParameters() failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[6]
mapName=parameterMap:
key=[ActionTest] values[0]=[6]
Action Phase:
(no exception)
Render Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[6]
key=[privateRenderParameter4] values[0]=[Barney]
key=[privateRenderParameter4] values[1]=[Betty]
mapName=parameterMap:
key=[ActionTest] values[0]=[6]
key=[privateRenderParameter4] values[0]=[Barney]
key=[privateRenderParameter4] values[1]=[Betty]
Test 7:
// Set Parameters using setParameters() (initial map non-empty) -
actionResponse.setRenderParameter("privateRenderParameter2", "1");
String[] values2 = {"Barney", "Betty"};
try {
Map<String, String[]> parmMap = actionResponse.getRenderParameterMap();
parmMap.put("privateRenderParameter4", values2);
actionResponse.setRenderParameters(parmMap);
}
catch(Exception e) {writer.write("setRenderParameters() failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[7]
mapName=parameterMap:
key=[ActionTest] values[0]=[7]
Action Phase:
(no exception)
Render Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[privateRenderParameter2] values[0]=[1]
key=[privateRenderParameter4] values[0]=[Barney]
key=[privateRenderParameter4] values[1]=[Betty]
key=[ActionTest] values[0]=[7]
mapName=parameterMap:
key=[privateRenderParameter2] values[0]=[1]
key=[privateRenderParameter4] values[0]=[Barney]
key=[privateRenderParameter4] values[1]=[Betty]
key=[ActionTest] values[0]=[7]
Test 8:
// Set parameters on response and remove them using cleared map -
actionResponse.setRenderParameter("privateRenderParameter2", "177");
actionResponse.setRenderParameter("publicRenderParameter1", "354");
Map<String, String[]> parmMap = actionResponse.getRenderParameterMap();
try {parmMap.clear();}
catch(Exception e) {writer.write("parmMap.clear() failed.<br/>" + e.toString() + "<br/>");}
try {actionResponse.setRenderParameters(parmMap);}
catch(Exception e) {writer.write("setRenderParameters() failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[8]
mapName=parameterMap:
key=[ActionTest] values[0]=[8]
Action Phase:
(no exception)
Render Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[8]
mapName=parameterMap:
key=[ActionTest] values[0]=[8]
Test 9:
// Set parameters on response and remove them using map of nulled values -
actionResponse.setRenderParameter("privateRenderParameter2", "177");
actionResponse.setRenderParameter("publicRenderParameter1", "354");
Map<String, String[]> parmMap = actionResponse.getRenderParameterMap();
Set<String> keySet = parmMap.keySet();
for (String key : keySet){
String[] values = {null};
try {parmMap.put(key, values);}
catch(Exception e) {writer.write("parmMap.put(key, values) failed.<br/>" + e.toString() + "<br/>");}
}
Messages from Action Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[9]
mapName=parameterMap:
key=[ActionTest] values[0]=[9]
Action Phase:
setRenderParameters() failed.
java.lang.IllegalStateException: parameters map contains a values array which is empty or contains only null values
Render Phase:
mapName=publicParameterMap:
key=[publicRenderParameter1] values[0]=[354]
mapName=privateParameterMap:
key=[privateRenderParameter2] values[0]=[177]
key=[ActionTest] values[0]=[9]
mapName=parameterMap:
key=[privateRenderParameter2] values[0]=[177]
key=[publicRenderParameter1] values[0]=[354]
key=[ActionTest] values[0]=[9]
Test 10:
// Copy all parameters on ActionRequest to ActionResponse -
Map<String, String[]> parmMap = actionRequest.getParameterMap();
try {actionResponse.setRenderParameters(parmMap);}
catch(Exception e) {writer.write("setRenderParameters() failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
key=[publicRenderParameter1] values[0]=[15]
mapName=privateParameterMap:
key=[actionURLParameter1] values[0]=[342]
key=[publicRenderParameter1] values[0]=[157]
key=[ActionTest] values[0]=[10]
mapName=parameterMap:
key=[actionURLParameter1] values[0]=[342]
key=[publicRenderParameter1] values[0]=[157]
key=[publicRenderParameter1] values[1]=[15]
key=[ActionTest] values[0]=[10]
Action Phase:
(no exception)
Render Phase:
mapName=publicParameterMap:
key=[publicRenderParameter1] values[0]=[157]
key=[publicRenderParameter1] values[1]=[15]
mapName=privateParameterMap:
key=[actionURLParameter1] values[0]=[342]
key=[ActionTest] values[0]=[10]
mapName=parameterMap:
key=[actionURLParameter1] values[0]=[342]
key=[publicRenderParameter1] values[0]=[157]
key=[publicRenderParameter1] values[1]=[15]
key=[ActionTest] values[0]=[10]
Test 11:
// Remove public render parameter from ActionResponse -
try {actionResponse.removePublicRenderParameter("publicRenderParameter1"); }
catch(Exception e) {writer.write("removePublicRenderParameter() from ActionResponse failed.<br/>" + e.toString() + "<br/>");}
Messages from Action Phase:
mapName=publicParameterMap:
key=[publicRenderParameter1] values[0]=[15]
mapName=privateParameterMap:
key=[ActionTest] values[0]=[11]
mapName=parameterMap:
key=[publicRenderParameter1] values[0]=[15]
key=[ActionTest] values[0]=[11]
Action Phase:
(no exception)
Render Phase:
mapName=publicParameterMap:
mapName=privateParameterMap:
key=[ActionTest] values[0]=[11]
mapName=parameterMap:
key=[ActionTest] values[0]=[11]
Test 12:
(no parameters set) Action Phase: Render Phase:

 
 
Close
loading
Please Confirm
Close