You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mats Henricson <ma...@henricson.se> on 2009/09/10 15:59:32 UTC

Testify and asset/context?

Hi!

How should we make Testify aware of asset and context?
For example, we have this in our TML:


   ${context:/foo/bar/}


Currently testify barfs at us like this:


Caused by: java.lang.RuntimeException: Unable to locate asset
'context:foo/bar' (the file does not exist).
	at
org.apache.tapestry5.internal.services.AssetSourceImpl.getLocalizedAssetFromResource(AssetSourceImpl.java:128)
	at
org.apache.tapestry5.internal.services.AssetSourceImpl.getAssetInLocale(AssetSourceImpl.java:93)
	at
org.apache.tapestry5.internal.services.AssetSourceImpl.getAsset(AssetSourceImpl.java:83)
	at
org.apache.tapestry5.internal.services.AssetSourceImpl.getContextAsset(AssetSourceImpl.java:78)
	at $AssetSource_123a4398766.getContextAsset($AssetSource_123a4398766.java)


It seems that testify doesn't set up the AssetSource, correct?
Is there a "proper" way to mock/decorate the AssetSource?

Mats

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


Re: Testify and asset/context?

Posted by Mats Henricson <ma...@henricson.se>.
Paul Field wrote:
> Mats Henricson <ma...@henricson.se> wrote on 10/09/2009 14:59:32:
>> How should we make Testify aware of asset and context?
>> For example, we have this in our TML:
>>    ${context:/foo/bar/}
>> Currently testify barfs at us like this:
>>
>> Caused by: java.lang.RuntimeException: Unable to locate asset
>> 'context:foo/bar' (the file does not exist).
> 
> The TapestryTester has two constructors:
>     public TapestryTester(String appPackage, String appName, String 
> contextPath, Class<?>... moduleClasses)
>     public TapestryTester(String appPackage, Class<?>... moduleClasses)
> 
> In the first one you can define the path to the context; the second one 
> defaults to "src/main/webapp".
> 
> I believe this is with respect to the working directory that the test 
> process runs with.
> 
> So, if you have an error about the file not existing, I would check that 
> you are using the appropriate constructor (depending on whether the 
> default works for you) and whether you are running with the working 
> directory set to your project directory.

Not much success, unfortunately. This is what I do:

    public static final String APP_PACKAGE = "dummy";
    private static final String APP_NAME = "betting";
    private static final String CONTEXT_PATH = "src/main/webapp/";

    protected static final TapestryTester SHARED_TESTER =
       new TapestryTester(APP_PACKAGE, APP_NAME,
                          PageTester.DEFAULT_CONTEXT_PATH,
                          PageTestModule.class);

I still get:

   Unable to locate asset 'context:foo/bar' (the file does not exist).

Mats

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


Re: Testify and asset/context?

Posted by Paul Field <pa...@db.com>.
Mats Henricson <ma...@henricson.se> wrote on 10/09/2009 14:59:32:
> How should we make Testify aware of asset and context?
> For example, we have this in our TML:
>    ${context:/foo/bar/}
> Currently testify barfs at us like this:
> 
> Caused by: java.lang.RuntimeException: Unable to locate asset
> 'context:foo/bar' (the file does not exist).

The TapestryTester has two constructors:
    public TapestryTester(String appPackage, String appName, String 
contextPath, Class<?>... moduleClasses)
    public TapestryTester(String appPackage, Class<?>... moduleClasses)

In the first one you can define the path to the context; the second one 
defaults to "src/main/webapp".

I believe this is with respect to the working directory that the test 
process runs with.

So, if you have an error about the file not existing, I would check that 
you are using the appropriate constructor (depending on whether the 
default works for you) and whether you are running with the working 
directory set to your project directory.

- Paul





---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.