Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4977

Fixing flaky test in Jsr168DispatcherTest and Jsr286DispatcherTest

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.20, 2.6
    • Component/s: Plugin - Portlet
    • Labels:
      None

      Description

      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.

        

      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>  
      

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                OrDTesters OrDTesters
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: