Asterisk - The Open Source Telephony Project GIT-master-a63eec2
|
Tests for the HTTP media cache backend. More...
#include "asterisk.h"
#include <fcntl.h>
#include "asterisk/module.h"
#include "asterisk/http.h"
#include "asterisk/bucket.h"
#include "asterisk/test.h"
Go to the source code of this file.
Data Structures | |
struct | test_options |
Macros | |
#define | CATEGORY "/res/http_media_cache/" |
#define | SET_OR_APPEND_CACHE_CONTROL(str) |
#define | TEST_URI "test_media_cache" |
#define | VALIDATE_EXPIRES(test, bucket_file, expected, delta) |
#define | VALIDATE_STR_METADATA(test, bucket_file, key, expected) |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (create_nominal) | |
AST_TEST_DEFINE (retrieve_cache_control_age) | |
AST_TEST_DEFINE (retrieve_cache_control_directives) | |
AST_TEST_DEFINE (retrieve_content_type) | |
AST_TEST_DEFINE (retrieve_etag) | |
AST_TEST_DEFINE (retrieve_etag_expired) | |
AST_TEST_DEFINE (retrieve_expires) | |
AST_TEST_DEFINE (retrieve_nominal) | |
AST_TEST_DEFINE (retrieve_parsed_uri) | |
static void | bucket_file_cleanup (void *obj) |
static int | http_callback (struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers) |
static int | load_module (void) |
static int | pre_test_cb (struct ast_test_info *info, struct ast_test *test) |
static int | process_config (int reload) |
static int | reload_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "HTTP Media Cache Backend Tests" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .reload = reload_module, .unload = unload_module, .requires = "res_http_media_cache", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct test_options | options |
static char | server_uri [512] |
static struct ast_http_uri | test_uri |
Tests for the HTTP media cache backend.
Definition in file test_http_media_cache.c.
#define CATEGORY "/res/http_media_cache/" |
Definition at line 44 of file test_http_media_cache.c.
#define SET_OR_APPEND_CACHE_CONTROL | ( | str | ) |
Definition at line 84 of file test_http_media_cache.c.
#define TEST_URI "test_media_cache" |
Definition at line 46 of file test_http_media_cache.c.
#define VALIDATE_EXPIRES | ( | test, | |
bucket_file, | |||
expected, | |||
delta | |||
) |
Definition at line 67 of file test_http_media_cache.c.
#define VALIDATE_STR_METADATA | ( | test, | |
bucket_file, | |||
key, | |||
expected | |||
) |
Definition at line 78 of file test_http_media_cache.c.
|
static |
Definition at line 779 of file test_http_media_cache.c.
|
static |
Definition at line 779 of file test_http_media_cache.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 779 of file test_http_media_cache.c.
AST_TEST_DEFINE | ( | create_nominal | ) |
Definition at line 647 of file test_http_media_cache.c.
References ast_bucket_file_alloc(), ast_bucket_file_create(), ast_bucket_file_temporary_create(), AST_TEST_NOT_RUN, AST_TEST_PASS, ast_tvnow(), bucket_file_cleanup(), CATEGORY, NULL, options, RAII_VAR, test_options::send_file, server_uri, test_options::status_code, test_options::status_text, TEST_EXECUTE, TEST_INIT, and VALIDATE_EXPIRES.
AST_TEST_DEFINE | ( | retrieve_cache_control_age | ) |
Definition at line 379 of file test_http_media_cache.c.
References ast_bucket_file_is_stale(), ast_bucket_file_retrieve(), AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), bucket_file_cleanup(), test_options::cache_control, CATEGORY, test_options::expires, test_options::maxage, NULL, options, RAII_VAR, test_options::s_maxage, test_options::send_file, server_uri, test_options::status_code, test_options::status_text, TEST_EXECUTE, TEST_INIT, and VALIDATE_EXPIRES.
AST_TEST_DEFINE | ( | retrieve_cache_control_directives | ) |
Definition at line 297 of file test_http_media_cache.c.
References ast_bucket_file_is_stale(), ast_bucket_file_retrieve(), AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), bucket_file_cleanup(), test_options::cache_control, CATEGORY, test_options::etag, test_options::maxage, test_options::must_revalidate, test_options::no_cache, NULL, options, RAII_VAR, test_options::send_file, server_uri, test_options::status_code, test_options::status_text, TEST_EXECUTE, TEST_INIT, and VALIDATE_EXPIRES.
AST_TEST_DEFINE | ( | retrieve_content_type | ) |
Definition at line 228 of file test_http_media_cache.c.
References ast_bucket_file_retrieve(), ast_sorcery_object_get_id(), ast_strlen_zero(), AST_TEST_NOT_RUN, AST_TEST_PASS, bucket_file_cleanup(), CATEGORY, test_options::content_type, NULL, options, RAII_VAR, test_options::send_file, server_uri, test_options::status_code, test_options::status_text, TEST_EXECUTE, TEST_INIT, and VALIDATE_STR_METADATA.
AST_TEST_DEFINE | ( | retrieve_etag | ) |
Definition at line 571 of file test_http_media_cache.c.
References ast_bucket_file_is_stale(), ast_bucket_file_retrieve(), ast_sorcery_object_get_id(), ast_strlen_zero(), AST_TEST_NOT_RUN, AST_TEST_PASS, ast_tvnow(), bucket_file_cleanup(), CATEGORY, test_options::etag, NULL, options, RAII_VAR, test_options::send_file, server_uri, test_options::status_code, test_options::status_text, TEST_EXECUTE, TEST_INIT, VALIDATE_EXPIRES, and VALIDATE_STR_METADATA.
AST_TEST_DEFINE | ( | retrieve_etag_expired | ) |
Definition at line 480 of file test_http_media_cache.c.
References ast_bucket_file_is_stale(), ast_bucket_file_retrieve(), ast_sorcery_object_get_id(), ast_strlen_zero(), AST_TEST_NOT_RUN, AST_TEST_PASS, ast_tvnow(), bucket_file_cleanup(), CATEGORY, test_options::etag, test_options::expires, NULL, options, RAII_VAR, test_options::send_file, server_uri, test_options::status_code, test_options::status_text, TEST_EXECUTE, TEST_INIT, VALIDATE_EXPIRES, and VALIDATE_STR_METADATA.
AST_TEST_DEFINE | ( | retrieve_expires | ) |
Definition at line 521 of file test_http_media_cache.c.
References ast_bucket_file_is_stale(), ast_bucket_file_retrieve(), ast_sorcery_object_get_id(), ast_strlen_zero(), AST_TEST_NOT_RUN, AST_TEST_PASS, ast_tvnow(), bucket_file_cleanup(), CATEGORY, test_options::expires, NULL, options, RAII_VAR, test_options::send_file, server_uri, test_options::status_code, test_options::status_text, TEST_EXECUTE, TEST_INIT, and VALIDATE_EXPIRES.
AST_TEST_DEFINE | ( | retrieve_nominal | ) |
Definition at line 614 of file test_http_media_cache.c.
References ast_bucket_file_retrieve(), ast_sorcery_object_get_id(), ast_strlen_zero(), AST_TEST_NOT_RUN, AST_TEST_PASS, ast_tvnow(), bucket_file_cleanup(), CATEGORY, NULL, options, RAII_VAR, test_options::send_file, server_uri, test_options::status_code, test_options::status_text, TEST_EXECUTE, TEST_INIT, and VALIDATE_EXPIRES.
AST_TEST_DEFINE | ( | retrieve_parsed_uri | ) |
Definition at line 263 of file test_http_media_cache.c.
References ast_bucket_file_retrieve(), ast_sorcery_object_get_id(), ast_strlen_zero(), AST_TEST_NOT_RUN, AST_TEST_PASS, bucket_file_cleanup(), CATEGORY, NULL, options, RAII_VAR, test_options::send_file, server_uri, test_options::status_code, test_options::status_text, TEST_EXECUTE, TEST_INIT, and VALIDATE_STR_METADATA.
|
static |
Definition at line 218 of file test_http_media_cache.c.
References ao2_ref, and ast_bucket_file_delete().
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), and AST_TEST_DEFINE().
|
static |
Definition at line 92 of file test_http_media_cache.c.
References ast_free, ast_http_error(), AST_HTTP_GET, ast_http_request_close_on_completion(), ast_http_send(), ast_localtime(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_strlen(), ast_strftime(), ast_strlen_zero(), buf, test_options::cache_control, test_options::content_type, errno, error(), test_options::etag, test_options::expires, LOG_ERROR, test_options::maxage, method, test_options::must_revalidate, ast_variable::name, ast_variable::next, test_options::no_cache, NULL, options, test_options::s_maxage, test_options::send_file, SET_OR_APPEND_CACHE_CONTROL, test_options::status_code, test_options::status_text, and ast_variable::value.
|
static |
Definition at line 729 of file test_http_media_cache.c.
References ast_http_uri_link(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_TEST_REGISTER, CATEGORY, pre_test_cb(), process_config(), and test_uri.
|
static |
Definition at line 211 of file test_http_media_cache.c.
References options.
Referenced by load_module().
|
static |
Definition at line 681 of file test_http_media_cache.c.
References ast_config_destroy(), ast_config_load, ast_config_option(), ast_false(), bindaddr, config, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, enabled, prefix, reload(), S_OR, server_uri, and TEST_URI.
Referenced by load_module(), and reload_module().
|
static |
Definition at line 724 of file test_http_media_cache.c.
References process_config().
|
static |
Definition at line 755 of file test_http_media_cache.c.
References ast_http_uri_unlink(), AST_TEST_UNREGISTER, and test_uri.
|
static |
Definition at line 779 of file test_http_media_cache.c.
|
static |
Definition at line 779 of file test_http_media_cache.c.
|
static |
Definition at line 63 of file test_http_media_cache.c.
Referenced by __ao2_alloc(), __ast_sorcery_apply_config(), __ssl_setup(), aeap_cli_show(), agent_connect_caller(), agent_login_exec(), app_exec(), app_exec(), app_exec(), apply_options(), aqm_exec(), ast_app_options2str64(), ast_app_parse_options(), ast_app_parse_options64(), ast_ari_bridges_record(), ast_ari_channels_record(), ast_cdr_fork(), ast_fax_maxrate(), ast_fax_minrate(), ast_get_enum(), ast_multicast_rtp_create_options(), ast_rtp_codecs_payloads_set_rtpmap_type(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), ast_rtp_lookup_mime_multiple2(), ast_rtp_lookup_mime_subtype2(), ast_say_enumeration(), ast_say_enumeration_full_da(), ast_say_enumeration_full_de(), ast_say_enumeration_full_he(), ast_say_enumeration_full_is(), ast_say_number(), ast_say_number_full_cs(), ast_say_number_full_da(), ast_say_number_full_de(), ast_say_number_full_es(), ast_say_number_full_fr(), ast_say_number_full_he(), ast_say_number_full_is(), ast_say_number_full_no(), ast_say_number_full_pl(), ast_say_number_full_pt(), ast_say_number_full_ru(), ast_say_number_full_se(), ast_say_number_full_ur(), ast_say_ordinal(), ast_smdi_md_message_wait(), ast_smdi_mwi_message_wait(), ast_smdi_mwi_message_wait_station(), ast_sorcery_init(), ast_start_mixmonitor(), ast_taskpool_create(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), ast_threadpool_create(), ast_websocket_client_connect(), ast_websocket_client_create(), ast_websocket_client_create_with_options(), audiosocket_request(), auth_exec(), bridge_exec(), bridgewait_exec(), broadcast_exec(), cdr_prop_write_callback(), cdr_read_callback(), cdr_write(), cdr_write_callback(), chanavail_exec(), chanspy_exec(), cli_fax_show_settings(), conf_exec(), config_object_cli_show(), controlplayback_exec(), detect_write(), dial_exec_full(), directory_exec(), disa_exec(), do_say(), dundi_query_read(), dundifunc_read(), enable_jack_hook(), extenspy_exec(), feature_automixmonitor(), file_read(), file_write(), forkcdr_exec(), function_enum(), g722_decode_init(), g722_encode_init(), generate_rtpmap_attr(), generate_rtpmap_attr2(), geoloc_profile_read(), geoloc_profile_write(), get_codecs(), get_general_options(), handle_cli_presencestate_change(), handle_cli_presencestate_list(), handle_cli_taskpool_push_efficiency(), handle_cli_taskpool_push_serializer_efficiency(), handle_cli_threadpool_push_efficiency(), handle_cli_threadpool_push_serializer_efficiency(), handle_options(), handle_updates(), hash_ao2_container_init(), hash_ao2_insert_node(), hint_read(), http_callback(), internal_ao2_alloc(), json_decode_read(), leave_voicemail(), leave_voicemail(), load_module(), manager_mixmonitor(), milliwatt_exec(), mixmonitor_exec(), multicast_rtp_request(), originate_exec(), page_exec(), page_state_callback(), park_and_announce_app_exec(), park_app_parse_data(), parse_data(), parse_options(), pbx_builtin_answer(), pbx_builtin_background(), pbx_builtin_incomplete(), pbx_builtin_saycharacters_case(), pbx_builtin_saynumber(), pbx_builtin_sayordinal(), pbx_builtin_waitexten(), pickupchan_exec(), playback_exec(), pqm_exec(), pre_session_setup(), pre_test_cb(), presence_read(), presence_write(), privacy_exec(), process_dahdi(), queue_exec(), queue_match(), rb_ao2_container_init(), rb_ao2_insert_node(), read_exec(), read_mf_exec(), read_sf_exec(), readexten_exec(), receivefax_exec(), record_exec(), recording_options_dtor(), say_enumeration_full(), say_enumeration_full(), say_full(), say_number_full(), say_number_full(), sayunixtime_exec(), scan_exec(), search_directory_sub(), senddtmf_exec(), sendfax_exec(), session_details_new(), set_config(), set_general_options(), setup_profile_bridge(), setup_profile_caller(), setup_profile_paged(), sla_add_trunk_to_station(), sla_trunk_exec(), smdi_message_wait(), smdi_msg_find(), smdi_msg_retrieve_read(), sms_exec(), softhangup_exec(), sorcery_memory_cache_open(), speech_background(), start_mixmonitor_callback(), stasis_app_control_record(), stasis_app_recording_options_create(), test_make_nonsorted(), test_make_sorted(), threadpool_alloc(), unicast_rtp_request(), upqm_exec(), vmauthenticate(), volume_read(), volume_write(), wait_exec(), webchan_request(), websocket_client_create(), xmpp_pubsub_build_publish_skeleton(), xmpp_pubsub_subscribe(), and zapateller_exec().
|
static |
Definition at line 65 of file test_http_media_cache.c.
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), handle_registration_response(), load_module(), load_module(), process_config(), schedule_retry(), sip_outbound_publisher_init(), sip_outbound_publisher_set_uris(), and sip_outbound_registration_regc_alloc().
|
static |
Definition at line 202 of file test_http_media_cache.c.
Referenced by load_module(), and unload_module().