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

James Chaplin commented on WW-5030:
-----------------------------------

Hi.  Before considering a separate plugin, adding a refactored set of portlet 
mocks to the struts2-junit-plugin was (briefly) attempted.

One drawback of that attempt was purely an increase in the size of the 
struts2-junit-plugin-xxx.jar (it essentially tripled in size).  Since most 
users of the junit-plugin won't need or use those portlet mocks, moving them 
into a separate plugin seemed to make sense to avoid "extra baggage" for the 
junit-plugin.

Placing the portlet mocks in a separate plugin should (in theory) help isolate 
changes in the future, keeping the vast majority of the portlet-related 
elements in the portlet-related plugins.  It also decouples the mocks so they 
could be used without tying them to a particular test framework.  The mocks 
package names were also refactored in the plugin to avoid potential classpath 
clashes with Spring 4.x (or older versions).

A separate portlet-mocks plugin will mean some documentation changes for Struts 
2.6.x, but at least they should be pretty straightforward (adding the 
struts2-portlet-mocks-plugin as a dependency for a build and search/replace the 
mock package names in projects).  It is unlikely that a backport of a 
portlet-mocks plugin to 2.5.x would be undertaken, but it would be a 
consideration for migration to Struts 2.6.x.

Regards,

James.

> ClassNotFoundException - MockPortletResponse
> --------------------------------------------
>
>                 Key: WW-5030
>                 URL: https://issues.apache.org/jira/browse/WW-5030
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet
>    Affects Versions: 2.5.18
>            Reporter: John Bush
>            Priority: Major
>             Fix For: 2.6
>
>         Attachments: TestStrutsPortlet.zip, fail.txt, success.txt
>
>
> WW-3826 solved a problem running JUnit tests on portlet actions that use the 
> struts2-portlet-plugin and struts2-junit-plugin. The solution used Spring's 
> org.springframework.mock.web.portlet package in the spring-test framework. 
> Spring Portlet MVC is no longer supported (SPR-14129) and the package has 
> been removed starting with Spring 5. I'm not able to upgrade to Spring 5 
> without loosing my unit testing since having both versions of spring-test in 
> my classpath creates many other issues.
> I've attached a zipped portlet project for testing (TestStrutsPortlet.zip), 
> console log from a successful test (success.txt) and console log from a 
> failed test (fail.txt). All that needs to change is the spring-version in the 
> POM to recreate the testing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to