struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4977) Fixing flaky test in Jsr168DispatcherTest and Jsr286DispatcherTest
Date Sun, 18 Nov 2018 11:49:00 GMT

    [ https://issues.apache.org/jira/browse/WW-4977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16690874#comment-16690874
] 

ASF GitHub Bot commented on WW-4977:
------------------------------------

yasserzamani closed pull request #263: [WW-4977] Fixing flaky test in Jsr168DispatcherTest
and Jsr286DispatcherTest.
URL: https://github.com/apache/struts/pull/263
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java
b/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java
index ef0c5c023..be2ea3518 100644
--- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java
+++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java
@@ -261,6 +261,7 @@ public void testModeChangeUsingPortletWidgets() {
         Map<String, String> initParams = new HashMap<String, String>();
         initParams.put("viewNamespace", "/view");
         initParams.put("editNamespace", "/edit");
+        initParams.put(StrutsConstants.STRUTS_ALWAYS_SELECT_FULL_NAMESPACE, "true");
 
         initPortletConfig(initParams, new HashMap<String, Object>());
         initRequest(requestParams, new HashMap<String, Object>(), sessionMap, mode,
WindowState.NORMAL, false, null);
diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr286DispatcherTest.java
b/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr286DispatcherTest.java
index 6d8ff4b90..c5f4346fa 100644
--- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr286DispatcherTest.java
+++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr286DispatcherTest.java
@@ -142,6 +142,7 @@ public void testModeChangeUsingPortletWidgets() {
 		Map<String, String> initParams = new HashMap<String, String>();
 		initParams.put("viewNamespace", "/view");
 		initParams.put("editNamespace", "/edit");
+		initParams.put(StrutsConstants.STRUTS_ALWAYS_SELECT_FULL_NAMESPACE, "true");
 
 		initPortletConfig(initParams, new HashMap<String, Object>());
 		initRequest(requestParams, new HashMap<String, Object>(), sessionMap,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> 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
>            Priority: Minor
>             Fix For: 2.6
>
>
> 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)

Mime
View raw message