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 , [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to