From 4d9339fda0491df68b4725a81e712b6c97fc9458 Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Wed, 8 Sep 2010 15:41:08 +0000 Subject: QPID-2840: have the tests set a message prefix to facilitate scraping messages from the test output git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@995103 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/server/logging/AbstractTestLogging.java | 11 ++++++++++- .../org/apache/qpid/server/logging/BrokerLoggingTest.java | 2 ++ .../org/apache/qpid/server/logging/ManagementLoggingTest.java | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'qpid/java') diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java index 9c1d302be0..f66ee38139 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java @@ -48,6 +48,7 @@ import java.util.List; public class AbstractTestLogging extends QpidBrokerTestCase { public static final long DEFAULT_LOG_WAIT = 2000; + public static final String TEST_LOG_PREFIX = "MESSAGE"; protected LogMonitor _monitor; ServerConfiguration _serverConfiguration; @@ -56,6 +57,8 @@ public class AbstractTestLogging extends QpidBrokerTestCase @Override public void setUp() throws Exception { + setLogMessagePrefix(); + super.setUp(); _monitor = new LogMonitor(_outputFile); @@ -115,6 +118,12 @@ public class AbstractTestLogging extends QpidBrokerTestCase } + protected void setLogMessagePrefix() + { + //set the message prefix to facilitate scraping from the munged test output. + setSystemProperty("qpid.logging.prefix", TEST_LOG_PREFIX); + } + @Override public void tearDown() throws Exception { @@ -324,7 +333,7 @@ public class AbstractTestLogging extends QpidBrokerTestCase */ protected String getLog(String rawLog) { - int start = rawLog.indexOf("MESSAGE"); + int start = rawLog.indexOf(TEST_LOG_PREFIX); return rawLog.substring(start); } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java index 66bcc10c50..8fd2c085c3 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java @@ -51,6 +51,8 @@ public class BrokerLoggingTest extends AbstractTestLogging public void setUp() throws Exception { + setLogMessagePrefix(); + // We either do this here or have a null check in tearDown. // As when this test is run against profiles other than java it will NPE _monitor = new LogMonitor(_outputFile); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java index 7ab937b15f..595c0d5f35 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java @@ -47,6 +47,8 @@ public class ManagementLoggingTest extends AbstractTestLogging public void setUp() throws Exception { + setLogMessagePrefix(); + // We either do this here or have a null check in tearDown. // As when this test is run against profiles other than java it will NPE _monitor = new LogMonitor(_outputFile); -- cgit v1.2.1