Right, sorry for the typo. I do have both:

src/main/java/base/MyApplication.java
src/main/java/base/MyApplication.properties

The application works as intended: When I start MyApplication, I can access all constants in MyApplication.properties from various pages and components throughout the application. So far so good.

However, when I try to access the same pages from my tests, I get errors similar to:

wicket.WicketRuntimeException: Error attaching this container for rendering: [MarkupContainer [Component id = basket_item, page = base.BasketPage, path = 0:basket:basket_form:basket_item.BasketPanel $BasketEditForm$1, isVisible = true, isVersioned = false]]
        at wicket.MarkupContainer.internalAttach(MarkupContainer.java:361)

[......]

Caused by: java.util.MissingResourceException: Unable to find resource: MODEL_RELEASED for component:

MODEL_RESOURCE is a string constant defined in MyApplication.properties, and it works fine when I run the app in the normal way.

The tests are run a subclass of WicketTester, in src/test/java/base with the initialization method:

public void initialize() {
getResourceSettings().addStringResourceLoader(new ClassStringResourceLoader(this, MyApplication.class));
}

That is what I've tried, in order to load the MyApplication.properties for my subclass of WicketTester. It just doesn't work.

So my question is: How can I load the MyApplication.properties file, so the constants in it are accessible in my tests? I'm using wicket 1.2.6.

Thanks in advance.


/Erik


On 20/08/2007, at 22.55, Igor Vaynberg wrote:

it should probably be MyApplication.properties unless you have
myApplication.java....

-igor


On 8/20/07, Erik Underbjerg <[EMAIL PROTECTED]> wrote:

Hello,

I have just moved some localized string resources to a
myApplication.properties file, because they need to accessed by
different panels and pages, and it works fine.

However, when running my unit tests with WicketTester, it can't find
the resources in myApplication.properties. I have been unsuccessful
in finding a way to add the myApplication.properties file to the
resource path of my WicketTester subclass. This is what I've tried,
in my subclass of WicketTester:

        public void initialize() {
                getResourceSettings().addStringResourceLoader(new
ClassStringResourceLoader(this, PolFotoApplication.class));
        }

So: How do I add myApplication.properties to the resource path of my
WicketTester?

Kind regards,

Erik


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

Reply via email to