The problem here is that you need services that are only defined
by TapestryModule (tapestry-core) therefore you always have a 
dependency to the web framework. 

One way to deal with this is to create a MockModule that contains
all services that usually reside within TapestryModule (tapestry-core)
and just return an EasyMock.createNiceMock(...) instance

eg.
MockModule {
        public static buildPersistentFieldManager() {
                return 
EasyMock.createNiceMock(PersistentFieldManage.class);
        }
}

@SubModule(MockModule.class)
MyTestModule {
}

g,
kris




Graham Ford <graham.f...@intersoftsolutions.co.uk> 
08.08.2009 11:40
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
Tapestry users <users@tapestry.apache.org>
Kopie

Thema
Re: IOC Problem







Thanks for the reply, but it seems I pasted in the wrong error message. 
I ran it with the AppModule commented out. When I put my AppModule back 
in, I get the following error, which is the one I get consistently now:

java.lang.IllegalArgumentException: Contribution 
org.apache.tapestry5.hibernate.HibernateModule.contributePersistentFieldManager(MappedConfiguration)
 

(at HibernateModule.java:116) is for service 'PersistentFieldManager', 
which does not exist.

It seems to be a problem loading the HibernateModule but the logging 
shows it is being added to the registry.

Sorry for the confusion!
Graham

Juan E. Maya wrote:
> It seems that ur application uses Tapestry-SpringSecurity but that
> module is not being loaded. Try to loaded manually when u start the
> registry.
>
> On Sat, Aug 8, 2009 at 12:49 AM, Graham
> Ford<graham.f...@intersoftsolutions.co.uk> wrote:
> 
>> Hi all,
>>
>> I am having a weird problem with creating a registry. I am trying to 
test my
>> DAOs, and as part of the test I do:
>>
>> IOCUtilities.buildDefaultRegistry()
>>
>> when I run the test it print out:
>>
>> [INFO] ioc.RegistryBuilder Adding module definition for class
>> org.apache.tapestry5.ioc.services.TapestryIOCModule
>> [INFO] ioc.RegistryBuilder Adding module definition for class
>> org.apache.tapestry5.hibernate.HibernateModule
>> [INFO] ioc.RegistryBuilder Adding module definition for class
>> org.apache.tapestry5.hibernate.HibernateCoreModule
>> [INFO] ioc.RegistryBuilder Adding module definition for class
>> nu.localhost.tapestry5.springsecurity.services.SecurityModule
>>
>> which indicates to me it is loading all the modules I have at the 
moment but
>> the test then fails saying:
>>
>> Contribution
>> 
nu.localhost.tapestry5.springsecurity.services.SecurityModule.contributeAlias(SaltSourceService,
>> AuthenticationProcessingFilter, Configuration) (at 
SecurityModule.java:110)
>> is for service 'Alias', which does not exist.
>>
>> what is going on that is stopping the registry starting up?
>>
>> Thanks,
>> Graham
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>> 
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
> 


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


Reply via email to