You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Thomas Wintergerst (JIRA)" <ji...@apache.org> on 2011/02/08 12:53:57 UTC

[jira] Commented: (TAP5-1191) How to use PageTester with web apps using tapestry-spring and Spring 3.0

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

Thomas Wintergerst commented on TAP5-1191:
------------------------------------------

As I already mentioned, using SpringModule did not work for me. Unfortunately I cannot remember the exact reason anymore. But I made an attempt to change my code to use SpringModule. The result was, that the spring context was not built. My application uses TapestrySpringFilter within "web.xml" to create the spring context from "src/main/webapp/WEB-INF/applicationContext.xml" file. The PageTest together with SpringModul seams not to take notice of the "web.xml" content. But that would be o.k., as I need a special spring context for page tests. Unfortunately I cannot not find a way to specify a "xxx-context.xml" file for the spring context to create when using SpringModule .

My solution (or better workaround) was to clone SpringModuleDef and use the code paths for operating an external spring context. The XXXSpringModuleDef class adds all spring beans from the spring context as tapestry services. XXXSpringModuleDef is added using provideExtraModuleDefs() within a class derived from PageTester.

If there is a better way, it should be documented.


> How to use PageTester with web apps using tapestry-spring and Spring 3.0
> ------------------------------------------------------------------------
>
>                 Key: TAP5-1191
>                 URL: https://issues.apache.org/jira/browse/TAP5-1191
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-test
>    Affects Versions: 5.2.0
>            Reporter: Thomas Wintergerst
>            Priority: Minor
>
> We am using Tapestry for a provisioning portal. The web portal is only a part of the complete application. The application uses Spring 3.0. As the web portal must use some of the core libraries we must use Tapestry v5.2.0-SNAPSHOT (hoping for a release soon), as only tapestry-spring-5.2.0-SNAPSHOT is compatible with Spring 3.0.
> I would like to use the PageTester to perform some tests relating to pages of the web portal. But unfortunately it seems not to be possible to instanciate pages that require injected Spring beans (in fact all pages in our web portal are based on Spring beans).
> The PageTester provides the method provideExtraModuleDefs() that perhaps could be used in a derived class to add an instance of SpringModuleDef (that is flagged "internal", of course). But the SpringModuleDef class requires a ServletContext as a constructor parameter. Within the context of the PageTester I have no access to such an object.
> Also adding SpringModule.class as the 4th parameter of the PageTester constructor does not work.
> Am I missing some point here? Or is it currently really not possible to use PageTester for page classes requiring injected Spring beans?

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira