diff options
author | Martin Ritchie <ritchiem@apache.org> | 2009-08-12 17:59:08 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2009-08-12 17:59:08 +0000 |
commit | 93a5650c98e345deb4e50204a7ac65f0eb19482d (patch) | |
tree | fac97ec012a8da6d2bb8afc27d23d8e104e892e5 | |
parent | fe62f80100e439dcf0ce95d906c762aa267c0f03 (diff) | |
download | qpid-python-93a5650c98e345deb4e50204a7ac65f0eb19482d.tar.gz |
QPID-2002 : Added test to ensure that the ResourceBundle is loadable even if the current Locale is not one that has a specific file.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@803630 13f79535-47bb-0310-9956-ffa450edef68
2 files changed, 173 insertions, 0 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties new file mode 100644 index 0000000000..15ab56bcec --- /dev/null +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties @@ -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 diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java new file mode 100644 index 0000000000..0f3f7bd2b5 --- /dev/null +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java @@ -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()); + } + } + +} |