42#define CATEGORY "/main/media_cache/"
45#define VALID_RESOURCE "httptest://localhost:8088/test_media_cache/test_media_cache/test_media_cache/test_media_cache/test_media_cache/test_media_cache/test_media_cache/test_media_cache/test_media_cache/test_media_cache/test_media_cache/test_media_cache/test_media_cache/monkeys.wav"
48#define INVALID_RESOURCE "httptest://localhost:8088/test_media_cache/bad.wav"
51#define INVALID_SCHEME "foo://localhost:8088/test_media_cache/monkeys.wav"
54#define NO_SCHEME "localhost:8088/test_media_cache/monkeys.wav"
89 void *data,
const char *
type,
const char *
id)
141 info->name = __func__;
143 info->summary =
"Test nominal existance of resources in the cache";
145 "This test verifies that if a known resource is in the cache, "
146 "calling ast_media_cache_exists will return logical True. If "
147 "a resource does not exist, the same function call will return "
155 ast_test_validate(
test, res == 0);
158 ast_test_validate(
test, res == 1);
169 info->name = __func__;
171 info->summary =
"Test off nominal existance of resources in the cache";
173 "This test verifies that checking for bad resources (NULL, bad "
174 "scheme, etc.) does not result in false positives.";
181 ast_test_validate(
test, res != 1);
184 ast_test_validate(
test, res != 1);
187 ast_test_validate(
test, res != 1);
190 ast_test_validate(
test, res != 1);
199 char tmp_path_one[
PATH_MAX] =
"/tmp/test-media-cache-XXXXXX";
200 char tmp_path_two[
PATH_MAX] =
"/tmp/test-media-cache-XXXXXX";
205 info->name = __func__;
207 info->summary =
"Test nominal creation/updating of a resource";
209 "This test creates a resource and associates it with a file. "
210 "It then updates the resource with a new file. In both cases, "
211 "the test verifies that the resource is associated with the "
219 fd = mkstemp(tmp_path_one);
228 fd = mkstemp(tmp_path_two);
238 ast_test_validate(
test, res == 0);
242 ast_test_validate(
test, res == 0);
243 ast_test_validate(
test, strcmp(file_path, tmp_path_one) == 0);
247 ast_test_validate(
test, res == 0);
251 ast_test_validate(
test, res == 0);
252 ast_test_validate(
test, strcmp(file_path, tmp_path_two) == 0);
256 unlink(tmp_path_one);
257 unlink(tmp_path_two);
265 char tmp_path[
PATH_MAX] =
"/tmp/test-media-cache-XXXXXX";
270 info->name = __func__;
272 info->summary =
"Test off nominal creation/updating of a resource";
274 "Test creation/updating of a resource with a variety of invalid\n"
282 fd = mkstemp(tmp_path);
292 ast_test_validate(
test, res != 0);
295 ast_test_validate(
test, res != 0);
298 ast_test_validate(
test, res != 0);
301 ast_test_validate(
test, res != 0);
304 ast_test_validate(
test, res != 0);
307 ast_test_validate(
test, res != 0);
317 char tmp_path[
PATH_MAX] =
"/tmp/test-media-cache-XXXXXX";
319 char actual_metadata[32];
326 info->name = __func__;
328 info->summary =
"Test nominal creation/updating of a resource";
330 "This test creates a resource and associates it with a file. "
331 "It then updates the resource with a new file. In both cases, "
332 "the test verifies that the resource is associated with the "
340 fd = mkstemp(tmp_path);
364 ast_test_validate(
test, res == 0);
368 ast_test_validate(
test, res == 0);
369 ast_test_validate(
test, strcmp(file_path, tmp_path) == 0);
372 actual_metadata,
sizeof(actual_metadata));
373 ast_test_validate(
test, res == 0);
374 ast_test_validate(
test, strcmp(actual_metadata,
"value1") == 0);
377 actual_metadata,
sizeof(actual_metadata));
378 ast_test_validate(
test, res == 0);
379 ast_test_validate(
test, strcmp(actual_metadata,
"value2") == 0);
402 ast_log(
LOG_ERROR,
"Failed to register Bucket HTTP test wizard scheme implementation\n");
Asterisk main include file. File version handling, generic pbx functions.
struct ast_bucket_file * ast_bucket_file_alloc(const char *uri)
Allocate a new bucket file.
#define ast_bucket_scheme_register(name, bucket, file, create_cb, destroy_cb)
Register support for a specific scheme.
int ast_bucket_file_temporary_create(struct ast_bucket_file *file)
Common file snapshot creation callback for creating a temporary file.
#define ast_variable_new(name, value, filename)
#define ast_variable_list_append(head, new_var)
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
static struct ast_sorcery * sorcery
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
Bucket file structure, contains reference to file and information about it.
Interface for a sorcery wizard.
void(* close)(void *data)
Callback for closing a wizard.
const char * name
Name of the wizard.
Full structure for sorcery.
Structure for variables, used for configurations and for channel variables.
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)