Asterisk - The Open Source Telephony Project  21.4.1
Data Structures | Macros | Functions | Variables
test_stasis.c File Reference

Test Stasis message bus. More...

#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/module.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/test.h"

Go to the source code of this file.

Data Structures

struct  cache_test_data
 
struct  consumer
 
struct  cts
 
struct  test_message_types
 

Macros

#define test_category   "/stasis/core/"
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
 AST_TEST_DEFINE (message_type)
 
 AST_TEST_DEFINE (message)
 
 AST_TEST_DEFINE (subscription_messages)
 
 AST_TEST_DEFINE (subscription_pool_messages)
 
 AST_TEST_DEFINE (publish)
 
 AST_TEST_DEFINE (publish_sync)
 
 AST_TEST_DEFINE (publish_pool)
 
 AST_TEST_DEFINE (unsubscribe_stops_messages)
 
 AST_TEST_DEFINE (forward)
 
 AST_TEST_DEFINE (interleaving)
 
 AST_TEST_DEFINE (subscription_interleaving)
 
 AST_TEST_DEFINE (cache_filter)
 
 AST_TEST_DEFINE (cache)
 
 AST_TEST_DEFINE (cache_dump)
 
 AST_TEST_DEFINE (cache_eid_aggregate)
 
 AST_TEST_DEFINE (router)
 
 AST_TEST_DEFINE (router_pool)
 
 AST_TEST_DEFINE (router_cache_updates)
 
 AST_TEST_DEFINE (no_to_json)
 
 AST_TEST_DEFINE (to_json)
 
 AST_TEST_DEFINE (no_to_ami)
 
 AST_TEST_DEFINE (to_ami)
 
 AST_TEST_DEFINE (dtor_order)
 
 AST_TEST_DEFINE (caching_dtor_order)
 
 AST_TEST_DEFINE (type_filters)
 
 AST_TEST_DEFINE (formatter_filters)
 
 AST_TEST_DEFINE (combo_filters)
 
static const char * cache_simple (struct stasis_message *message)
 
static struct stasis_messagecache_test_aggregate_calc_fn (struct stasis_cache_entry *entry, struct stasis_message *new_snapshot)
 
static void cache_test_aggregate_publish_fn (struct stasis_topic *topic, struct stasis_message *aggregate)
 
static void cache_test_data_dtor (void *obj)
 
static const char * cache_test_data_id (struct stasis_message *message)
 
static struct stasis_messagecache_test_message_create (struct stasis_message_type *type, const char *name, const char *value)
 
static struct stasis_messagecache_test_message_create_full (struct stasis_message_type *type, const char *name, const char *value, struct ast_eid *eid)
 
static int check_cache_aggregate (struct stasis_cache *cache, struct stasis_message_type *cache_type, const char *id, const char *value)
 
static struct consumerconsumer_create (int ignore_subscriptions)
 
static void consumer_dtor (void *obj)
 
static void consumer_exec (void *data, struct stasis_subscription *sub, struct stasis_message *message)
 
static void consumer_exec_sync (void *data, struct stasis_subscription *sub, struct stasis_message *message)
 
static int consumer_should_stay (struct consumer *consumer, size_t expected_len)
 
static int consumer_wait_for (struct consumer *consumer, size_t expected_len)
 
static int consumer_wait_for_completion (struct consumer *consumer)
 
static struct ctscreate_cts (struct ast_test *test)
 
static struct test_message_typescreate_message_types (struct ast_test *test)
 
static void destroy_cts (void *obj)
 
static void destroy_message_types (void *obj)
 
static void dump_consumer (struct ast_test *test, struct cts *cts)
 
static struct ast_manager_event_blobfake_ami (struct stasis_message *message)
 
static struct ast_eventfake_event (struct stasis_message *message)
 
static struct ast_jsonfake_json (struct stasis_message *message, const struct stasis_message_sanitizer *sanitize)
 
static int is_msg (struct stasis_message *msg, struct stasis_message_type *mtype, const char *data)
 
static int load_module (void)
 
static void noop (void *data, struct stasis_subscription *sub, struct stasis_message *message)
 
static const char * noop_get_id (struct stasis_message *message)
 
static int send_msg (struct ast_test *test, struct cts *cts, struct stasis_message_type *msg_type, const char *data)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = 0 , .description = "Stasis testing" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct stasis_message_vtable fake_vtable
 

Detailed Description

Test Stasis message bus.

Author
David M. Lee, II <dlee@digium.com> 

Definition in file test_stasis.c.

Variable Documentation

struct stasis_message_vtable fake_vtable
static
Initial value:
= {
.to_json = fake_json,
.to_ami = fake_ami
}

Definition at line 72 of file test_stasis.c.