alma::acs::logging::RemoteLogDispatcherTest Class Reference

Inheritance diagram for alma::acs::logging::RemoteLogDispatcherTest:
Inheritance graph
[legend]
Collaboration diagram for alma::acs::logging::RemoteLogDispatcherTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void testSendLogRecords ()
void testFlushByRecordNumber ()
void testPeriodicFlush ()
void testUnavailableRemoteLogService () throws Exception
void testFailingRecords ()
void testQueueOverflow ()

Protected Member Functions

void setUp () throws Exception
void tearDown () throws Exception

Private Member Functions

void sleep (long millis)

Private Attributes

ORB orb
TestLogDispatcher dispatcher
DispatchingLogQueue queue
CollectingLogger collectingLogger
TestAcsXMLLogFormatter formatter

Member Function Documentation

void alma::acs::logging::RemoteLogDispatcherTest::setUp (  )  throws Exception [inline, protected]

JUnit's class re-loading strategy fails for these tests, so the setUp must reset the state of the member variables

See also:
junit.framework.TestCase::setUp()

References alma::acs::testsupport::LogRecordCollectingLogger::clearLogRecords(), collectingLogger, dispatcher, formatter, alma::acs::testsupport::LogRecordCollectingLogger::getCollectingLogger(), orb, queue, and alma::acs::testsupport::LogRecordCollectingLogger::suppressLogs().

void alma::acs::logging::RemoteLogDispatcherTest::sleep ( long  millis  )  [inline, private]
void alma::acs::logging::RemoteLogDispatcherTest::tearDown (  )  throws Exception [inline, protected]
void alma::acs::logging::RemoteLogDispatcherTest::testFailingRecords (  )  [inline]

Tests that a failure in XML formatting leads to dropping of the records.

Then tests that even with a 70% chance of failure in dispatching the log records will eventually send all records, due to the records being taken out and re-inserted in the queue. Chances to add an additional record to the queue are fairly low because the simulated failure in writeRecords(..) occurs immediately (before the 200ms sleep we otherwise get)

References collectingLogger, dispatcher, alma::acs::logging::DispatchingLogQueue::flushAllAndWait(), formatter, alma::acs::testsupport::LogRecordCollectingLogger::getCollectedLogRecords(), alma::acs::logging::TestLogDispatcher::getCollectedXmlLogRecords(), alma::acs::logging::DispatchingLogQueue::log(), alma::acs::logging::CollectingLogger::produceLogs1(), queue, alma::acs::logging::RemoteLogDispatcher::setBufferSize(), alma::acs::logging::TestAcsXMLLogFormatter::setFormatFailureChance(), alma::acs::logging::DispatchingLogQueue::setRemoteLogDispatcher(), and alma::acs::logging::TestLogDispatcher::setWriteFailureChance().

void alma::acs::logging::RemoteLogDispatcherTest::testFlushByRecordNumber (  )  [inline]

Sends as many LogRecords via DispatchingLogQueue#log(LogRecord) that the buffer size ("dispatchPacketSize") is not quite reached, and verifies that all these logs are still queued.

Then sends another LogRecord and verifies that (now that the buffer was full) all LogRecords are forwarded from the queue to the dispatcher.

Finally this test verifies that the dispatcher applies the time sorting correctly, thus restoring the original order of LogRecords. (The queue should sort by log level, but since in this test all records fit into one buffer, the original order should be restored.)

References collectingLogger, dispatcher, alma::acs::testsupport::LogRecordCollectingLogger::getCollectedLogRecords(), alma::acs::logging::TestLogDispatcher::getCollectedXmlLogRecords(), alma::acs::logging::DispatchingLogQueue::log(), alma::acs::logging::CollectingLogger::produceLogs1(), queue, alma::acs::logging::RemoteLogDispatcher::setBufferSize(), alma::acs::logging::DispatchingLogQueue::setRemoteLogDispatcher(), and sleep().

void alma::acs::logging::RemoteLogDispatcherTest::testPeriodicFlush (  )  [inline]

Sets up DispatchingLogQueue for periodic flushing every 2 seconds (cp. CDB attribute "flushPeriodSeconds") and sends some LogRecords to the queue. (Flushing by record number is disabled by using a sufficiently large buffer, see also testFlushByRecordNumber()). Then verifies that after the flushing period the log records have been forwarded to the dispatcher.

Then sends many more log records than fit into one buffer, thus testing the triggering of subsequent flushes until the queue is drained, and that this mechanism still works while we have scheduled flushing in place.

Finally stops the scheduled flushing and verifies that it's gone.

References alma::acs::logging::TestLogDispatcher::clearCollectedXmlLogRecords(), alma::acs::testsupport::LogRecordCollectingLogger::clearLogRecords(), collectingLogger, dispatcher, alma::acs::logging::DispatchingLogQueue::flushesPeriodically(), alma::acs::testsupport::LogRecordCollectingLogger::getCollectedLogRecords(), alma::acs::logging::TestLogDispatcher::getCollectedXmlLogRecords(), alma::acs::logging::DispatchingLogQueue::log(), alma::acs::logging::DispatchingLogQueue::pendingFlushes(), alma::acs::logging::CollectingLogger::produceLogs1(), queue, alma::acs::logging::DispatchingLogQueue::realQueueSize(), alma::acs::logging::RemoteLogDispatcher::setBufferSize(), alma::acs::logging::DispatchingLogQueue::setPeriodicFlushing(), alma::acs::logging::DispatchingLogQueue::setRemoteLogDispatcher(), and sleep().

void alma::acs::logging::RemoteLogDispatcherTest::testQueueOverflow (  )  [inline]
void alma::acs::logging::RemoteLogDispatcherTest::testSendLogRecords (  )  [inline]
void alma::acs::logging::RemoteLogDispatcherTest::testUnavailableRemoteLogService (  )  throws Exception [inline]

Member Data Documentation

Referenced by setUp(), and testSendLogRecords().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2