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

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_moduleAST_MODULE_SELF_SYM (void)
 
 AST_TEST_DEFINE (retrieve_content_type)
 
 AST_TEST_DEFINE (retrieve_parsed_uri)
 
 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_infoast_module_info = &__mod_info
 
static struct test_options options
 
static char server_uri [512]
 
static struct ast_http_uri test_uri
 

Detailed Description

Tests for the HTTP media cache backend.

Author
Matt Jordan <mjordan@digium.com> 

Definition in file test_http_media_cache.c.

Macro Definition Documentation

#define VALIDATE_STR_METADATA (   test,
  bucket_file,
  key,
  expected 
)
Value:
do { \
RAII_VAR(struct ast_bucket_metadata *, metadata, ast_bucket_file_metadata_get((bucket_file), (key)), ao2_cleanup); \
ast_test_validate(test, metadata != NULL); \
ast_test_validate(test, !strcmp(metadata->value, (expected))); \
} while (0)
struct ast_bucket_metadata * ast_bucket_file_metadata_get(struct ast_bucket_file *file, const char *name)
Retrieve a metadata attribute from a file.
Definition: bucket.c:359
Bucket metadata structure, AO2 key value pair.
Definition: bucket.h:47
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

Definition at line 78 of file test_http_media_cache.c.