[
https://issues.apache.org/jira/browse/WW-3353?focusedWorklogId=1041899&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1041899
]
ASF GitHub Bot logged work on WW-3353:
--------------------------------------
Author: ASF GitHub Bot
Created on: 16/Sep/26 07:23
Start Date: 16/Sep/26 07:23
Worklog Time Spent: 10m
Work Description: lukaszlenart opened a new pull request, #1956:
URL: https://github.com/apache/struts/pull/1956
Fixes [WW-3353](https://issues.apache.org/jira/browse/WW-3353)
`StrutsRestTestCase` (added by WW-4549 as the answer to this ticket) has
never had a test and could not actually run a REST action to completion. Two
defects, each watched failing before the fix:
1. **`initServletMockObjects()` order** — the `MockServletContext` was built
*before* `ConventionPluginResourceLoader` was assigned, so the loader was a
dead assignment and Convention could not resolve results under
`/WEB-INF/content`: `No result defined for action
org.demo.rest.example.OrdersController and result show`. Creating the loader
first fixes it.
2. **Missing `spring-web`** — `spring-test`'s `MockHttpServletResponse`
needs `org.springframework.http.MediaType`, and the plugin only reached
`spring-web` through its *optional* `struts2-spring-plugin` dependency. A
project following the docs (Spring plugin only for Spring-managed actions) got
`NoClassDefFoundError` on the first test. Declared directly; the version is
BOM-managed and already resolved transitively elsewhere.
Adds `OrdersControllerRestTestCaseTest` in `apps/rest-showcase` — the first
coverage of `StrutsRestTestCase` — executing `GET /orders/3` through the proxy
(id bound from the path, Convention result resolved) and rendering
`/orders/3.json`. The showcase POM gets the junit plugin at `test` scope and
the servlet/JSP APIs at `provided` scope, as `apps/showcase` already declares.
On the ticket's original symptom ("`/orders/3` doesn't call `setId`"): the
attached test called `action.show()` directly without `proxy.execute()`, so no
interceptor ran; with `execute()` the id binds even on the plain test case. The
title claim was still true, for the two reasons above.
Verified: `mvn test -pl apps/rest-showcase
-Dtest=OrdersControllerRestTestCaseTest` (2/2) and the junit plugin's own suite
(12/12).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Issue Time Tracking
-------------------
Worklog Id: (was: 1041899)
Remaining Estimate: 0h
Time Spent: 10m
> StrutsTestCase doesn't work with rest-plugin
> --------------------------------------------
>
> Key: WW-3353
> URL: https://issues.apache.org/jira/browse/WW-3353
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - REST
> Affects Versions: 2.1.8
> Reporter: Bill Stilwell
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 7.4.0
>
> Attachments: GetOrdersStrutsTest.java, pom.xml
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> StrutsTestCase doesn't seem to work with rest-plugin. I can create action
> mapping/action proxies, but they don't work - for e.g., a request for
> /orders/3 against the rest-showcase controller doesn't call setId.
> I will attach a sample unit test that demonstrates the issue.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)