Re: Unable to load messages in UTF-8 encoding in test class/ in different class than messages belong to

2012-11-08 Thread Balázs Palcsó
Hi,

After a bit more investigation. I would say that
private final Messages messages = MessagesImpl.forClass(Registration.class);
would be the proper solution to load messages of my Registration page if
MessagesImpl.forClass(Class) used UTF-8 encoding instead of the default
ISO-8859-1 (latin1) when loading properties files.
In pages and components my UTF-8 encoded properties files work correctly as
documented at http://tapestry.apache.org/localization.html

The reason I want to access the messages of a page to be able to assert
that the correct messages have been printed on the page. But I don't want
duplicate the message by hard-coding them in my tests.

I believe MessagesImpl.forClass(Class) should also load the properties file
with UTF-8 encoding. and could be moved from internal package to become
part of the public API.
What do you think? Shall I open a task in JIRA?

Thanks and regards,
Balazs


On 8 November 2012 08:37, Balázs Palcsó palcso.bal...@gmail.com wrote:

 Hi All,

 I am new to Tapestry. I am creating a test with Tapestry Testify and
 XPath. Everything works fine except that in my test class I am not able to
 load Messages from properties file stored in UTF-8 encoding.

 In my RegistrationTest class I have tried the followings:
 *#1*
 private final Messages messages =
 MessagesImpl.forClass(Registration.class); // This loads the messages
 successfully, but does not seem to read the file with UTF-8 encoding

 *#2*
 @Inject
   private Messages messages; //Here I don't know how to specify that I
 need the Messages of Registration.class

 messages.get(PasswordsDontMatch) returns: (java.lang.String) [[missing
 key: PasswordsDontMatch]]

 *#3*
 I wanted to try MessagesSourceImpl, but it requires quite complex
 parametrization.

 Any hint is appreciated.

 Thanks and regards,
 Balazs Palcso



Unable to load messages in UTF-8 encoding in test class/ in different class than messages belong to

2012-11-07 Thread Balázs Palcsó
Hi All,

I am new to Tapestry. I am creating a test with Tapestry Testify and XPath.
Everything works fine except that in my test class I am not able to load
Messages from properties file stored in UTF-8 encoding.

In my RegistrationTest class I have tried the followings:
*#1*
private final Messages messages =
MessagesImpl.forClass(Registration.class); // This loads the messages
successfully, but does not seem to read the file with UTF-8 encoding

*#2*
@Inject
  private Messages messages; //Here I don't know how to specify that I need
the Messages of Registration.class

messages.get(PasswordsDontMatch) returns: (java.lang.String) [[missing
key: PasswordsDontMatch]]

*#3*
I wanted to try MessagesSourceImpl, but it requires quite complex
parametrization.

Any hint is appreciated.

Thanks and regards,
Balazs Palcso