raccoon.tibco.tibrv.uitest
Class TibrvRecorder

java.lang.Object
  extended by raccoon.core.types.AbsComponent
      extended by raccoon.core.types.AbsLoadable
          extended by raccoon.core.types.AbsConfigurableLoadable
              extended by raccoon.tibco.tibrv.uitest.TibrvRecorder
All Implemented Interfaces:
IUnitRecorder, IBaseComponent, IConfigurable, ILoadable, ILogable

public class TibrvRecorder
extends AbsConfigurableLoadable
implements IUnitRecorder

Records all the messages found on the messaging layer for TIB/Rendezvous.

Since:
Raccoon v0.7
Version:
$Id: TibrvRecorder.java,v 1.3 2003/07/01 19:21:00 crouvrais Exp $
Author:
Cedric ROUVRAIS

Field Summary
 
Fields inherited from class raccoon.core.types.AbsConfigurableLoadable
mConfigurableManager
 
Fields inherited from class raccoon.core.types.AbsLoadable
mIsLoaded
 
Fields inherited from class raccoon.core.types.AbsComponent
mIsInError
 
Fields inherited from interface raccoon.api.eai.uitest.IUnitRecorder
RECORDING_CHANNEL
 
Constructor Summary
TibrvRecorder()
          Default constructor, required for dynamic instanciation
 
Method Summary
 void addRecordingChannel(ComponentFile pRecordingChannel)
          Adds a new recording channel to the list of current recording channels.
 void configureParameters()
          Configures the various parameters for this component.
 IFactory getFactory()
          Retrieves the factory instance used to instanciate empty message objects.
protected  ILogger getLog()
          The logger in use by this component.
 int getNbDispatchers()
          The number of threads assigned to this recorder.
 long getNbOfMsgsRecorded()
          The number of messages recorded.
 java.util.Map getRecordedMsgs()
          Retrieves all the retrieved messages during the recording process.
 int getRecorderId()
          The recorder id, valid only in UiTest scenario.
 java.util.ArrayList getRecordingChannels()
          The list of channels that are being monitored
 IXmlToMessage getXmlParser()
          The message to xml parser.
 void incNbMsgRecorded()
          Invoked on each received event.
 boolean isRecording()
          State of the recorder.
 void load()
          Invoked by the service manager to start this component once it has been configured.
 IMessage loadMessage(org.xml.sax.InputSource pSource)
          Converts the contents of an XML input source into a valid message.
 IComparator newComparator()
          Creates a message comparator for this recorder
 void setFactory(IFactory pFactory)
          Assigns the IFactory used to instanciate empty message objects.
 void setNbDispatchers(int pNbDispatchers)
          Assigns the number of threads for this recorder
 void setRecorderId(int pRecorderId)
          Assigns the id of this recorder within the contexte of an UiTest scenario.
 void setRecordingChannels(java.util.ArrayList pRecordingChannels)
          Sets the channels from which to record events.
 void setXmlParser(IXmlToMessage pXmlParser)
          Defines the message to xml parser to use.
 int startRecording()
          Starts the recorder.
 long stopRecording()
          Stops the recorder.
 
Methods inherited from class raccoon.core.types.AbsConfigurableLoadable
isStable, setConfigurableManager, setLogger
 
Methods inherited from class raccoon.core.types.AbsLoadable
isInError, isInitialised, isRunning, unload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TibrvRecorder

public TibrvRecorder()
Default constructor, required for dynamic instanciation

Method Detail

configureParameters

public void configureParameters()
Configures the various parameters for this component. This method should configure the instance of IConfigurableManager provided during the invocation of AbsConfigurableLoadable.setConfigurableManager(raccoon.api.types.IConfigurableManager).

Specified by:
configureParameters in interface IConfigurable
Overrides:
configureParameters in class AbsConfigurableLoadable

getLog

protected ILogger getLog()
The logger in use by this component.

Overrides:
getLog in class AbsLoadable
Returns:
the logger

newComparator

public IComparator newComparator()
Creates a message comparator for this recorder

Specified by:
newComparator in interface IUnitRecorder
Returns:
the comparator

getNbDispatchers

public int getNbDispatchers()
The number of threads assigned to this recorder.

Returns:
the number of threads.

setNbDispatchers

public void setNbDispatchers(int pNbDispatchers)
Assigns the number of threads for this recorder

Parameters:
pNbDispatchers - the number of threads.

getRecorderId

