private ApplicationResource urlWildcard;
private ApplicationResource url21;
private ApplicationResource url513;
private ApplicationResource setupUrl(String filename, Locale... locales) throws IOException {
ApplicationResource url = new URLApplicationResource("org/apache/tiles/config/" + filename + ".xml", this
.getClass().getClassLoader().getResource("org/apache/tiles/config/" + filename + ".xml"));
assertNotNull("Could not load " + filename + " file.", url);
expect(applicationContext.getResource(url.getLocalePath())).andReturn(url).anyTimes();
expect(applicationContext.getResource(url, Locale.ROOT)).andReturn(url).anyTimes();
Map<Locale, ApplicationResource> localeResources = new HashMap<Locale, ApplicationResource>();
for (Locale locale : locales) {
ApplicationResource urlLocale = new URLApplicationResource("org/apache/tiles/config/" + filename + "_"
+ locale.toString() + ".xml", this.getClass().getClassLoader()
.getResource("org/apache/tiles/config/" + filename + "_" + locale.toString() + ".xml"));
assertNotNull("Could not load " + filename + "_" + locale.toString() + " file.", urlLocale);
localeResources.put(locale, urlLocale);
}
for (Locale locale : new Locale[] { Locale.CANADA_FRENCH, Locale.FRENCH, Locale.US, Locale.ENGLISH,
Locale.CHINA, Locale.CHINESE, Locale.ITALY, Locale.ITALIAN, new Locale("es", "CO"), new Locale("es", "CA") }) {
ApplicationResource urlLocale = localeResources.get(locale);
expect(applicationContext.getResource(url, locale)).andReturn(urlLocale).anyTimes();
}
return url;
}