Public Types | Static Public Member Functions

blpapi::test::TestUtil Class Reference

#include <blpapi_testutil.h>

List of all members.

Public Types

typedef test::MessageProperties MessageProperties

Static Public Member Functions

static Event createEvent (Event::EventType eventType)
static MessageFormatter appendMessage (Event &event, const SchemaElementDefinition &elementDef, const MessageProperties &properties=MessageProperties())
static Service deserializeService (std::istream &stream)
static void serializeService (std::ostream &stream, const Service &service)
static Topic createTopic (const Service &service, bool isActive=true)
static SchemaElementDefinition getAdminMessageDefinition (const Name &messageName)

Detailed Description

This class provides a set of utility functions to allow SDK clients to create events/messages for unit-testing their applications.


Member Typedef Documentation


Member Function Documentation

static Event blpapi::test::TestUtil::createEvent ( Event::EventType  eventType  )  [static]

Creates and returns an Event to be used for testing with the specified eventType. The returned Event cannot be used for publishing. The behavior is undefined if EventFormatter is used with the returned Event.

static MessageFormatter blpapi::test::TestUtil::appendMessage ( Event event,
const SchemaElementDefinition elementDef,
const MessageProperties properties = MessageProperties() 
) [static]

Creates a new message and appends it to the specified event. Returns a MessageFormatter to format the last appended message. The specified event must be a test Event created from TestUtil::createEvent(). elementDef is used to verify and encode the contents of the message and the specified properties are used to set the metadata properties for the message. An exception is thrown if the method fails to append the message.

static Service blpapi::test::TestUtil::deserializeService ( std::istream &  stream  )  [static]

Creates a Service object from the specified stream. The format of the stream must be XML. The stream should only contain ASCII characters without any embedded null characters. Returns the Service object on success or throws blpapi::Exception on failure.

static void blpapi::test::TestUtil::serializeService ( std::ostream &  stream,
const Service service 
) [static]

Serialize the specific service into the specified stream in XML format. An exception is thrown if the service can't be serialized successfully.

static Topic blpapi::test::TestUtil::createTopic ( const Service service,
bool  isActive = true 
) [static]

Create a valid Topic with the specified service to support testing publishers. The expected use case is to support returning a custom Topic while mocking `session.getTopic()` methods.

static SchemaElementDefinition blpapi::test::TestUtil::getAdminMessageDefinition ( const Name messageName  )  [static]

Return the definition for an admin message of the specified messageName.


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