alma::acs::jlog::test::LoadSaveTest Class Reference

Inheritance diagram for alma::acs::jlog::test::LoadSaveTest:
Inheritance graph
[legend]
Collaboration diagram for alma::acs::jlog::test::LoadSaveTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void bytesRead (long bytes)
void bytesWritten (long bytes)
void testSaveLoad () throws Exception
void testSaveLoadCompressed () throws Exception
void errorReceived (String xml)
void logEntryReceived (ILogEntry logEntry)
void logsRead (int numOfLogs)
void logsWritten (int numOfLogs)
void testLoadingSpecialLogs () throws Exception
void testAppend () throws Exception
void testSaveLoadIterator () throws Exception
void testSaveLoadFields () throws Exception

Protected Member Functions

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

Private Attributes

final String log1
final String log2
String[] specialLogs = { log1, log2 }
volatile long bytesRead
volatile long bytesWritten
Collection< ILogEntrylogs
Vector< ILogEntrylogsRead
int numOfLogsRead
int numOfLogsWritten
String folder
String fileName
String gzipFileName

Static Private Attributes

static final int NUMBER_OF_LOGS = 1500
static final String USER_DIR = "user.dir"

Detailed Description

A class testing the load and save facilities

As a general rule, each test of this class

  1. generate some logs with the help of CacheUtils,
  2. save and load the logs.
  3. check if the logs written and those read are equals.
Author:
acaproni

Member Function Documentation

void alma::acs::jlog::test::LoadSaveTest::bytesRead ( long  bytes  )  [inline]
void alma::acs::jlog::test::LoadSaveTest::bytesWritten ( long  bytes  )  [inline]
void alma::acs::jlog::test::LoadSaveTest::errorReceived ( String  xml  )  [inline]
void alma::acs::jlog::test::LoadSaveTest::logEntryReceived ( ILogEntry  logEntry  )  [inline]
void alma::acs::jlog::test::LoadSaveTest::logsRead ( int  numOfLogs  )  [inline]
void alma::acs::jlog::test::LoadSaveTest::logsWritten ( int  numOfLogs  )  [inline]
void alma::acs::jlog::test::LoadSaveTest::setUp (  )  throws Exception [inline, protected]
See also:
junit.framework.TestCase::setUp()

References bytesRead, bytesWritten, fileName, folder, gzipFileName, logs, logsRead, NUMBER_OF_LOGS, numOfLogsRead, and USER_DIR.

void alma::acs::jlog::test::LoadSaveTest::tearDown (  )  throws Exception [inline, protected]
See also:
junit.framework.TestCase::tearDown()

References fileName, logs, and logsRead.

void alma::acs::jlog::test::LoadSaveTest::testAppend (  )  throws Exception [inline]

Test the append switch while saving logs by saving the same collection twice in the same file but with the append switch set to true.

Exceptions:
Exception 

References fileName, alma::acs::logging::engine::io::IOHelper::loadLogs(), logs, logsRead, numOfLogsRead, and alma::acs::logging::engine::io::IOHelper::saveLogs().

void alma::acs::jlog::test::LoadSaveTest::testLoadingSpecialLogs (  )  throws Exception [inline]

Load a set of special logs that could be interesting.

Initially this method opens an XML file and writes into it the special logs without using IOHelper. Then it tries to load the file containing the special logs

Exceptions:
Exception 

References fileName, alma::acs::logging::engine::io::IOHelper::loadLogs(), logsRead, and specialLogs.

void alma::acs::jlog::test::LoadSaveTest::testSaveLoad (  )  throws Exception [inline]

Load and save a collection of logs in uncompressed files

The save is performed by passing the name of the file

Exceptions:
Exception 

References bytesRead, bytesWritten, fileName, alma::acs::logging::engine::io::IOHelper::loadLogs(), logs, logsRead, numOfLogsRead, numOfLogsWritten, and alma::acs::logging::engine::io::IOHelper::saveLogs().

void alma::acs::jlog::test::LoadSaveTest::testSaveLoadCompressed (  )  throws Exception [inline]

Load and save a collection of logs in uncompressed files

The save is performed by passing the name of the file

Exceptions:
Exception 

References gzipFileName, alma::acs::logging::engine::io::IOHelper::loadLogs(), logs, logsRead, numOfLogsRead, numOfLogsWritten, and alma::acs::logging::engine::io::IOHelper::saveLogs().

void alma::acs::jlog::test::LoadSaveTest::testSaveLoadFields (  )  throws Exception [inline]

Save and Load the special logs then check their fields.

This test is performed comparing the fields of the special logs one by one instead of comparing the XMLs. The test does the following steps:

  1. build vector of logs to save from the XMLs in specialLogs
  2. save the vector of logs with an IOHelper object
  3. load the logs from file
  4. compare each field of the logs read from the file with those in specialLogs
  5. compare the additional data names and values

The test implicitly checks the conversion between XML and ILogEntry too.

References fileName, com::cosylab::logging::engine::log::ILogEntry::getAdditionalData(), com::cosylab::logging::engine::log::ILogEntry::getField(), com::cosylab::logging::engine::log::ILogEntry::hasDatas(), alma::acs::logging::engine::io::IOHelper::loadLogs(), logsRead, com::cosylab::logging::engine::log::ILogEntry::AdditionalData::name, numOfLogsWritten, alma::acs::logging::engine::parser::ACSLogParser::parse(), alma::acs::logging::engine::io::IOHelper::saveLogs(), specialLogs, and com::cosylab::logging::engine::log::ILogEntry::AdditionalData::value.

