ApparatusFramework::Stub< maxLogSize > Class Template Reference
[Unit-Test Services]

#include <UnitTestServices/current/include/Stub.h>

Inheritance diagram for ApparatusFramework::Stub< maxLogSize >:
ApparatusFramework::StubInterface ApparatusFramework::Monitor

List of all members.

Public Member Functions

 Stub ()
virtual ~Stub ()
const char * getNextLog (const unsigned long timeout)
void clearLog ()
void attachStubListener (StubListener *pListener)
virtual void setReturnValue (char *method, char *value)

Protected Member Functions

char * getLogBuffer ()
void notify ()

Detailed Description

template<int maxLogSize>
class ApparatusFramework::Stub< maxLogSize >

The stub class implements the basic funtionality of a stub that replaces a class for package test. A log mechanism is provided to store the method calls. The log entries can later be checked by the test suite to see if the correct calls have been made. No checks are made on the size of the log.

We also provide a generic interface that can be used to set members of a stub instance. The implementation is empty since we do not make any assumptions about the members (i.e. the getter methods) that have to be implemented by the instances of stub.

Definition at line 127 of file Stub.h.


Constructor & Destructor Documentation

template<int maxLogSize>
ApparatusFramework::Stub< maxLogSize >::Stub (  )  [inline]

constructors, destructors Constructs a new stub object.

Definition at line 210 of file Stub.h.

References ApparatusFramework::Stub< maxLogSize >::clearLog().

template<int maxLogSize>
ApparatusFramework::Stub< maxLogSize >::~Stub (  )  [inline, virtual]

Destroys the object and releases all the associated ressources.

Definition at line 216 of file Stub.h.


Member Function Documentation

template<int maxLogSize>
void ApparatusFramework::Stub< maxLogSize >::attachStubListener ( StubListener pListener  )  [inline]

Attaches a stub listener on this stub object. The stub listener is notified each time a log is written by this stub. Any existing Listener is replaced.

Parameters:
pListener pointer to the stub listener.

Definition at line 296 of file Stub.h.

template<int maxLogSize>
void ApparatusFramework::Stub< maxLogSize >::clearLog (  )  [inline, virtual]

modifiers Clears the log buffers.

Implements ApparatusFramework::StubInterface.

Definition at line 220 of file Stub.h.

References monitorEntry, monitorExit, and ApparatusFramework::NumberOfBuffers_C.

Referenced by ApparatusFramework::Stub< maxLogSize >::Stub().

template<int maxLogSize>
char * ApparatusFramework::Stub< maxLogSize >::getLogBuffer (  )  [inline, protected]

queries Returns a pointer to the next log buffer.

Returns:
pointer to the log buffer.

Definition at line 244 of file Stub.h.

References monitorEntry, monitorExitWithValue, and ApparatusFramework::NumberOfBuffers_C.

template<int maxLogSize>
const char * ApparatusFramework::Stub< maxLogSize >::getNextLog ( const unsigned long  timeout  )  [inline, virtual]

queries Returns a pointer to the current log string.

Parameters:
timeout timeout in miliseconds to wait if the log is currently empty. This value will be rounded to the next timer tick.
Returns:
const char* pointer to the log string.

Implements ApparatusFramework::StubInterface.

Definition at line 233 of file Stub.h.

References BBV_UNUSED_ARG.

template<int maxLogSize>
void ApparatusFramework::Stub< maxLogSize >::notify (  )  [inline, protected]

Signals that a new log entry is ready.

Definition at line 290 of file Stub.h.

template<int maxLogSize>
void ApparatusFramework::Stub< maxLogSize >::setReturnValue ( char *  method,
char *  value 
) [inline, virtual]

Sets a return value for a given method. Can be used by the TestSuite to force a certain response from the stub.

Parameters:
method Pointer to the string of the method, which is asked to return the given value.
value Pointer to the string that represents the new value of the member.

Definition at line 264 of file Stub.h.

References BBV_UNUSED_ARG.

© 2004-2010 bbv Software Services AG / Apparatus Services