I'm trying to test my application with spock and have run into an issue.  I 
have put a sample app on github at:

https://github.com/hhubris/broken

If you clone the app, and run mvn clean test, everything works just fine.

In AppModule:24-28 I have the following commented out:

    /*
    public static void 
contributeHibernateEntityPackageManager(Configuration<String> configuration) {
        configuration.add("com.starpoint.helpdesk.domain");
    }
    */


This simply adds a configuration option to the hibernate module.  Uncomment 
this and rerun the test.  The result is:

[-- snip --]
Results :

Tests in error: 
  com.starpoint.domain.UserTest: Contribution 
com.starpoint.services.AppModule.contributeHibernateEntityPackageManager(Configuration)
 (at AppModule.java:25) is for service 'HibernateEntityPackageManager', which 
does not exist.

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[-- snip --]

To fix this, I added HibernateCoreModule to the list of SubModules used in the 
spock test. You can uncomment line 11 of UserTest and comment out line 12.  The 
new result is:

[-- snip --]
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.385 sec <<< 
FAILURE!

Results :

Tests in error: 
  com.starpoint.domain.UserTest: Exception constructing service 
'RegistryStartup': Error invoking service contribution method 
org.apache.tapestry5.hibernate.HibernateCoreModule.contributeRegistryStartup(OrderedConfiguration,
 boolean, HibernateSessionSource): Exception constructing service 
'FactoryDefaults': Error invoking service contribution method 
org.apache.tapestry5.services.TapestryModule.contributeFactoryDefaults(MappedConfiguration):
 Exception constructing service 'TypeCoercer': Error invoking service 
contribution method 
org.apache.tapestry5.services.TapestryModule.contributeTypeCoercer(Configuration,
 TypeCoercer, ThreadLocale, AssetSource, ComponentClassCache, 
DynamicTemplateParser): Error building service proxy for service 'ThreadLocale' 
(at org.apache.tapestry5.ioc.internal.services.ThreadLocaleImpl() (at 
ThreadLocaleImpl.java:24) via 
org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at 
TapestryIOCModule.java:49)): Exception constructing service 
'ServiceLifecycleSource': Error invoking service contribution method 
org.spockframework.tapestry.ExtensionModule.contributeServiceLifecycleSource(MappedConfiguration):
 Exception constructing service 'ServiceOverride': Error invoking service 
contribution method 
org.apache.tapestry5.services.TapestryModule.productionModeOverrides(MappedConfiguration,
 boolean): Exception constructing service 'TypeCoercer': Construction of 
service 'TypeCoercer' has failed due to recursion: the service depends on 
itself in some way. Please check 
org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl(Collection) (at 
TypeCoercerImpl.java:129) via 
org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at 
TapestryIOCModule.java:49) for references to another service that is itself 
dependent on service 'TypeCoercer'.

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[-- snip --]

I'm not sure what to try next.

I asked on the spock list and they suggested I ask here.  Anyone have any 
success testing tapestry-hibernate apps with spock?

Thanks in advance
Tony Nelson




Reply via email to