BLPAPI C++  3.21.0
TestUtil Class Reference

#include <blpapi_testutil.h>

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.

See Component blpapi_testutil

Member Typedef Documentation

◆ MessageProperties

Member Function Documentation

◆ appendMessage()

MessageFormatter 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.

◆ createEvent()

Event 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.

◆ createTopic()

Topic 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.

◆ deserializeService()

Service 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.

◆ getAdminMessageDefinition()

SchemaElementDefinition getAdminMessageDefinition ( const Name messageName)
static

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

◆ serializeService()

void serializeService ( std::ostream &  stream,
const Service service 
)
static

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


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