Hi,

This probably won't help much (as it's not much more than a "It works
on my machine" comment) but I'm using Testify with TestNG. Testify
extends the TestModule, adding some more nifty features. I make use of
multiple modules (both my own and supplied) and have never had to
specify or add any more configuration more than telling it what my own
Module class is. See here:

http://tapestry.formos.com/nightly/tapestry-testify/

and

http://tapestry.formos.com/nightly/tapestry-testify/testng.html

Steve.

P.S. By the way, if Paul's listening, I'm dying for Testify to be
updated to work with T5.2 - it's the only reason I'm still on 5.1! I
know T5.2 isn't near a release yet but it addresses many little
niggles.


On 12 May 2010 10:25, MauricioF <mauricio.fara...@ioko.com> wrote:
>
> Hi
>
> In my test module
>
> has some binder calls and some contributions methods
>
>        public static void bind(ServiceBinder binder) {
>                // Make bind() calls on the binder object to define most IoC 
> services.
>                // Use service builder methods (example below) when the 
> implementation
>                // is provided inline, or requires more initialization than 
> simply
>                // invoking the constructor.
>
>                binder.bind(ConfigAssetAliasManager.class,
> ConfigAssetAliasManagerImpl.class);
>                binder.bind(ConfigurationService.class,
> PropertyReaderConfigurationServiceImpl.class);
>
>        }
>
>   �...@marker(ConfigProvider.class)
>    public AssetFactory buildConfigAssetFactory(ResourceCache resourceCache,
>            ConfigAssetAliasManager aliasManager, ConfigurationService
> configuration) {
>        return new ConfigAssetFactory(resourceCache, aliasManager,
> configuration);
>    }
>
>        /** Add a new factory with the prefix "uri"
>         * @param configuration
>         * @param uriAssetFactory
>         */
>        public void contributeAssetSource(
>                        MappedConfiguration<String, AssetFactory> 
> configuration,
>                       �...@configprovider AssetFactory configAssetFactory) {
>                configuration.add(AssetConstants.CONFIG_PREFIX, 
> configAssetFactory);
>        }
>
>        /**
>         * The MasterDispatcher is a chain-of-command of individual 
> Dispatchers,
>         * each handling (like a servlet) a particular kind of incoming 
> request.
>         */
>        public void contributeMasterDispatcher(
>                        OrderedConfiguration<Dispatcher> configuration,
>                        ObjectLocator locator) {
>                configuration.add("Config",
> locator.autobuild(ConfigDispatcher.class),"before:Asset");
>        }
>
>
> The same methods are working fine in the main Application module and the
> asset factory works fine.
>
> However in my test case ( a simple pageTester render ) it´s complainining
> when contributing to the services
>
>
> java.lang.IllegalArgumentException: Contribution
> com.ioko.frontend.services.MyPagesTestModule.contributeAssetSource(MappedConfiguration,
> AssetFactory, AssetFactory) (at MyPagesTestModule.java:88) is for service
> 'AssetSource', which does not exist.
>        at
> org.apache.tapestry5.ioc.internal.RegistryImpl.validateContributeDefs(RegistryImpl.java:199)
>        at
> org.apache.tapestry5.ioc.internal.RegistryImpl.<init>(RegistryImpl.java:174)
>        at 
> org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:170)
>        at
> com.ioko.frontend.services.AbstractTestSuite.setup_registry(AbstractTestSuite.java:18)
>        at
> com.ioko.frontend.services.ConfigurationServiceTest.setup_registry(ConfigurationServiceTest.java:23)
>        at
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
>
> I read that I need to use some module dependancy so I added
>
> @SubModule (TapestryModule.class)
> public class MyPagesTestModule {
>
> Still is not working...
>
> Now I got
>
> ERROR RequestExceptionHandler - Processing of request failed with uncaught
> exception: Exception assembling root component of page URIAssetTestPage:
> Could not convert 'asset:uri:file:///C:/temp/selected-cell.png' into a
> component parameter binding: Unknown prefix for asset path
> 'uri:file:///C:/temp/selected-cell.png'.
> java.lang.RuntimeException: Exception assembling root component of page
> URIAssetTestPage: Could not convert
> 'asset:uri:file:///C:/temp/selected-cell.png' into a component parameter
> binding: Unknown prefix for asset path
> 'uri:file:///C:/temp/selected-cell.png'.
>        at
> org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl.assembleRootComponent(ComponentAssemblerImpl.java:110)
>        at
> org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:159)
>        at $PageLoader_1288ce49865.loadPage($PageLoader_1288ce49865.java)
>        at
> org.apache.tapestry5.internal.services.PagePoolCache.checkout(PagePoolCache.java:210)
>        at
> org.apache.tapestry5.internal.services.PagePoolImpl.checkout(PagePoolImpl.java:99)
>        at $PagePool_1288ce49864.checkout($PagePool_1288ce49864.java)
>        at
> org.apache.tapestry5.internal.services.RequestPageCacheImpl.get(RequestPageCacheImpl.java:51)
>
> A bit more digging shows that the contribute* methods are not invoked in
> testing (I added breakpoints and they nerver are invoked..), which explains
> everything
>
> My understanding was that ALL contribution methods are invoked, but it seems
> that in my MyPagesTestModule this is not true
> Do I need to add some additional dependency aside of TapestryModule     ? 
> (only
> the service binders are invoked).
> Is there something else I´ve missed?
>
> PS: Everything works fine when I launch the application with mvn jetty:run,
> I can see the components rendered correctly
>
> Thanks!
>
> --
> View this message in context: 
> http://tapestry-users.832.n2.nabble.com/Module-contributionMethods-not-invoked-from-testNG-tp5041340p5041340.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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