You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2009/08/12 19:59:08 UTC

svn commit: r803630 - in /qpid/trunk/qpid/java/broker/src: main/java/org/apache/qpid/server/logging/messages/LogMessages.properties test/java/org/apache/qpid/server/logging/LogMessageTest.java

Author: ritchiem
Date: Wed Aug 12 17:59:08 2009
New Revision: 803630

URL: http://svn.apache.org/viewvc?rev=803630&view=rev
Log:
QPID-2002 : Added test to ensure that the ResourceBundle is loadable even if the current Locale is not one that has a specific file.

Added:
    qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties
    qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java

Added: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties?rev=803630&view=auto
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties (added)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties Wed Aug 12 17:59:08 2009
@@ -0,0 +1,102 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+# Default File used for all non-defined locales.
+#Broker
+# 0 - Version
+# 1 = Build
+BRK-1001 = Startup : Version: {0} Build: {1}
+# 0 - Transport
+# 1 - Port
+BRK-1002 = Starting : Listening on {0} port {1,number,#}
+# 0 - Transport
+# 1 - Port
+BRK-1003 = Shuting down : {0} port {1,number,#}
+BRK-1004 = Ready
+BRK-1005 = Stopped
+# 0 - path
+BRK-1006 = Using configuration : {0}
+# 0 - path
+BRK-1007 = Using logging configuration : {0}
+
+#ManagementConsole
+MNG-1001 = Startup
+# 0 - Service
+# 1 - Port
+MNG-1002 = Starting : {0} : Listening on port {1,number,#}
+# 0 - Service
+# 1 - Port
+MNG-1003 = Shuting down : {0} : port {1,number,#}
+MNG-1004 = Ready
+MNG-1005 = Stopped
+# 0 - Path
+MNG-1006 = Using SSL Keystore : {0}
+
+#VirtualHost
+# 0 - name
+VHT-1001 = Created : {0}
+VHT-1002 = Closed
+
+#MessageStore
+# 0 - name
+MST-1001 = Created : {0}
+# 0 - path
+MST-1002 = Store location : {0}
+MST-1003 = Closed
+# 0 - queue name
+MST-1004 = Recovery Start[ : {0}]
+# 0 - count
+# 1 - queue count
+MST-1005 = Recovered {0,number} messages for queue {1}
+# 0 - queue name
+MST-1006 = Recovery Complete[ : {0}]
+
+#Connection
+# 0 - Client id
+# 1 - Protocol Version
+CON-1001 = Open[ : Client ID : {0}][ : Protocol Version : {1}]
+CON-1002 = Close
+
+#Channel
+CHN-1001 = Create
+# 0 - flow
+CHN-1002 = Flow {0}
+CHN-1003 = Close
+# 0 - bytes allowed in prefetch
+# 1 - number of messagse.
+CHN-1004 = Prefetch Size (bytes) {0,number} : Count {1,number}
+
+#Queue
+# 0 - owner
+# 1 - priority
+QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}]
+QUE-1002 = Deleted
+
+#Exchange
+# 0 - type
+# 1 - name
+EXH-1001 = Create :[ Durable] Type: {0} Name: {1}
+EXH-1002 = Deleted
+
+#Binding
+BND-1001 = Create[ : Arguments : {0}]
+BND-1002 = Deleted
+
+#Subscription
+SUB-1001 = Create[ : Durable][ : Arguments : {0}]
+SUB-1002 = Close

Added: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java?rev=803630&view=auto
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java (added)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java Wed Aug 12 17:59:08 2009
@@ -0,0 +1,71 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.logging;
+
+import junit.framework.TestCase;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class LogMessageTest extends TestCase
+{
+
+    /**
+     * Test that the US local is loadable. 
+     */
+    public void testUSLocale()
+    {
+        Locale usLocal = Locale.US;
+        Locale.setDefault(usLocal);
+        ResourceBundle _messages = ResourceBundle.getBundle("org.apache.qpid.server.logging.messages.LogMessages",
+                                                            usLocal);
+
+        assertNotNull("Unable to load ResourceBundle", _messages);
+
+        assertEquals("Loaded bundle has incorrect locale.", usLocal, _messages.getLocale());
+    }
+
+    /**
+     * Test that loading an undefined locale will result in loadig of the
+     * default US locale.
+     */
+    public void testUndefinedLocale()
+    {
+        Locale japanese = Locale.JAPANESE;
+
+        Locale.setDefault(japanese);
+        try
+        {
+            ResourceBundle _messages = ResourceBundle.getBundle("org.apache.qpid.server.logging.messages.LogMessages",
+                                                                japanese);
+
+            assertNotNull("Unable to load ResourceBundle", _messages);
+
+            // If we attempt to load an undefined locale it should default to the Root locale.
+            assertEquals("Loaded bundle has incorrect locale.", Locale.ROOT, _messages.getLocale());
+        }
+        catch (Throwable t)
+        {
+            fail(t.getMessage());
+        }
+    }
+
+}



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org