What's basically happening here is:

The application module you are passing to your PageTester (via the "String 
appName" argument) does not load your Spring context.  In the alternative 
Spring integration link you provided this string would be "Spring", assuming 
the class is named "SpringModule" and that it exists in your <app>.services 
package.

Hope that helps.

-----Original Message-----
From: Doublel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 25, 2007 8:06 PM
To: Tapestry users
Subject: Re: Using PageTester with tapestry-spring

My Application use spring2+tapestry5+hibernate3 ,it can work well in me IE or  
FF

so,I want to use Unit Test with testNG .I followed 
http://tapestry.apache.org/tapestry5/tapestry-core/guide/unit-testing-pages.html

configrate spring with
<http://wiki.apache.org/tapestry/Tapestry5SpringIntegration>
http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternative2
<http://wiki.apache.org/tapestry/Tapestry5SpringIntegration>

I want to test a tapestry page, but I got Exception .IPublicDAO is my spring 
class

in my tapestry page i use inject

@Inject
    @SpringBean("IPublicDAO")
    private IPublicDAO dao;



I didnot know wrong where I make. can anybody help me  thanks a lot.

Caused by: java.lang.RuntimeException: Error obtaining injected value for field 
cn.crc.pjblog.pages.BlogPostOne.pdao: No service implements the interface 
cn.crc.model.impl.IPublicDAO.
at org.apache.tapestry.internal.services.InjectWorker.inject (
InjectWorker.java:84)
at org.apache.tapestry.internal.services.InjectWorker.transform(
InjectWorker.java:53)
at
$ComponentClassTransformWorker_114ba61b606.transform($ComponentClassTransformWorker_114ba61b606.java)
at
$ComponentClassTransformWorker_114ba61b603.transform($ComponentClassTransformWorker_114ba61b603.java)
at
org.apache.tapestry.internal.services.ComponentClassTransformerImpl.transformComponentClass
(ComponentClassTransformerImpl.java :131) ... 48 more Caused by: 
java.lang.RuntimeException: No service implements the interface 
cn.crc.model.impl.IPublicDAO.
at org.apache.tapestry.ioc.internal.RegistryImpl.getService(
RegistryImpl.java:447)
at org.apache.tapestry.ioc.internal.ObjectLocatorImpl.getService(
ObjectLocatorImpl.java:45)
at org.apache.tapestry.ioc.services.TapestryIOCModule$2.provide(
TapestryIOCModule.java:132)
at $ObjectProvider_114ba61b5d4.provide($ObjectProvider_114ba61b5d4.java)
at $ObjectProvider_114ba61b5ce.provide($ObjectProvider_114ba61b5ce.java)
at org.apache.tapestry.internal.services.InjectWorker.inject(
InjectWorker.java:80)
... 52 more
... Removed 22 stack frames




2007/9/25, Joel Wiegman <[EMAIL PROTECTED]>:
>
> Sure... what questions do you have?
>
> I'd rather not write 8 paragraphs and still not answer your questions...
>
> -----Original Message-----
> From: Doublel [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 24, 2007 7:59 PM
> To: Tapestry users
> Subject: Re: Using PageTester with tapestry-spring
>
> I run into the same problem  I use
> http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternative2
> Can you explain more detail??
>
> 2007/9/24, Joel Wiegman <[EMAIL PROTECTED]>:
> >
> > Ivan,
> >
> > I'm using PageTester with Spring integration, but you'll have to 
> > jump through a few small hoops to accomplish this.
> >
> > I've written a "TestHarnessModule" in my <app dir>.services directory.
> > This module contributes the Spring services manually.  My code looks 
> > very similar to what's found here:
> >
> > http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternativ
> > e1
> >
> > Then, you can pass in the name of the module to your PageTester:
> >
> > PageTester pageTester= new PageTester("com.myapp.dir", 
> > "TestHarness");
> >
> > IMHO, what's really neat about this is you can point your tests to a 
> > different Spring configuration that uses mocked objects, mock 
> > databases, etc.  This is what we're doing and it has worked very well.
> >
> > Hope this helps,
> >
> > Joel
> >
> > -----Original Message-----
> > From: Ivan Dubrov [mailto:[EMAIL PROTECTED]
> > Sent: Monday, September 24, 2007 7:14 AM
> > To: Tapestry users
> > Subject: Using PageTester with tapestry-spring
> >
> > Hi,
> >
> > How can I use the PageTester with the Spring integration? The 
> > problem is that when PageTester creates the registry it does not 
> > adds SpringModuleDef to the list of modules and all my Spring 
> > services are unavailable because of this. Extending the PageTester 
> > is not possible as well, so I cannot extend it and provide 
> > additional module (like the TapestrySpringFilter does), so I have to 
> > copy-paste the complete PageTester and add a line to include 
> > SpringModuleDef module to the list.
> >
> > Are there any other ways that not include dumb copy-pasting?
> >
> > Just for clearness. How can I add an override to the services when 
> > running the tests? Creating AliasContribution's with the mode set to 
> > "test", right? But what to do if I want to keep my primary module 
> > clear of test services and keep all my test services in the test 
> > module inside the src/test Maven2 hierarchy (so they even aren't 
> > included in the release build)?
> >
> > --
> > WBR,
> > Ivan S. Dubrov
> >
> >
> >
> > --------------------------------------------------------------------
> > - 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]
>
>


--
得与失都是生活

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

Reply via email to