public int getRecorderId()
The recorder id, valid only in UiTest scenario.

In a none test scenario the value returned should be zero, otherwise it should indicate the ID of this recorder.

Specified by:
getRecorderId in interface IUnitRecorder
Returns:
the recorder id, should be unique and none zero.

setRecorderId

public void setRecorderId(int pRecorderId)
Assigns the id of this recorder within the contexte of an UiTest scenario.

Specified by:
setRecorderId in interface IUnitRecorder
Parameters:
pRecorderId - the id of this recorder.

getFactory

public IFactory getFactory()
Retrieves the factory instance used to instanciate empty message objects.

Returns:
the IFactory instance used

setFactory

public void setFactory(IFactory pFactory)
                throws RaccoonException,
                       java.lang.IllegalArgumentException
Assigns the IFactory used to instanciate empty message objects.

Parameters:
pFactory - the factory instance to use.
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)

getXmlParser

public IXmlToMessage getXmlParser()
The message to xml parser.

Returns:
the implementation of IXmlToMessage used.

setXmlParser

public void setXmlParser(IXmlToMessage pXmlParser)
                  throws RaccoonException,
                         java.lang.IllegalArgumentException
Defines the message to xml parser to use.

Parameters:
pXmlParser - the utility to convert TIB/Rendezvous messages into an XML String.
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)

isRecording

public boolean isRecording()
State of the recorder.

Specified by:
isRecording in interface IUnitRecorder
Returns:
true if the recorder is still recording.

startRecording

public int startRecording()
                   throws RaccoonException
Starts the recorder.

Specified by:
startRecording in interface IUnitRecorder
Returns:
the number of monitored topics.
Throws:
RaccoonException - if one the recorders couldn't be started.

stopRecording

public long stopRecording()
                   throws RaccoonException
Stops the recorder.

Specified by:
stopRecording in interface IUnitRecorder
Returns:
the number of messages recorded by this recorder.
Throws:
RaccoonException - if one or more of the recorders couldn't be stopped.

loadMessage

public IMessage loadMessage(org.xml.sax.InputSource pSource)
                     throws RaccoonException
Converts the contents of an XML input source into a valid message.

Specified by:
loadMessage in interface IUnitRecorder
Parameters:
pSource - the xml input source (usually generated by this recorder)
Returns:
the message corresponding to the input source.
Throws:
RaccoonException - if the xml input source is invalid.

getNbOfMsgsRecorded

public long getNbOfMsgsRecorded()
The number of messages recorded.

Specified by:
getNbOfMsgsRecorded in interface IUnitRecorder
Returns:
the number of messages recorded by this system.

incNbMsgRecorded

public void incNbMsgRecorded()
Invoked on each received event.


setRecordingChannels

public void setRecordingChannels(java.util.ArrayList pRecordingChannels)
                          throws RaccoonException,
                                 java.lang.IllegalArgumentException
Sets the channels from which to record events.

Specified by:
setRecordingChannels in interface IUnitRecorder
Parameters:
pRecordingChannels - the channels.
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)

getRecordingChannels

public java.util.ArrayList getRecordingChannels()
The list of channels that are being monitored

Specified by:
getRecordingChannels in interface IUnitRecorder
Returns:
an ArrayList of ComponentFile

addRecordingChannel

public void addRecordingChannel(ComponentFile pRecordingChannel)
                         throws RaccoonException,
                                java.lang.IllegalArgumentException
Adds a new recording channel to the list of current recording channels.

Specified by:
addRecordingChannel in interface IUnitRecorder
Parameters:
pRecordingChannel - the new recording channel to add.
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)

load

public void load()
          throws LoadableException
Invoked by the service manager to start this component once it has been configured.

When extended bare in mind that the member variable mIsLoaded should be set to false and then set to true once all the init code has been performed.

Checks if all the required properties are set.

Specified by:
load in interface ILoadable
Overrides:
load in class AbsConfigurableLoadable
Throws:
LoadableException - if this component isn't initialisable or is already running.

getRecordedMsgs

public java.util.Map getRecordedMsgs()
                              throws java.lang.IllegalStateException
Retrieves all the retrieved messages during the recording process. The map is defined as follows:

Specified by:
getRecordedMsgs in interface IUnitRecorder
Returns:
the list of the messages.
Throws:
java.lang.IllegalStateException - if this recorder has never recorder any messages.


Copyright null null. All Rights Reserved.