Asterisk - The Open Source Telephony Project
18.5.0
|
Call Parking Unit Tests. More...
#include "asterisk.h"
#include "res_parking.h"
#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/astobj2.h"
#include "asterisk/test.h"
#include "asterisk/stringfields.h"
#include "asterisk/time.h"
#include "asterisk/causes.h"
#include "asterisk/pbx.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Macros | |
#define | CHANNEL_TECH_NAME "ParkingTestChannel" |
#define | TEST_CATEGORY "/res/parking/" |
#define | TEST_LOT_NAME "unit_tests_res_parking_test_lot" |
Functions | |
AST_TEST_DEFINE (create_lot) | |
AST_TEST_DEFINE (park_call) | |
AST_TEST_DEFINE (retrieve_call) | |
AST_TEST_DEFINE (park_extensions) | |
AST_TEST_DEFINE (extension_conflicts) | |
AST_TEST_DEFINE (dynamic_parking_variables) | |
static int | check_retrieve_call_extensions (struct ast_test *test, int expected) |
static struct ast_channel * | create_alice_channel (void) |
Create a test_cdr_chan_tech for Alice. More... | |
static int | dispose_test_lot (struct parking_lot *test_lot, int expect_destruction) |
static void | do_sleep (struct timespec *to_sleep) |
static struct parking_lot * | generate_test_parking_lot (const char *name, int low_space, int high_space, const char *park_exten, const char *park_context, struct ast_test *test) |
static struct ast_channel * | hangup_channel (struct ast_channel *chan, int hangup_cause) |
Hang up a test channel safely. More... | |
int | load_parking_tests (void) |
Register parking unit tests. More... | |
static int | parked_users_match (const struct parked_user *actual, const struct parked_user *expected, struct ast_test *test) |
static int | parking_lot_cfgs_match (const struct parking_lot_cfg *actual, const struct parking_lot_cfg *expected, struct ast_test *test) |
static struct ast_frame * | parking_test_read (struct ast_channel *chan) |
static int | parking_test_write (struct ast_channel *chan, struct ast_frame *frame) |
static void | safe_channel_release (struct ast_channel *chan) |
static int | set_test_formats (struct ast_channel *chan) |
Set ulaw format on the channel. More... | |
void | unload_parking_tests (void) |
Unregister parking unit tests. More... | |
Variables | |
static const struct ast_party_caller | alice_callerid |
static const struct ast_channel_tech | parking_test_tech |
Call Parking Unit Tests.
Definition in file parking_tests.c.
#define CHANNEL_TECH_NAME "ParkingTestChannel" |
Definition at line 43 of file parking_tests.c.
Referenced by create_alice_channel().
#define TEST_CATEGORY "/res/parking/" |
Definition at line 41 of file parking_tests.c.
Referenced by AST_TEST_DEFINE().
#define TEST_LOT_NAME "unit_tests_res_parking_test_lot" |
Definition at line 138 of file parking_tests.c.
Referenced by AST_TEST_DEFINE().
AST_TEST_DEFINE | ( | create_lot | ) |
Definition at line 189 of file parking_tests.c.
References ao2_cleanup, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, dispose_test_lot(), generate_test_parking_lot(), sip_to_pjsip::info(), NULL, parking_lot_find_by_name(), RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and TEST_LOT_NAME.
AST_TEST_DEFINE | ( | park_call | ) |
Definition at line 234 of file parking_tests.c.
References ao2_cleanup, ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, ast_channel_name(), ast_channel_state_set(), AST_STATE_UP, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, create_alice_channel(), dispose_test_lot(), do_sleep(), generate_test_parking_lot(), hangup_channel(), sip_to_pjsip::info(), NULL, park_application_setup(), parking_lot::parking_bridge, pbx_builtin_setvar_helper(), RAII_VAR, safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and TEST_LOT_NAME.
AST_TEST_DEFINE | ( | retrieve_call | ) |
Definition at line 376 of file parking_tests.c.
References ao2_cleanup, ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, ast_channel_name(), ast_channel_state_set(), AST_STATE_UP, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, create_alice_channel(), dispose_test_lot(), do_sleep(), generate_test_parking_lot(), hangup_channel(), sip_to_pjsip::info(), NULL, PARK_ANSWERED, park_application_setup(), parked_users_match(), parking_lot_retrieve_parked_user(), parked_user::parking_space, pbx_builtin_setvar_helper(), RAII_VAR, safe_channel_release(), TEST_CATEGORY, test_cleanup(), TEST_EXECUTE, TEST_INIT, and TEST_LOT_NAME.
AST_TEST_DEFINE | ( | park_extensions | ) |
Definition at line 524 of file parking_tests.c.
References ao2_cleanup, ast_log, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, check_retrieve_call_extensions(), dispose_test_lot(), generate_test_parking_lot(), sip_to_pjsip::info(), LOG_ERROR, NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and TEST_LOT_NAME.
AST_TEST_DEFINE | ( | extension_conflicts | ) |
Definition at line 570 of file parking_tests.c.
References ao2_cleanup, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, cleanup(), dispose_test_lot(), generate_test_parking_lot(), sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and TEST_LOT_NAME.
AST_TEST_DEFINE | ( | dynamic_parking_variables | ) |
Definition at line 735 of file parking_tests.c.
References ao2_cleanup, ast_string_field_set, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, cleanup(), create_alice_channel(), dispose_test_lot(), generate_test_parking_lot(), sip_to_pjsip::info(), NULL, parking_create_dynamic_lot_forced(), parking_lot_cfg_create(), parking_lot_cfgs_match(), pbx_builtin_setvar_helper(), RAII_VAR, safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and TEST_LOT_NAME.
|
static |
Definition at line 471 of file parking_tests.c.
References ast_get_extension_app(), ast_test_status_update, E_MATCH, extens, NULL, pbx_find_extension(), and pbx_find_info::stacklen.
Referenced by AST_TEST_DEFINE().
|
static |
Create a test_cdr_chan_tech for Alice.
Definition at line 91 of file parking_tests.c.
References ast_channel_alloc, ast_channel_release(), ast_channel_set_caller(), ast_channel_tech_set(), ast_channel_unlock, AST_STATE_DOWN, CHANNEL_TECH_NAME, NULL, and set_test_formats().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 173 of file parking_tests.c.
References ao2_cleanup, parking_lot::mode, parking_lot::name, NULL, parking_lot_find_by_name(), parking_lot_remove_if_unused(), PARKINGLOT_DISABLED, and RAII_VAR.
Referenced by AST_TEST_DEFINE().
|
static |
|
static |
Definition at line 140 of file parking_tests.c.
References ao2_cleanup, ast_string_field_set, ast_test_status_update, NULL, parking_lot_build_or_update(), parking_lot_cfg_create(), parking_lot_cfg_create_extensions(), and RAII_VAR.
Referenced by AST_TEST_DEFINE().
|
static |
Hang up a test channel safely.
Definition at line 117 of file parking_tests.c.
References ast_channel_hangupcause_set(), ast_hangup(), and NULL.
Referenced by AST_TEST_DEFINE().
int load_parking_tests | ( | void | ) |
Register parking unit tests.
0 | on success |
nonzero | on failure |
Definition at line 851 of file parking_tests.c.
References AST_TEST_REGISTER.
Referenced by load_module().
|
static |
Definition at line 301 of file parking_tests.c.
References ast_test_status_update, parked_user::parker_dial_string, parked_user::parking_space, parked_user::resolution, and parked_user::time_limit.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 326 of file parking_tests.c.
References ast_test_status_update, parking_lot_cfg::comebackcontext, parking_lot_cfg::comebackdialtime, parking_lot_cfg::parkext, parking_lot_cfg::parkext_exclusive, parking_lot_cfg::parkfindnext, parking_lot_cfg::parking_con, parking_lot_cfg::parking_start, parking_lot_cfg::parking_stop, and parking_lot_cfg::parkingtime.
Referenced by AST_TEST_DEFINE().
|
static |
|
static |
Definition at line 52 of file parking_tests.c.
|
static |
Definition at line 124 of file parking_tests.c.
References ast_channel_release().
Referenced by AST_TEST_DEFINE().
|
static |
Set ulaw format on the channel.
Definition at line 70 of file parking_tests.c.
References ao2_ref, ast_channel_nativeformats_set(), ast_channel_set_rawreadformat(), ast_channel_set_rawwriteformat(), ast_channel_set_readformat(), ast_channel_set_writeformat(), ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, and ast_format_ulaw.
Referenced by create_alice_channel().
void unload_parking_tests | ( | void | ) |
Unregister parking unit tests.
Definition at line 838 of file parking_tests.c.
References AST_TEST_UNREGISTER.
Referenced by unload_module().
|
static |
Definition at line 45 of file parking_tests.c.
|
static |
Definition at line 62 of file parking_tests.c.