Asterisk - The Open Source Telephony Project
18.5.0
|
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 (retrieve_cache_control_directives) | |
AST_TEST_DEFINE (retrieve_cache_control_age) | |
AST_TEST_DEFINE (retrieve_etag_expired) | |
AST_TEST_DEFINE (retrieve_expires) | |
AST_TEST_DEFINE (retrieve_etag) | |
AST_TEST_DEFINE (retrieve_nominal) | |
AST_TEST_DEFINE (create_nominal) | |
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 = "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, .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.
Referenced by AST_TEST_DEFINE(), and load_module().
#define SET_OR_APPEND_CACHE_CONTROL | ( | str | ) |
Definition at line 83 of file test_http_media_cache.c.
Referenced by http_callback().
#define TEST_URI "test_media_cache" |
Definition at line 46 of file test_http_media_cache.c.
Referenced by process_config().
#define VALIDATE_EXPIRES | ( | test, | |
bucket_file, | |||
expected, | |||
delta | |||
) |
Definition at line 66 of file test_http_media_cache.c.
Referenced by AST_TEST_DEFINE().
#define VALIDATE_STR_METADATA | ( | test, | |
bucket_file, | |||
key, | |||
expected | |||
) |
Definition at line 77 of file test_http_media_cache.c.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 701 of file test_http_media_cache.c.
|
static |
Definition at line 701 of file test_http_media_cache.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 701 of file test_http_media_cache.c.
AST_TEST_DEFINE | ( | retrieve_cache_control_directives | ) |
Definition at line 223 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, sip_to_pjsip::info(), 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_cache_control_age | ) |
Definition at line 305 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, sip_to_pjsip::info(), 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_etag_expired | ) |
Definition at line 406 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, sip_to_pjsip::info(), 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 447 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, sip_to_pjsip::info(), 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_etag | ) |
Definition at line 497 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, sip_to_pjsip::info(), 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_nominal | ) |
Definition at line 540 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, sip_to_pjsip::info(), 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 | ( | create_nominal | ) |
Definition at line 573 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, sip_to_pjsip::info(), 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.
|
static |
Definition at line 213 of file test_http_media_cache.c.
References ao2_ref, and ast_bucket_file_delete().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 91 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, errno, error(), test_options::etag, test_options::expires, LOG_ERROR, test_options::maxage, 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 655 of file test_http_media_cache.c.
References ast_http_uri_link(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_TEST_REGISTER, ast_test_register_init(), CATEGORY, pre_test_cb(), and process_config().
Referenced by unload_module().
|
static |
Definition at line 206 of file test_http_media_cache.c.
References options.
Referenced by load_module().
|
static |
Definition at line 607 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, S_OR, server_uri, and TEST_URI.
Referenced by load_module(), and reload_module().
|
static |
Definition at line 650 of file test_http_media_cache.c.
References process_config().
Referenced by unload_module().
|
static |
Definition at line 679 of file test_http_media_cache.c.
References ast_http_uri_unlink(), AST_MODFLAG_DEFAULT, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, AST_TEST_UNREGISTER, ASTERISK_GPL_KEY, load_module(), reload(), and reload_module().
|
static |
Definition at line 701 of file test_http_media_cache.c.
|
static |
Definition at line 701 of file test_http_media_cache.c.
|
static |
Definition at line 62 of file test_http_media_cache.c.
Referenced by __ssl_setup(), agent_login_exec(), app_exec(), aqm_exec(), ast_ari_bridges_record(), ast_ari_channels_record(), ast_get_number_str(), AST_TEST_DEFINE(), audiosocket_request(), auth_exec(), bridge_exec(), bridgewait_exec(), cdr_prop_write_callback(), cdr_read_callback(), cdr_write(), cdr_write_callback(), chanavail_exec(), chanspy_exec(), conf_exec(), controlplayback_exec(), detect_write(), dial_exec_full(), directory_exec(), disa_exec(), dundi_query_read(), dundifunc_read(), enable_jack_hook(), extenspy_exec(), feature_automixmonitor(), feature_automonitor(), file_read(), file_write(), forkcdr_exec(), function_enum(), generate_rtpmap_attr(), get_codecs(), handle_cli_presencestate_change(), handle_cli_presencestate_list(), handle_request_subscribe(), handle_updates(), hash_ao2_container_init(), hash_ao2_insert_node(), hint_read(), http_callback(), manager_mixmonitor(), milliwatt_exec(), mixmonitor_exec(), multicast_rtp_request(), originate_exec(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), page_state_callback(), park_and_announce_app_exec(), park_app_parse_data(), pbx_builtin_background(), pbx_builtin_incomplete(), pbx_builtin_saycharacters_case(), pbx_builtin_saynumber(), pbx_builtin_waitexten(), pickupchan_exec(), playback_exec(), pqm_exec(), pre_session_setup(), pre_test_cb(), presence_read(), presence_write(), privacy_exec(), process_echocancel(), queue_exec(), rb_ao2_container_init(), rb_ao2_insert_node(), rcvfax_exec(), read_exec(), read_mf_exec(), read_sf_exec(), readexten_exec(), receivefax_exec(), record_exec(), sayunixtime_exec(), search_directory_sub(), sendfax_exec(), sendurl_exec(), set_general_options(), sla_add_trunk_to_station(), sla_trunk_exec(), smdi_msg_retrieve_read(), sms_exec(), sndfax_exec(), softhangup_exec(), sorcery_memory_cache_open(), start_monitor_exec(), stir_shaken_cli_show(), unicast_rtp_request(), upqm_exec(), vmauthenticate(), volume_read(), volume_write(), wait_exec(), xmpp_pubsub_build_publish_skeleton(), xmpp_pubsub_subscribe(), and zapateller_exec().
|
static |
Definition at line 64 of file test_http_media_cache.c.
Referenced by AST_TEST_DEFINE(), load_module(), process_config(), and sip_outbound_publisher_init().
|
static |
Definition at line 197 of file test_http_media_cache.c.