You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ch...@skipoles.co.uk on 2007/03/21 10:17:34 UTC

T5: PageTester and Spring Integration

I'm using the PageTester class to run some unit tests against my Tapestry pages - it's a fantastic little tool!

The problem comes when I hit a page that injects Spring Framework objects into my page (e.g. @Inject ("spring:someService")). This obviously blows up because there is no Spring WebApplicationContext defined. I have dummy implementations of my services defined in Spring, I just need to get access to them. 

So, my question... is there a way that I can get spring integration working within  PageTester? If not, then some thoughts...

1) Provide a way to configure PageTester to allow manually adding a Spring WebApplicationContext to the context so that the spring integration module works as is.

2) Provide a way for configure the spring integration module to allow testing to define an alternative bean factory to the WebApplicationContext.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: PageTester and Spring Integration

Posted by Robert Zeigler <ro...@scazdl.org>.
I haven't played with the spring integration, but...
PageTester has a constructor:
PageTester(String, String, String, Map<String,Object>), where the  
last argument is for service overrides.  The tapestry-spring module  
defines a service called "SpringObjectProvider" (which relies on the  
WebApplicationContext and implements ObjectProvider"). You ought to  
be able to contribute an override for that.  Something along the  
lines of:


Map<String,Object> overrides = new HashMap<String,Object>();
overrides.put("SpringObjectProvider",new MyDummySpringObjectProvider 
()/*or you could use an EasyMock mock object...*/);
PageTester tester = new PageTester("org.myorg.myapp","App","src/main/ 
webapp",overrides);

In fact, you can do this with your own services, as well. Once you  
define the builder for your service in your app module, you can  
proceed to contribute a mock version of the service in exactly this way.

Robert

On Mar 21, 2007, at 3/214:17 AM , chris@skipoles.co.uk wrote:

> I'm using the PageTester class to run some unit tests against my  
> Tapestry pages - it's a fantastic little tool!
>
> The problem comes when I hit a page that injects Spring Framework  
> objects into my page (e.g. @Inject ("spring:someService")). This  
> obviously blows up because there is no Spring WebApplicationContext  
> defined. I have dummy implementations of my services defined in  
> Spring, I just need to get access to them.
>
> So, my question... is there a way that I can get spring integration  
> working within  PageTester? If not, then some thoughts...
>
> 1) Provide a way to configure PageTester to allow manually adding a  
> Spring WebApplicationContext to the context so that the spring  
> integration module works as is.
>
> 2) Provide a way for configure the spring integration module to  
> allow testing to define an alternative bean factory to the  
> WebApplicationContext.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: PageTester and Spring Integration

Posted by Kent Tong <ke...@cpttm.org.mo>.
 <chris <at> skipoles.co.uk> writes:

> So, my question... is there a way that I can get spring integration working 
> within  PageTester? If not, then some thoughts...

You may want to create a feature request at
https://issues.apache.org/jira/browse/TAPESTRY and upload a test
case. There is no guarantee that it will be implemented though.

--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org