Author: chris.laprun(a)jboss.com
Date: 2011-09-22 08:43:27 -0400 (Thu, 22 Sep 2011)
New Revision: 7485
Added:
components/wsrp/trunk/admin-gui/src/test/resources/Other.properties
components/wsrp/trunk/admin-gui/src/test/resources/locale/
components/wsrp/trunk/admin-gui/src/test/resources/locale/portlet/
components/wsrp/trunk/admin-gui/src/test/resources/locale/portlet/Resource.properties
Removed:
components/wsrp/trunk/admin-gui/src/test/resources/Resource.properties
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/BeanContextTestCase.java
Log:
- GTNWSRP-192: Improved (and fixed) test cases.
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java 2011-09-22
12:06:15 UTC (rev 7484)
+++
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java 2011-09-22
12:43:27 UTC (rev 7485)
@@ -44,7 +44,7 @@
protected final static Logger log = LoggerFactory.getLogger(BeanContext.class);
public static final String STATUS = "status";
- private static final String DEFAULT_RESOURCE_NAME =
"locale.portlet.Resource";
+ static final String DEFAULT_RESOURCE_NAME = "locale.portlet.Resource";
private static final String UNEXPECTED_ERROR =
"bean_support_unexpected_error";
private static final String CAUSE = "bean_support_cause";
private static final String CURRENT_PLACEHOLDER = "###";
Modified:
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/BeanContextTestCase.java
===================================================================
---
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/BeanContextTestCase.java 2011-09-22
12:06:15 UTC (rev 7484)
+++
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/BeanContextTestCase.java 2011-09-22
12:43:27 UTC (rev 7485)
@@ -34,14 +34,24 @@
*/
public class BeanContextTestCase extends TestCase
{
- public void testMessageFormatting()
+
+ public void testDefaultMessageFormatting()
{
assertEquals("foo value",
BeanContext.getLocalizedMessage("foo", Locale.getDefault()));
- assertEquals("foo value",
BeanContext.getLocalizedMessage("foo", Locale.getDefault(),
"Resource", "blah"));
- assertEquals("param value: foo",
BeanContext.getLocalizedMessage("1param", Locale.getDefault(),
"Resource", "foo"));
- assertEquals("param1 value: foo param2 value: bar",
BeanContext.getLocalizedMessage("2params", Locale.getDefault(),
"Resource", "foo", "bar"));
+ assertEquals("foo value",
BeanContext.getLocalizedMessage("foo", Locale.getDefault(),
BeanContext.DEFAULT_RESOURCE_NAME, "blah"));
+ assertEquals("param value: foo",
BeanContext.getLocalizedMessage("1param", Locale.getDefault(),
BeanContext.DEFAULT_RESOURCE_NAME, "foo"));
+ assertEquals("param1 value: foo param2 value: bar",
BeanContext.getLocalizedMessage("2params", Locale.getDefault(),
BeanContext.DEFAULT_RESOURCE_NAME, "foo", "bar"));
}
+ public void testMessageFormatting()
+ {
+ String resourceName = "Other";
+ assertEquals("other foo value",
BeanContext.getLocalizedMessage("foo", Locale.getDefault(), resourceName));
+ assertEquals("other foo value",
BeanContext.getLocalizedMessage("foo", Locale.getDefault(), resourceName,
"blah"));
+ assertEquals("other param value: foo",
BeanContext.getLocalizedMessage("1param", Locale.getDefault(), resourceName,
"foo"));
+ assertEquals("other param1 value: foo param2 value: bar",
BeanContext.getLocalizedMessage("2params", Locale.getDefault(), resourceName,
"foo", "bar"));
+ }
+
public void testErrorMessage()
{
TestBeanContext context = new TestBeanContext();
Added: components/wsrp/trunk/admin-gui/src/test/resources/Other.properties
===================================================================
--- components/wsrp/trunk/admin-gui/src/test/resources/Other.properties
(rev 0)
+++ components/wsrp/trunk/admin-gui/src/test/resources/Other.properties 2011-09-22
12:43:27 UTC (rev 7485)
@@ -0,0 +1,26 @@
+#
+# JBoss, a division of Red Hat
+# Copyright 2011, Red Hat Middleware, LLC, and individual
+# contributors as indicated by the @authors tag. See the
+# copyright.txt in the distribution for a full listing of
+# individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+#
+
+foo=other foo value
+1param=other param value: {0}
+2params=other param1 value: {0} param2 value: {1}
\ No newline at end of file
Deleted: components/wsrp/trunk/admin-gui/src/test/resources/Resource.properties
===================================================================
--- components/wsrp/trunk/admin-gui/src/test/resources/Resource.properties 2011-09-22
12:06:15 UTC (rev 7484)
+++ components/wsrp/trunk/admin-gui/src/test/resources/Resource.properties 2011-09-22
12:43:27 UTC (rev 7485)
@@ -1,3 +0,0 @@
-foo=foo value
-1param=param value: {0}
-2params=param1 value: {0} param2 value: {1}
\ No newline at end of file
Added:
components/wsrp/trunk/admin-gui/src/test/resources/locale/portlet/Resource.properties
===================================================================
--- components/wsrp/trunk/admin-gui/src/test/resources/locale/portlet/Resource.properties
(rev 0)
+++
components/wsrp/trunk/admin-gui/src/test/resources/locale/portlet/Resource.properties 2011-09-22
12:43:27 UTC (rev 7485)
@@ -0,0 +1,26 @@
+#
+# JBoss, a division of Red Hat
+# Copyright 2011, Red Hat Middleware, LLC, and individual
+# contributors as indicated by the @authors tag. See the
+# copyright.txt in the distribution for a full listing of
+# individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+#
+
+foo=foo value
+1param=param value: {0}
+2params=param1 value: {0} param2 value: {1}
\ No newline at end of file