summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-07-23 12:57:53 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-07-23 12:57:53 +0000
commita99e00a1bc9c4ae4b66d92b9de78a7caaa5a743e (patch)
tree88d0a2c08b2cdba389cb34a7df122687a2a2d06c
parentba37cf68bb4fc8008bb62e5ec97d0ff22f35e537 (diff)
downloadqpid-python-a99e00a1bc9c4ae4b66d92b9de78a7caaa5a743e.tar.gz
QPID-2001 : Fully Tested LogMessages
Added TestBlankSubject to be able to easily identify log message Updatd LogMessasges based on issues found. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@797050 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages_en_US.properties12
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java104
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/BindingMessagesTest.java26
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/BrokerMessagesTest.java113
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/ChannelMessagesTest.java65
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/ConnectionMessagesTest.java51
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/ExchangeMessagesTest.java58
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/ManagementConsoleMessagesTest.java95
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/MessageStoreMessagesTest.java123
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java49
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/SubscriptionMessagesTest.java47
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/VirtualHostMessagesTest.java48
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/subjects/TestBlankSubject.java30
13 files changed, 814 insertions, 7 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages_en_US.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages_en_US.properties
index 868a611134..d393614191 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages_en_US.properties
+++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages_en_US.properties
@@ -4,10 +4,10 @@
BRK-1001 = Startup : Version: {0} Build: {1}
# 0 - Transport
# 1 - Port
-BRK-1002 = Starting : Listening on {0} port {1,number}
+BRK-1002 = Starting : Listening on {0} port {1, number, #}
# 0 - Transport
# 1 - Port
-BRK-1003 = Shuting down : {0} port {1,number}
+BRK-1003 = Shuting down : {0} port {1, number, #}
BRK-1004 = Ready
BRK-1005 = Stopped
# 0 - path
@@ -19,10 +19,10 @@ BRK-1007 = Using logging configuration : {0}
MNG-1001 = Startup
# 0 - Service
# 1 - Port
-MNG-1002 = Starting : {0} : Listening on port {1,number}
+MNG-1002 = Starting : {0} : Listening on port {1, number, #}
# 0 - Service
# 1 - Port
-MNG-1003 = Shuting down : {0} : port {1,number}
+MNG-1003 = Shuting down : {0} : port {1, number, #}
MNG-1004 = Ready
MNG-1005 = Stopped
# 0 - Path
@@ -44,7 +44,7 @@ MST-1004 = Recovery Start
MST-1005 = Recovery Start : {0}
# 0 - count
# 1 - queue count
-MST-1006 = Recovered {0,number} messages for queue {0}
+MST-1006 = Recovered {0,number} messages for queue {1}
MST-1007 = Recovery Complete
# 0 - queue name
MST-1008 = Recovery Complete : {0}
@@ -57,7 +57,7 @@ CON-1002 = Close
#Channel
# 0 - count
-CHN-1001 = Create : Prefetch {0,number}
+CHN-1001 = Create : Prefetch {0, number}
# 0 - flow
CHN-1002 = Flow {0}
CHN-1003 = Close
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java
new file mode 100644
index 0000000000..6589695146
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java
@@ -0,0 +1,104 @@
+/*
+ *
+ * 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.messages;
+
+import junit.framework.TestCase;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.qpid.server.configuration.ServerConfiguration;
+import org.apache.qpid.server.logging.LogActor;
+import org.apache.qpid.server.logging.LogMessage;
+import org.apache.qpid.server.logging.LogSubject;
+import org.apache.qpid.server.logging.RootMessageLogger;
+import org.apache.qpid.server.logging.RootMessageLoggerImpl;
+import org.apache.qpid.server.logging.actors.TestBlankActor;
+import org.apache.qpid.server.logging.rawloggers.UnitTestMessageLogger;
+import org.apache.qpid.server.logging.subjects.TestBlankSubject;
+
+import java.util.List;
+
+public abstract class AbstractTestMessages extends TestCase
+{
+ protected Configuration _config = new PropertiesConfiguration();
+ protected LogMessage _logMessage = null;
+ protected LogActor _actor;
+ protected UnitTestMessageLogger _logger;
+ protected LogSubject _logSubject = new TestBlankSubject();
+
+ public void setUp() throws ConfigurationException
+ {
+ ServerConfiguration serverConfig = new ServerConfiguration(_config);
+
+ _logger = new UnitTestMessageLogger();
+ RootMessageLogger rootLogger =
+ new RootMessageLoggerImpl(serverConfig, _logger);
+
+ _actor = new TestBlankActor(rootLogger);
+ }
+
+ protected List<Object> performLog()
+ {
+ if (_logMessage == null)
+ {
+ throw new NullPointerException("LogMessage has not been set");
+ }
+
+ _actor.message(_logSubject, _logMessage);
+
+ return _logger.getLogMessages();
+ }
+
+ /**
+ * Validate that only a single log messasge occured and that the message
+ * section starts with the specified tag
+ *
+ * @param logs the logs generated during test run
+ * @param tag the tag to check for
+ * @param expected
+ *
+ * @return the log message section for further testing
+ */
+ protected void validateLogMessage(List<Object> logs, String tag, String[] expected)
+ {
+ assertEquals("Log has incorrect message count", 1, logs.size());
+
+ String log = String.valueOf(logs.get(0));
+
+ int index = log.indexOf(_logSubject.toString());
+
+ assertTrue("Unable to locate Subject:" + log, index != -1);
+
+ String message = log.substring(index + _logSubject.toString().length());
+
+ assertTrue("Message does not start with tag:" + tag + ":" + message,
+ message.startsWith(tag));
+
+ // Test that the expected items occur in order.
+ index = 0;
+ for (String text : expected)
+ {
+ index = message.indexOf(text, index);
+ assertTrue("Message does not contain expected (" + text + ") text :" + message, index != -1);
+ }
+ }
+
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BindingMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BindingMessagesTest.java
index 6e23b4a52f..a12d14239d 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BindingMessagesTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BindingMessagesTest.java
@@ -20,6 +20,30 @@
*/
package org.apache.qpid.server.logging.messages;
-public class BindingMessagesTest
+import java.util.List;
+
+public class BindingMessagesTest extends AbstractTestMessages
{
+
+ public void testMessage1001()
+ {
+ _logMessage = BindingMessages.BND_1001();
+ List<Object> log = performLog();
+
+ String[] expected = {"Create"};
+
+ validateLogMessage(log, "BND-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ _logMessage = BindingMessages.BND_1002();
+
+ List<Object> log = performLog();
+
+ String[] expected = {"Deleted"};
+
+ validateLogMessage(log, "BND-1002", expected);
+ }
+
}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BrokerMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BrokerMessagesTest.java
new file mode 100644
index 0000000000..65dcea1e25
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BrokerMessagesTest.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * 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.messages;
+
+import java.util.List;
+
+public class BrokerMessagesTest extends AbstractTestMessages
+{
+ public void testMessage1001()
+ {
+ String version = "Qpid 0.6";
+ String build = "796936M";
+
+ _logMessage = BrokerMessages.BRK_1001(version, build);
+ List<Object> log = performLog();
+
+ String[] expected = {"Startup :", "Version:", version, "Build:", build};
+
+ validateLogMessage(log, "BRK-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ String transport = "TCP";
+ Integer port = 2765;
+
+ _logMessage = BrokerMessages.BRK_1002(transport, port);
+
+ List<Object> log = performLog();
+
+ String[] expected = {"Starting", "Listening on ",
+ transport, "port ", String.valueOf(port)};
+
+ validateLogMessage(log, "BRK-1002", expected);
+ }
+
+ public void testMessage1003()
+ {
+ String transport = "TCP";
+ Integer port = 2765;
+
+ _logMessage = BrokerMessages.BRK_1003(transport, port);
+
+ List<Object> log = performLog();
+
+ String[] expected = {"Shuting down", transport, "port ", String.valueOf(port)};
+
+ validateLogMessage(log, "BRK-1003", expected);
+ }
+
+ public void testMessage1004()
+ {
+ _logMessage = BrokerMessages.BRK_1004();
+ List<Object> log = performLog();
+
+ String[] expected = {"Ready"};
+
+ validateLogMessage(log, "BRK-1004", expected);
+ }
+
+ public void testMessage1005()
+ {
+ _logMessage = BrokerMessages.BRK_1005();
+ List<Object> log = performLog();
+
+ String[] expected = {"Stopped"};
+
+ validateLogMessage(log, "BRK-1005", expected);
+ }
+
+ public void testMessage1006()
+ {
+ String path = "/file/path/to/configuration.xml";
+
+ _logMessage = BrokerMessages.BRK_1006(path);
+ List<Object> log = performLog();
+
+ String[] expected = {"Using configuration :", path};
+
+ validateLogMessage(log, "BRK-1006", expected);
+ }
+
+ public void testMessage1007()
+ {
+ String path = "/file/path/to/configuration.xml";
+
+ _logMessage = BrokerMessages.BRK_1007(path);
+ List<Object> log = performLog();
+
+ String[] expected = {"Using logging configuration :", path};
+
+ validateLogMessage(log, "BRK-1007", expected);
+ }
+
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ChannelMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ChannelMessagesTest.java
new file mode 100644
index 0000000000..2a37eae728
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ChannelMessagesTest.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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.messages;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+public class ChannelMessagesTest extends AbstractTestMessages
+{
+ public void testMessage1001()
+ {
+ Integer prefetch = 12345;
+
+ _logMessage = ChannelMessages.CHN_1001(prefetch);
+ List<Object> log = performLog();
+
+ // We use the MessageFormat here as that is what the ChannelMessage
+ // will do, this makes the resulting value 12,345
+ String[] expected = {"Create", "Prefetch",
+ MessageFormat.format("{0, number}", prefetch)};
+
+ validateLogMessage(log, "CHN-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ String flow = "ON";
+
+ _logMessage = ChannelMessages.CHN_1002(flow);
+ List<Object> log = performLog();
+
+ String[] expected = {"Flow", flow};
+
+ validateLogMessage(log, "CHN-1002", expected);
+ }
+
+ public void testMessage1003()
+ {
+ _logMessage = ChannelMessages.CHN_1003();
+ List<Object> log = performLog();
+
+ String[] expected = {"Close"};
+
+ validateLogMessage(log, "CHN-1003", expected);
+ }
+
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ConnectionMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ConnectionMessagesTest.java
new file mode 100644
index 0000000000..8723c48476
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ConnectionMessagesTest.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * 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.messages;
+
+import java.util.List;
+
+public class ConnectionMessagesTest extends AbstractTestMessages
+{
+ public void testMessage1001()
+ {
+ String clientID = "client";
+ String protocolVersion = "8-0";
+
+ _logMessage = ConnectionMessages.CON_1001(clientID, protocolVersion);
+ List<Object> log = performLog();
+
+ String[] expected = {"Open :", "Client ID", clientID,
+ ": Protocol Version :", protocolVersion};
+
+ validateLogMessage(log, "CON-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ _logMessage = ConnectionMessages.CON_1002();
+ List<Object> log = performLog();
+
+ String[] expected = {"Close"};
+
+ validateLogMessage(log, "CON-1002", expected);
+ }
+
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ExchangeMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ExchangeMessagesTest.java
new file mode 100644
index 0000000000..46a911fdc6
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ExchangeMessagesTest.java
@@ -0,0 +1,58 @@
+/*
+ *
+ * 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.messages;
+
+import org.apache.qpid.server.exchange.Exchange;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+
+import java.util.List;
+
+public class ExchangeMessagesTest extends AbstractTestMessages
+{
+ public void testMessage1001()
+ {
+ // Get the Default Exchange on the Test Vhost for testing
+ Exchange exchange = ApplicationRegistry.getInstance().
+ getVirtualHostRegistry().getVirtualHost("test").
+ getExchangeRegistry().getDefaultExchange();
+
+ String type = exchange.getType().toString();
+ String name = exchange.getName().toString();
+
+ _logMessage = ExchangeMessages.EXH_1001(type, name);
+ List<Object> log = performLog();
+
+ String[] expected = {"Create :", "Type:", type, "Name:", name};
+
+ validateLogMessage(log, "EXH-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ _logMessage = ExchangeMessages.EXH_1002();
+ List<Object> log = performLog();
+
+ String[] expected = {"Deleted"};
+
+ validateLogMessage(log, "EXH-1002", expected);
+ }
+
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ManagementConsoleMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ManagementConsoleMessagesTest.java
new file mode 100644
index 0000000000..e9b40c5dad
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ManagementConsoleMessagesTest.java
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.messages;
+
+import java.util.List;
+
+public class ManagementConsoleMessagesTest extends AbstractTestMessages
+{
+ public void testMessage1001()
+ {
+ _logMessage = ManagementConsoleMessages.MNG_1001();
+ List<Object> log = performLog();
+
+ String[] expected = {"Startup"};
+
+ validateLogMessage(log, "MNG-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ String transport = "JMX";
+ Integer port = 8889;
+
+ _logMessage = ManagementConsoleMessages.MNG_1002(transport, port);
+ List<Object> log = performLog();
+
+ String[] expected = {"Starting :", transport, ": Listening on port", String.valueOf(port)};
+
+ validateLogMessage(log, "MNG-1002", expected);
+ }
+
+ public void testMessage1003()
+ {
+ String transport = "JMX";
+ Integer port = 8889;
+
+ _logMessage = ManagementConsoleMessages.MNG_1003(transport, port);
+ List<Object> log = performLog();
+
+ String[] expected = {"Shuting down :", transport, ": port", String.valueOf(port)};
+
+ validateLogMessage(log, "MNG-1003", expected);
+ }
+
+ public void testMessage1004()
+ {
+ _logMessage = ManagementConsoleMessages.MNG_1004();
+ List<Object> log = performLog();
+
+ String[] expected = {"Ready"};
+
+ validateLogMessage(log, "MNG-1004", expected);
+ }
+
+ public void testMessage1005()
+ {
+ _logMessage = ManagementConsoleMessages.MNG_1005();
+ List<Object> log = performLog();
+
+ String[] expected = {"Stopped"};
+
+ validateLogMessage(log, "MNG-1005", expected);
+ }
+
+ public void testMessage1006()
+ {
+ String path = "/path/to/the/keystore/files.jks";
+
+ _logMessage = ManagementConsoleMessages.MNG_1006(path);
+ List<Object> log = performLog();
+
+ String[] expected = {"Using SSL Keystore :", path};
+
+ validateLogMessage(log, "MNG-1006", expected);
+ }
+
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/MessageStoreMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/MessageStoreMessagesTest.java
new file mode 100644
index 0000000000..e1ae93b869
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/MessageStoreMessagesTest.java
@@ -0,0 +1,123 @@
+/*
+ *
+ * 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.messages;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+public class MessageStoreMessagesTest extends AbstractTestMessages
+{
+ public void testMessage1001()
+ {
+ String name = "DerbyMessageStore";
+
+ _logMessage = MessageStoreMessages.MST_1001(name);
+ List<Object> log = performLog();
+
+ String[] expected = {"Created :", name};
+
+ validateLogMessage(log, "MST-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ String location = "/path/to/the/message/store.files";
+
+ _logMessage = MessageStoreMessages.MST_1002(location);
+ List<Object> log = performLog();
+
+ String[] expected = {"Store location :", location};
+
+ validateLogMessage(log, "MST-1002", expected);
+ }
+
+ public void testMessage1003()
+ {
+ _logMessage = MessageStoreMessages.MST_1003();
+ List<Object> log = performLog();
+
+ String[] expected = {"Closed"};
+
+ validateLogMessage(log, "MST-1003", expected);
+ }
+
+ public void testMessage1004()
+ {
+ _logMessage = MessageStoreMessages.MST_1004();
+ List<Object> log = performLog();
+
+ String[] expected = {"Recovery Start"};
+
+ validateLogMessage(log, "MST-1004", expected);
+ }
+
+ public void testMessage1005()
+ {
+ String queueName = "testQueue";
+
+ _logMessage = MessageStoreMessages.MST_1005(queueName);
+ List<Object> log = performLog();
+
+ String[] expected = {"Recovery Start :", queueName};
+
+ validateLogMessage(log, "MST-1005", expected);
+ }
+
+ public void testMessage1006()
+ {
+ String queueName = "testQueue";
+ Integer messasgeCount = 2000;
+
+ _logMessage = MessageStoreMessages.MST_1006(messasgeCount, queueName);
+ List<Object> log = performLog();
+
+ // Here we use MessageFormat to ensure the messasgeCount of 2000 is
+ // reformated for display as '2,000'
+ String[] expected = {"Recovered ",
+ MessageFormat.format("{0,number}", messasgeCount),
+ "messages for queue", queueName};
+
+ validateLogMessage(log, "MST-1006", expected);
+ }
+
+ public void testMessage1007()
+ {
+ _logMessage = MessageStoreMessages.MST_1007();
+ List<Object> log = performLog();
+
+ String[] expected = {"Recovery Complete"};
+
+ validateLogMessage(log, "MST-1007", expected);
+ }
+
+ public void testMessage1008()
+ {
+ String queueName = "testQueue";
+
+ _logMessage = MessageStoreMessages.MST_1008(queueName);
+ List<Object> log = performLog();
+
+ String[] expected = {"Recovery Complete :", queueName};
+
+ validateLogMessage(log, "MST-1008", expected);
+ }
+
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java
new file mode 100644
index 0000000000..4ba00ea6e4
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * 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.messages;
+
+import java.util.List;
+
+public class QueueMessagesTest extends AbstractTestMessages
+{
+ public void testMessage1001()
+ {
+ String owner = "guest";
+
+ _logMessage = QueueMessages.QUE_1001(owner);
+ List<Object> log = performLog();
+
+ String[] expected = {"Create :", "Owner:", owner};
+
+ validateLogMessage(log, "QUE-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ _logMessage = QueueMessages.QUE_1002();
+ List<Object> log = performLog();
+
+ String[] expected = {"Deleted"};
+
+ validateLogMessage(log, "QUE-1002", expected);
+ }
+
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/SubscriptionMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/SubscriptionMessagesTest.java
new file mode 100644
index 0000000000..1bb96e1e33
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/SubscriptionMessagesTest.java
@@ -0,0 +1,47 @@
+/*
+ *
+ * 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.messages;
+
+import java.util.List;
+
+public class SubscriptionMessagesTest extends AbstractTestMessages
+{
+ public void testMessage1001()
+ {
+
+ _logMessage = SubscriptionMessages.SUB_1001();
+ List<Object> log = performLog();
+
+ String[] expected = {"Create :"};
+
+ validateLogMessage(log, "SUB-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ _logMessage = SubscriptionMessages.SUB_1002();
+ List<Object> log = performLog();
+
+ String[] expected = {"Close"};
+
+ validateLogMessage(log, "SUB-1002", expected);
+ }
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/VirtualHostMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/VirtualHostMessagesTest.java
new file mode 100644
index 0000000000..2158676115
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/VirtualHostMessagesTest.java
@@ -0,0 +1,48 @@
+/*
+ *
+ * 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.messages;
+
+import java.util.List;
+
+public class VirtualHostMessagesTest extends AbstractTestMessages
+{
+ public void testMessage1001()
+ {
+ String name = "test";
+ _logMessage = VirtualHostMessages.VHT_1001(name);
+ List<Object> log = performLog();
+
+ String[] expected = {"Created :", name};
+
+ validateLogMessage(log, "VHT-1001", expected);
+ }
+
+ public void testMessage1002()
+ {
+ _logMessage = VirtualHostMessages.VHT_1002();
+ List<Object> log = performLog();
+
+ String[] expected = {"Closed"};
+
+ validateLogMessage(log, "VHT-1002", expected);
+ }
+
+}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/TestBlankSubject.java b/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/TestBlankSubject.java
new file mode 100644
index 0000000000..9e3c6f9bcb
--- /dev/null
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/TestBlankSubject.java
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.subjects;
+
+public class TestBlankSubject extends AbstractLogSubject
+{
+ public TestBlankSubject()
+ {
+ logString = "[TestBlankSubject]";
+ }
+
+}