void alma::acs::jlog::test::LoadSaveTest::testSaveLoadIterator (  )  throws Exception [inline]

Check the load and save of logs by passing an Iterator

Exceptions:
Exception 

References bytesWritten, fileName, alma::acs::logging::engine::io::IOHelper::loadLogs(), logs, numOfLogsRead, numOfLogsWritten, and alma::acs::logging::engine::io::IOHelper::saveLogs().


Member Data Documentation

Referenced by bytesRead(), setUp(), and testSaveLoad().

The directory where the logs are read and written.

It comes form the user.dir property.

Referenced by setUp().

The name of the file used for testing compressed load and save

Referenced by setUp(), and testSaveLoadCompressed().

Initial value:
"<Trace TimeStamp=\"2008-04-14T17:53:22.445\" SourceObject=\"CONTROL/ACC/cppContainer-GL\" "+
        "File=\"Unavailable\" Line=\"0\" Routine=\"\" Host=\"gas01\" Process=\"CONTROL/ACC/cppContainer\" "+
        "Context=\"\" Thread=\"CONTROL/Array002/DELAYSERVERServiceThread\">"+
        "<![CDATA[AlarmSupplier::publishEvent()\n"+
    "About to send XML of:\n"+
    "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"+
    "<ASI-message xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" backup=\"false\" version=\"0.9\" xsi:type=\"ASI-message\">\n"+
        "<source-name>ALARM_SYSTEM_SOURCES</source-name>\n"+
        "<source-hostname>gas01</source-hostname>\n"+
        "<source-timestamp seconds=\"1208195602\" microseconds=\"433703\"/>\n"+
        "<fault-states>\n"+
        "<fault-state family=\"DelayServer\" member=\"CONTROL/Array002\" code=\"1\">\n"+
        "<descriptor>TERMINATE</descriptor>\n"+
        "<user-timestamp seconds=\"1208195602\" microseconds=\"433103\"/>\n"+
        "</fault-state>\n"+
        "</fault-states>\n"+
        "</ASI-message>\n"+
        "]]></Trace>\n"
Initial value:
 "<Warning TimeStamp=\"2005-12-13T15:09:12.041\" SourceObject=\"ARCHIVE_MASTER_COMP\" " +
        "File=\"alma.ACS.MasterComponentImpl.MasterComponentImplBase\"  "+
        "Line=\"164\" Routine=\"doTransition\" Host=\"gas\" Process=\"LoggerName: alma.component.ARCHIVE_MASTER_COMP\" "+
        "Thread=\"RequestProcessor-10\" StackId=\"unknown\" StackLevel=\"0\" LogId=\"140\">"+
        "<![CDATA[Illegal event.]]><Data Name=\"LoggedException\">alma.acs.genfw.runtime.sm.AcsStateIllegalEventException: illegal event 'initPass1' in state 'ONLINE'.\n"+
        "at alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.illegalEvent(AlmaSubsystemContext.java:248)\n"+
    "at alma.ACS.MasterComponentImpl.statemachine.AvailableSubStateAbstract.initPass1(AvailableSubStateAbstract.java:30)\n"+
    "at alma.ACS.MasterComponentImpl.statemachine.AvailableState.initPass1(AvailableState.java:60)\n"+
    "at alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.initPass1(AlmaSubsystemContext.java:135)\n"+
    "at alma.ACS.MasterComponentImpl.MasterComponentImplBase.doTransition(MasterComponentImplBase.java:134)\n"+
    "at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n"+
    "at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\n"+
    "at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\n"+
    "at java.lang.reflect.Method.invoke(Method.java:324)\n"+
    "at alma.acs.container.ContainerSealant.invoke(ContainerSealant.java:134)\n"+
    "at $Proxy0.doTransition(Unknown Source)\n"+
    "at alma.archive.ArchiveSubsystemMasterIFPOATie.doTransition(ArchiveSubsystemMasterIFPOATie.java:63)\n"+
    "at alma.archive.ArchiveSubsystemMasterIFPOA._invoke(ArchiveSubsystemMasterIFPOA.java:76)\n"+
    "at org.jacorb.poa.RequestProcessor.invokeOperation(Unknown Source)\n"+
    "at org.jacorb.poa.RequestProcessor.process(Unknown Source)\n"+
    "at org.jacorb.poa.RequestProcessor.run(Unknown Source)\n"+
    "</Data></Warning>"
final int alma::acs::jlog::test::LoadSaveTest::NUMBER_OF_LOGS = 1500 [static, private]

The number of logs in logs to load/save

Referenced by setUp().

The number of logs read since the beginning of a load

Referenced by logsRead(), setUp(), testAppend(), testSaveLoad(), testSaveLoadCompressed(), and testSaveLoadIterator().

The number of logs read since the beginning of a load

Referenced by logsWritten(), testSaveLoad(), testSaveLoadCompressed(), testSaveLoadFields(), and testSaveLoadIterator().

final String alma::acs::jlog::test::LoadSaveTest::USER_DIR = "user.dir" [static, private]

Referenced by setUp().


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

Generated by  doxygen 1.6.2