|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.qpid.test.utils.QpidTestCase
org.apache.qpid.test.utils.QpidBrokerTestCase
org.apache.qpid.server.logging.AbstractTestLogging
public class AbstractTestLogging
Abstract superclass for logging test set up and utility methods. So named to prevent it being selected itself as a test to run by the test suite.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase |
---|
QpidBrokerTestCase.MessageType |
Field Summary | |
---|---|
(package private) org.apache.qpid.server.util.InternalBrokerBaseCase |
_configLoader
|
protected LogMonitor |
_monitor
|
(package private) org.apache.qpid.server.configuration.ServerConfiguration |
_serverConfiguration
|
static long |
DEFAULT_LOG_WAIT
|
static String |
TEST_LOG_PREFIX
|
Fields inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase |
---|
_broker, _brokerLanguage, _brokerLogPrefix, _brokerOutputStream, _brokerPersistent, _brokers, _configFile, _connectionFactory, _connections, _initialContext, _interleaveBrokerLog, _logger, _output, _outputFile, _testName, BROKER_READY, CONTENT, CPP, DEFAULT_MANAGEMENT_PORT, DEFAULT_MESSAGE_SIZE, DEFAULT_PORT, DEFAULT_SSL_PORT, DEFAULT_VM_PORT, EXTERNAL, INDEX, JAVA, LOGMONITOR_TIMEOUT, QPID_HOME, QpidHome, QUEUE, RECEIVE_TIMEOUT, TOPIC, VM |
Fields inherited from class org.apache.qpid.test.utils.QpidTestCase |
---|
MEMORY_STORE_CLASS_NAME, MS_CLASS_NAME_KEY |
Constructor Summary | |
---|---|
AbstractTestLogging()
|
Method Summary | |
---|---|
void |
assertLoggingNotYetOccured(String log)
assert that the requested log message has not occured |
protected void |
dumpLogs(List<String> results)
Dump the log results. |
protected void |
dumpLogs(List<String> results,
LogMonitor monitor)
Dump the log results or if there are none, the contents of the monitored log file if the monitor is non-null. |
protected List<String> |
filterResultsByVirtualHost(List<String> results,
String virtualHostName)
Filter the give result set by the specficifed virtualhost. |
protected List<String> |
findMatches(String toFind)
|
protected String |
fromActor(String log)
Extract the actor segment from the log message. |
protected String |
fromMessage(String log)
|
protected String |
fromSubject(String log)
Extract the Subject from the Log Message. |
protected int |
getChannelID(String log)
Return the first channel id from the log string ' ch;X' if there is no channel id return -1. |
protected int |
getConnectionID(String log)
Given our log message extract the connection ID: The log string will contain the connectionID identified by 'con:' So extract the value shown here by X: 'con:X(' Extract the value between the ':' and '(' and process it as an Integer If we are unable to find the right index or process the substring as an Integer then return -1. |
protected String |
getLog(String rawLog)
Extract the log entry from the raw log line which will contain other log4j formatting. |
protected String |
getLogMessage(List<String> results,
int position)
Extract the log entry from the result set. |
protected String |
getLogMessageFromEnd(List<String> results,
int positionFromEnd)
Extract the nth-from-last log entry from the result set. |
protected String |
getMessageID(String log)
|
protected String |
getMessageString(String log)
Return the message String from the given message section |
protected void |
setLogMessagePrefix()
|
void |
setUp()
|
protected HashMap<Integer,List<String>> |
splitResultsOnConnectionID(List<String> logMessages)
Given a list of messages that have been pulled out of a log file Process the results splitting the log statements in to lists based on the actor's connection ID. |
void |
tearDown()
|
protected void |
validateMessageID(String id,
String log)
|
protected List<String> |
waitAndFindMatches(String toFind)
|
protected List<String> |
waitAndFindMatches(String toFind,
long wait)
|
boolean |
waitForMessage(String message)
|
boolean |
waitForMessage(String message,
long wait)
|
Methods inherited from class org.apache.qpid.test.utils.QpidTestCase |
---|
getTestProfileMessageStoreClassName, run |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_LOG_WAIT
public static final String TEST_LOG_PREFIX
protected LogMonitor _monitor
org.apache.qpid.server.configuration.ServerConfiguration _serverConfiguration
org.apache.qpid.server.util.InternalBrokerBaseCase _configLoader
Constructor Detail |
---|
public AbstractTestLogging()
Method Detail |
---|
public void setUp() throws Exception
setUp
in class QpidBrokerTestCase
Exception
protected void setLogMessagePrefix()
public void tearDown() throws Exception
tearDown
in class QpidBrokerTestCase
Exception
public void assertLoggingNotYetOccured(String log) throws IOException
log
-
IOException
protected void validateMessageID(String id, String log)
protected String getMessageID(String log)
protected int getChannelID(String log)
log
- the log string to search.
protected String fromMessage(String log)
protected String fromSubject(String log)
log
- The log message to process
protected String fromActor(String log)
log
- the Log Message
protected String getMessageString(String log)
log
- the Message Section
protected int getConnectionID(String log)
log
- the log String to process
protected String getLog(String rawLog)
rawLog
- the raw log
protected String getLogMessage(List<String> results, int position)
results
- list of log message results to extract fromposition
- position in the list of the message to extract
protected String getLogMessageFromEnd(List<String> results, int positionFromEnd)
results
- list of log message results to extract frompositionFromEnd
- position from end of the message list to extract (eg 0 for last)
protected List<String> findMatches(String toFind) throws IOException
IOException
protected List<String> waitAndFindMatches(String toFind) throws IOException
IOException
protected List<String> waitAndFindMatches(String toFind, long wait) throws IOException
IOException
public boolean waitForMessage(String message) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public boolean waitForMessage(String message, long wait) throws FileNotFoundException, IOException
FileNotFoundException
IOException
protected HashMap<Integer,List<String>> splitResultsOnConnectionID(List<String> logMessages)
logMessages
- The list of mixed connection log messages
protected List<String> filterResultsByVirtualHost(List<String> results, String virtualHostName)
results
- full list of logsvirtualHostName
- the virtualhostName to filter on
protected void dumpLogs(List<String> results) throws IOException
IOException
protected void dumpLogs(List<String> results, LogMonitor monitor) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |