summaryrefslogtreecommitdiff
path: root/java/systests/src
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-08-06 09:34:20 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-08-06 09:34:20 +0000
commit8f02060eddbfac498818447ff8b43016a944dc7d (patch)
treebac7facd19ea8f93960e062c8463b0459c0c51db /java/systests/src
parent6739f089d5b5389d07ce4ed04d74eeb689325ce1 (diff)
downloadqpid-python-8f02060eddbfac498818447ff8b43016a944dc7d.tar.gz
QPID-2002, QPID-2012 : Provide Broker Startup Logging using a SystemOutMessageLogger until we have loaded the main configuration and then re-initialise with that configuration
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@801567 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests/src')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java102
1 files changed, 102 insertions, 0 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java b/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java
new file mode 100644
index 0000000000..210702ff75
--- /dev/null
+++ b/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java
@@ -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.
+ *
+ */
+ package org.apache.qpid.server.logging;
+
+import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.util.LogMonitor;
+
+import java.io.File;
+import java.util.List;
+
+public class BrokerLoggingTest extends AbstractTestLogging
+{
+ LogMonitor _monitor;
+
+ public void setUp() throws Exception
+ {
+ // set QPID_WORK to be [QPID_WORK|io.tmpdir]/<testName>
+ setSystemProperty("QPID_WORK",
+ System.getProperty("QPID_WORK",
+ System.getProperty("java.io.tmpdir"))
+ + File.separator + getName());
+
+// makeVirtualHostPersistent("test");
+
+ _monitor = new LogMonitor(_outputFile);
+
+ //We explicitly do not call super.setUp as starting up the broker is
+ //part of the test case.
+ }
+
+ /**
+ * Description:
+ * On startup the broker must report the active configuration file. The
+ * logging system must output this so that we can know what configuration
+ * is being used for this broker instance.
+ *
+ * Input:
+ * The value of -c specified on the command line.
+ * Output:
+ * <date> MESSAGE BRK-1006 : Using configuration : <config file>
+ * Constraints:
+ * This MUST BE the first BRK log message.
+ *
+ * Validation Steps:
+ * 1. This is first BRK log message.
+ * 2. The BRK ID is correct
+ * 3. The config file is the full path to the file specified on
+ * the commandline.
+ *
+ * @throws Exception caused by broker startup
+ */
+ public void testBrokerStartupConfiguration() throws Exception
+ {
+ // This logging model only applies to the Java broker
+ if (isJavaBroker() && isExternalBroker())
+ {
+ startBroker();
+
+ String configFilePath = _configFile.toString();
+
+ List<String> results = _monitor.findMatches("BRK-");
+
+ // Validation
+
+ assertTrue("BRKer message not logged", results.size() > 0);
+
+ String log = getLog(results.get(0));
+
+ //1
+ validateMessageID("BRK-1006",log);
+
+ //2
+ results = _monitor.findMatches("BRK-1006");
+ assertEquals("More than one configuration message found.",
+ 1, results.size());
+
+ //3
+ assertTrue("Config file details not correctly logged",
+ log.endsWith(configFilePath));
+
+ }
+ }
+
+}