OrDTesters created WW-4977:
------------------------------
Summary: Fixing flaky test in Jsr168DispatcherTest and
Jsr286DispatcherTest
Key: WW-4977
URL: https://issues.apache.org/jira/browse/WW-4977
Project: Struts 2
Issue Type: Bug
Components: Plugin - Portlet
Reporter: OrDTesters
testRender_ok and testProcessAction_ok in Jsr168DispatcherTest have test-order
dependencies and fail when they are run after
testModeChangeUsingPortletWidgets. Similarly, testRender_ok and
testProcessAction_ok in Jsr286DispatcherTest also have this problem.
These tests can be fixed by adding the entry
\{STRUTS_ALWAYS_SELECT_FULL_NAMESPACE=“true”} to initParams in
testModeChangeUsingPortletWidgets, as shown in the following pull request. The
fix will enable the tests in these classes to now pass in any order.
(*to be replaced with a link to pull request when a pull request is made*)
Without the fix, the tests will get an error. More specifically, the error from
Jsr168DispatcherTest.testProcessAction_ok is shown below. Let me know if you
want to discuss more.
{code:java}
org.jmock.core.DynamicMockError: mockActionProxyFactory: unexpected invocation
Invoked: mockActionProxyFactory.createActionProxy("", "testAction", null,
<{com.opensymphony.xwork2.dispatcher.HttpServletRequest=org.apache.struts2.dispatcher.StrutsRequestWrapper@6063f37,
application={viewNamespace=/view,
struts.mapper.alwaysSelectFullNamespace=true},
com.opensymphony.xwork2.ActionContext.locale=en_US,
com.opensymphony.xwork2.dispatcher.HttpServletResponse=org.apache.struts2.portlet.servlet.PortletServletResponse@42036f8,
struts.portlet.modeActionMap={help=ActionMapping{name='default', namespace='',
method='null', extension='null', params={}, result=null},
preview=ActionMapping{name='default', namespace='', method='null',
extension='null', params={}, result=null}, edit=ActionMapping{name='default',
namespace='', method='null', extension='null', params={}, result=null},
about=ActionMapping{name='default', namespace='', method='null',
extension='null', params={}, result=null},
edit_defaults=ActionMapping{name='default', namespace='', method='null',
extension='null', params={}, result=null}, config=ActionMapping{name='default',
namespace='', method='null', extension='null', params={}, result=null},
view=ActionMapping{name='default', namespace='/view', method='null',
extension='null', params={}, result=null}, print=ActionMapping{name='default',
namespace='', method='null', extension='null', params={}, result=null}},
struts.portlet.portletNamespace=, struts.portlet.modeNamespaceMap={help=,
preview=, edit=, about=, edit_defaults=, config=, view=/view, print=},
com.opensymphony.xwork2.ActionContext.application={viewNamespace=/view,
struts.mapper.alwaysSelectFullNamespace=true}, attr=AttributeMap {request={},
session={}, application={viewNamespace=/view,
struts.mapper.alwaysSelectFullNamespace=true}}, struts.portlet.request=null,
com.opensymphony.xwork2.dispatcher.ServletContext=org.apache.struts2.portlet.servlet.PortletServletContext@5ef8d5e5,
struts.portlet.defaultActionForMode=ActionMapping{name='default',
namespace='/view', method='null', extension='null', params={}, result=null},
struts.portlet.phase=ACTION_PHASE,
com.opensymphony.xwork2.ActionContext.session={}, struts.portlet.context=null,
session={}, request={}, struts.portlet.config=null,
struts.actionMapping=ActionMapping{name='testAction', namespace='',
method='null', extension='action', params={}, result=null},
parameters={struts.portlet.mode=[Ljava.lang.String;@22a2de19,
struts.portlet.action=[Ljava.lang.String;@72a34d12},
com.opensymphony.xwork2.ActionContext.parameters={struts.portlet.mode=view,
struts.portlet.action=/view/testAction},
struts.portlet.response=mockActionResponse}>)
Allowed:
expected once: createActionProxy( eq("/view"), eq("testAction"), null, an
instance of java.util.Map ), returns <mockActionProxy>
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)