struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From UV <uvw...@googlemail.com>
Subject Re: Problem with configured action method names and Testing Framework ===> StrutsTestCase cannot handle actions not calling execute()
Date Fri, 17 Jun 2011 01:07:28 GMT
Hi,

the setup is unit testing with maven + spring + struts using 
StrutsSpringTestCase super class
(which is an extended org.apache.struts2.StrutsTestCase with access to 
spring config).

So this is working well with actions not having the methodname configured.

Whenever I do configure such a method the code in 
AnnotationValidationInterceptor(struts-core-2.2.3) fails in line 83++
after failing to instantiate the method which is NOT named "execute" 
this time from the proxy.

Environment:
1. struts action configured using a method name.
2. action test based on a StrutsTestCase (using those mock objects)
3. set a breakpoint on line 83 in the annotationvalidationinterceptor.

However, the same code exists in DefaultActionInvocation line 437 and is 
used to instantiate the method for executing the action, so disabling 
the validation simply postpones the very same issue to a later point in 
the code
as you can see in the stacktrace below!

It seems that the StrustTestcase cannot handle actions with a method 
name configured!


Thread [main] (Suspended)
     DefaultActionInvocation.invokeAction(Object, ActionConfig) line: 433
     DefaultActionInvocation.invokeActionOnly() line: 291
     DefaultActionInvocation.invoke() line: 254
     DefaultWorkflowInterceptor.doIntercept(ActionInvocation) line: 176
     
DefaultWorkflowInterceptor(MethodFilterInterceptor).intercept(ActionInvocation) 
line: 98
     DefaultActionInvocation.invoke() line: 248
     
StrutsConversionErrorInterceptor(ConversionErrorInterceptor).intercept(ActionInvocation) 
line: 133
     DefaultActionInvocation.invoke() line: 248
     ParametersInterceptor.doIntercept(ActionInvocation) line: 207
     
ParametersInterceptor(MethodFilterInterceptor).intercept(ActionInvocation) 
line: 98
     DefaultActionInvocation.invoke() line: 248
     
ActionMappingParametersInteceptor(ParametersInterceptor).doIntercept(ActionInvocation) 
line: 207
     
ActionMappingParametersInteceptor(MethodFilterInterceptor).intercept(ActionInvocation) 
line: 98
     DefaultActionInvocation.invoke() line: 248
     StaticParametersInterceptor.intercept(ActionInvocation) line: 190
     DefaultActionInvocation.invoke() line: 248
     MultiselectInterceptor.intercept(ActionInvocation) line: 75
     DefaultActionInvocation.invoke() line: 248
     CheckboxInterceptor.intercept(ActionInvocation) line: 94
     DefaultActionInvocation.invoke() line: 248
     ModelDrivenInterceptor.intercept(ActionInvocation) line: 100
     DefaultActionInvocation.invoke() line: 248
     ScopedModelDrivenInterceptor.intercept(ActionInvocation) line: 141
     DefaultActionInvocation.invoke() line: 248
     DebuggingInterceptor.intercept(ActionInvocation) line: 270
     DefaultActionInvocation.invoke() line: 248
     ChainingInterceptor.intercept(ActionInvocation) line: 145
     DefaultActionInvocation.invoke() line: 248
     PrepareInterceptor.doIntercept(ActionInvocation) line: 171
     
PrepareInterceptor(MethodFilterInterceptor).intercept(ActionInvocation) 
line: 98
     DefaultActionInvocation.invoke() line: 248
     I18nInterceptor.intercept(ActionInvocation) line: 176
     DefaultActionInvocation.invoke() line: 248
     ServletConfigInterceptor.intercept(ActionInvocation) line: 164
     DefaultActionInvocation.invoke() line: 248
     AliasInterceptor.intercept(ActionInvocation) line: 190
     DefaultActionInvocation.invoke() line: 248
     ExceptionMappingInterceptor.intercept(ActionInvocation) line: 187
     DefaultActionInvocation.invoke() line: 248
     StrutsActionProxy.execute() line: 52
     ContentActionTest.doContentDelete() line: 158
     ContentActionTest.testContentLifeCycle() line: 179
     NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: 
not available [native method]
     NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
     DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
     Method.invoke(Object, Object...) line: 597
     FrameworkMethod$1.runReflectiveCall() line: 44
     FrameworkMethod$1(ReflectiveCallable).run() line: 15
     FrameworkMethod.invokeExplosively(Object, Object...) line: 41
     InvokeMethod.evaluate() line: 20
     RunBefores.evaluate() line: 28
     RunBeforeTestMethodCallbacks.evaluate() line: 74
     RunAfterTestMethodCallbacks.evaluate() line: 82
     SpringRepeat.evaluate() line: 72
     SpringJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier) 
line: 240
     SpringJUnit4ClassRunner(BlockJUnit4ClassRunner).runChild(Object, 
RunNotifier) line: 50
     ParentRunner$3.run() line: 193
     ParentRunner$1.schedule(Runnable) line: 52
     SpringJUnit4ClassRunner(ParentRunner<T>).runChildren(RunNotifier) 
line: 191
     ParentRunner<T>.access$000(ParentRunner, RunNotifier) line: 42
     ParentRunner$2.evaluate() line: 184
     RunBeforeTestClassCallbacks.evaluate() line: 61
     RunAfterTestClassCallbacks.evaluate() line: 70
     SpringJUnit4ClassRunner(ParentRunner<T>).run(RunNotifier) line: 236
     SpringJUnit4ClassRunner.run(RunNotifier) line: 180
     JUnit4TestSet.execute(Class, RunNotifier, String) line: 53
     JUnit4Provider.executeTestSet(Class, RunListener, ClassLoader, 
RunNotifier) line: 119
     JUnit4Provider.invoke(Object) line: 101
     NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: 
not available [native method]
     NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
     DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
     Method.invoke(Object, Object...) line: 597
     ProviderFactory$ClassLoaderProxy.invoke(Object, Method, Object[]) 
line: 103
     $Proxy0.invoke(Object) line: not available
     SurefireStarter.invokeProvider(Object, ClassLoader, ClassLoader) 
line: 150
     SurefireStarter.runSuitesInProcess() line: 91
     ForkedBooter.main(String[]) line: 69

On 17/06/2011 02:17, Maurizio Cucchiara wrote:
> Hi,
> could you send the stacktrace exception/error?
> What are you using to execute your test (f.i. maven, eclipse, etc)?
>
> Maurizio Cucchiara
>
> Il giorno 17/giu/2011 02.09, "UV"<uvwild@googlemail.com>  ha scritto:
>> Hi,
>>
>> When I try to test an action with a method="actionMethod" attribute
>> configured in a StrutsTestCase
>> the AnnotationValidationInterceptor fails in getActionMethod#75 cause it
>> cannot find the method
>> using the configured name on the proxy used in the testing framework.
>>
>> My only workaround so far was using execute() method on actions only and
>> split all actions up into separate files.
>>
>> Is this a known bug?
>>
>> Is there a better workaround?
>>
>> Thanks for any pointers.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message