[ 
https://issues.apache.org/jira/browse/WW-3447?focusedWorklogId=1046762&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1046762
 ]

ASF GitHub Bot logged work on WW-3447:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Oct/26 10:56
            Start Date: 10/Oct/26 10:56
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #2003:
URL: https://github.com/apache/struts/pull/2003

   Fixes [WW-3447](https://issues.apache.org/jira/browse/WW-3447)
   
   ## Summary
   
   The ticket (2010) says the convention plugin has no tests. That is no longer 
true: the plugin has 16 test classes. Some of the constants in 
`struts-plugin.xml` were still never set in any test, though, so only their 
default value was ever exercised. This PR adds an on/off test pair for the six 
that change how actions get mapped:
   
   | Constant | Default case | Flipped case |
   |---|---|---|
   | `struts.convention.action.alwaysMapExecute` | unannotated `execute()` next 
to an `@Action` method is not mapped | it is mapped too |
   | `struts.convention.action.checkImplementsAction` | an `Action` implementor 
without the suffix is mapped | it is ignored |
   | `struts.convention.action.mapAllMatches` | a suffixed class with no 
`execute()` is not mapped | it is mapped with a null method |
   | `struts.convention.action.disableScanning` | configured packages are 
scanned | nothing is mapped |
   | `struts.convention.package.locators.disable` | locator packages are 
scanned | locators are ignored |
   | `struts.convention.action.eagerLoading` | `ObjectFactory` does not load 
action classes | it loads each found class |
   
   The new tests sit in `PackageBasedActionConfigBuilderTest`, which already 
uses the JUnit 3 style, and use three fixture classes under 
`org.apache.struts2.convention.flags.*`.
   
   Three constants are left out on purpose: `classes.reload`, `includeJars` and 
`exclude.parentClassLoader`. They depend on classloaders and jar scanning, and 
a unit test wouldn't prove much about them.
   
   ## Verification
   
   - `./mvnw test -DskipAssembly -pl plugins/convention` passes.
   - To check the tests actually catch something, I forced each flag's check in 
`PackageBasedActionConfigBuilder` to `true` and then to `false` (12 runs). 
Every run failed the test written for that flag. The production code is 
unchanged in this PR.
   
   Test-only change; no production code touched.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)




Issue Time Tracking
-------------------

            Worklog Id:     (was: 1046762)
    Remaining Estimate: 50m  (was: 1h)
            Time Spent: 10m

> convention plugin has no testcases
> ----------------------------------
>
>                 Key: WW-3447
>                 URL: https://issues.apache.org/jira/browse/WW-3447
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Convention
>    Affects Versions: 2.1.8
>         Environment: All
>            Reporter: Martin Gainty
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.5.0
>
>   Original Estimate: 1h
>          Time Spent: 10m
>  Remaining Estimate: 50m
>
> There are currently no testcases for convention plugin there is no way to 
> verify if convention-plugin actually works ..we need pass/fail testcases for 
> all of constant parameters from struts-plugin.xml
>   <constant name="struts.convention.actionConfigBuilder" value="convention"/>
>   <constant name="struts.convention.actionNameBuilder" value="convention"/>
>   <constant name="struts.convention.resultMapBuilder" value="convention"/>
>   <constant name="struts.convention.interceptorMapBuilder" 
> value="convention"/>
>   <constant name="struts.convention.conventionsService" value="convention"/>
>   <constant name="struts.convention.result.path" value="/WEB-INF/content/"/>
>   <constant name="struts.convention.result.flatLayout" value="true"/>
>   <constant name="struts.convention.action.suffix" value="Action"/>
>   <constant name="struts.convention.action.disableScanning" value="false"/>
>   <constant name="struts.convention.action.mapAllMatches" value="false"/>
>   <constant name="struts.convention.action.checkImplementsAction" 
> value="true"/>
>   <constant name="struts.convention.default.parent.package" 
> value="convention-default"/>
>   <constant name="struts.convention.action.name.lowercase" value="true"/>
>   <constant name="struts.convention.action.name.separator" value="-"/>
>   <constant name="struts.convention.package.locators" 
> value="action,actions,struts,struts2"/>
>   <constant name="struts.convention.package.locators.disable" value="false"/>
>   <constant name="struts.convention.package.locators.basePackage" value=""/>
>   <constant name="struts.convention.exclude.packages" 
> value="org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"/>
>   <constant name="struts.convention.relative.result.types" 
> value="dispatcher,velocity,freemarker"/>
>   <constant name="struts.convention.redirect.to.slash" value="true"/>
>   <constant name="struts.convention.action.alwaysMapExecute" value="true"/>
>   <constant name="struts.mapper.alwaysSelectFullNamespace" value="true"/>
>   <!-- <constant name="struts.convention.action.includeJars"  /> -->
>   <constant name="struts.convention.action.fileProtocols" value="jar" />
>   <constant name="struts.convention.classes.reload" value="false" />
>   <constant name="struts.convention.exclude.parentClassLoader" value="true" />



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to