mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Revert changes to sorcery that accidentally got committed.
These changes were still up for review and have not been approved yet. I must have had the changes in my working copy when making a different change. ........ Merged revisions 410696 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -41,7 +41,7 @@
|
|||||||
;
|
;
|
||||||
; The following object mappings are used by the unit test to test certain functionality of sorcery.
|
; The following object mappings are used by the unit test to test certain functionality of sorcery.
|
||||||
;
|
;
|
||||||
[test_sorcery_section]
|
[test_sorcery]
|
||||||
test=memory
|
test=memory
|
||||||
|
|
||||||
[test_sorcery_cache]
|
[test_sorcery_cache]
|
||||||
|
@@ -39,11 +39,7 @@
|
|||||||
* object types to their respective wizards (object storage modules). If the developer would like
|
* object types to their respective wizards (object storage modules). If the developer would like
|
||||||
* to allow the user to configure this using the sorcery.conf configuration file the
|
* to allow the user to configure this using the sorcery.conf configuration file the
|
||||||
* \ref ast_sorcery_apply_config API call can be used to read in the configuration file and apply the
|
* \ref ast_sorcery_apply_config API call can be used to read in the configuration file and apply the
|
||||||
* mappings. \ref ast_sorcery_open will automatically call \ref ast_sorcery_apply_config to allow
|
* mappings. If the storage of the object types are such that a default wizard can be used this can
|
||||||
* for configuration of objects using the same category name as the module that is opening the
|
|
||||||
* sorcery instance. Direct calls to \ref ast_sorcery_apply_config should only be performed if a
|
|
||||||
* module wishes to allow for additional configuration sections in sorcery.conf to be used.
|
|
||||||
* If the storage of the object types are such that a default wizard can be used this can
|
|
||||||
* be applied using the \ref ast_sorcery_apply_default API call. Note that the default mappings will not
|
* be applied using the \ref ast_sorcery_apply_default API call. Note that the default mappings will not
|
||||||
* override configured mappings. They are only used in the case where no configured mapping exists.
|
* override configured mappings. They are only used in the case where no configured mapping exists.
|
||||||
*
|
*
|
||||||
@@ -326,9 +322,6 @@ int ast_sorcery_wizard_unregister(const struct ast_sorcery_wizard *interface);
|
|||||||
*
|
*
|
||||||
* \param module The module name (AST_MODULE)
|
* \param module The module name (AST_MODULE)
|
||||||
*
|
*
|
||||||
* When called, this will automatically also call __ast_sorcery_apply_config()
|
|
||||||
* with the module name as the configuration section.
|
|
||||||
*
|
|
||||||
* \retval non-NULL success
|
* \retval non-NULL success
|
||||||
* \retval NULL if allocation failed
|
* \retval NULL if allocation failed
|
||||||
*/
|
*/
|
||||||
@@ -350,17 +343,6 @@ struct ast_sorcery *__ast_sorcery_open(const char *module);
|
|||||||
*/
|
*/
|
||||||
struct ast_sorcery *ast_sorcery_retrieve_by_module_name(const char *module);
|
struct ast_sorcery *ast_sorcery_retrieve_by_module_name(const char *module);
|
||||||
|
|
||||||
enum ast_sorcery_apply_result {
|
|
||||||
/*! Sorcery wizard failed to apply. */
|
|
||||||
AST_SORCERY_APPLY_FAIL = -1,
|
|
||||||
/*! Sorcery wizard applied successfully. */
|
|
||||||
AST_SORCERY_APPLY_SUCCESS = 0,
|
|
||||||
/*! Sorcery wizard has already been applied to the object type. */
|
|
||||||
AST_SORCERY_APPLY_DUPLICATE = 1,
|
|
||||||
/*! Default sorcery wizard is unnecessary since a wizard has already been applied to the object type. */
|
|
||||||
AST_SORCERY_APPLY_DEFAULT_UNNECESSARY = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Apply configured wizard mappings
|
* \brief Apply configured wizard mappings
|
||||||
*
|
*
|
||||||
@@ -368,17 +350,10 @@ enum ast_sorcery_apply_result {
|
|||||||
* \param name Name of the category to use within the configuration file, normally the module name
|
* \param name Name of the category to use within the configuration file, normally the module name
|
||||||
* \param module The module name (AST_MODULE)
|
* \param module The module name (AST_MODULE)
|
||||||
*
|
*
|
||||||
* This function is called automatically by __ast_sorcery_open() using the module name as the
|
* \retval 0 success
|
||||||
* configuration category. The only reason you should call this function is if your module
|
* \retval -1 failure
|
||||||
* wishes to apply configuration from additional sections of sorcery.conf.
|
|
||||||
*
|
|
||||||
* If a configuration section attempts to apply the same sorcery wizard to an object type
|
|
||||||
* more than once, the wizard will only be applied one time.
|
|
||||||
*
|
|
||||||
* \return What happened when attempting to apply the default.
|
|
||||||
*/
|
*/
|
||||||
enum ast_sorcery_apply_result __ast_sorcery_apply_config(struct ast_sorcery *sorcery,
|
int __ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name, const char *module);
|
||||||
const char *name, const char *module);
|
|
||||||
|
|
||||||
#define ast_sorcery_apply_config(sorcery, name) \
|
#define ast_sorcery_apply_config(sorcery, name) \
|
||||||
__ast_sorcery_apply_config((sorcery), (name), AST_MODULE)
|
__ast_sorcery_apply_config((sorcery), (name), AST_MODULE)
|
||||||
@@ -392,14 +367,14 @@ enum ast_sorcery_apply_result __ast_sorcery_apply_config(struct ast_sorcery *sor
|
|||||||
* \param name Name of the wizard to use
|
* \param name Name of the wizard to use
|
||||||
* \param data Data to be passed to wizard
|
* \param data Data to be passed to wizard
|
||||||
*
|
*
|
||||||
* \return What occurred when applying the default
|
* \retval 0 success
|
||||||
|
* \retval -1 failure
|
||||||
*
|
*
|
||||||
* \note This should be called *after* applying configuration sourced mappings
|
* \note This should be called *after* applying configuration sourced mappings
|
||||||
*
|
*
|
||||||
* \note Only a single default can exist per object type
|
* \note Only a single default can exist per object type
|
||||||
*/
|
*/
|
||||||
enum ast_sorcery_apply_result __ast_sorcery_apply_default(struct ast_sorcery *sorcery,
|
int __ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data);
|
||||||
const char *type, const char *module, const char *name, const char *data);
|
|
||||||
|
|
||||||
#define ast_sorcery_apply_default(sorcery, type, name, data) \
|
#define ast_sorcery_apply_default(sorcery, type, name, data) \
|
||||||
__ast_sorcery_apply_default((sorcery), (type), AST_MODULE, (name), (data))
|
__ast_sorcery_apply_default((sorcery), (type), AST_MODULE, (name), (data))
|
||||||
|
@@ -580,14 +580,6 @@ struct ast_sorcery *__ast_sorcery_open(const char *module_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
strcpy(sorcery->module_name, module_name); /* Safe */
|
strcpy(sorcery->module_name, module_name); /* Safe */
|
||||||
|
|
||||||
if (__ast_sorcery_apply_config(sorcery, module_name, module_name) == AST_SORCERY_APPLY_FAIL) {
|
|
||||||
ast_log(LOG_ERROR, "Error attempting to apply configuration %s to sorcery.", module_name);
|
|
||||||
ao2_cleanup(sorcery);
|
|
||||||
sorcery = NULL;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
ao2_link_flags(instances, sorcery, OBJ_NOLOCK);
|
ao2_link_flags(instances, sorcery, OBJ_NOLOCK);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@@ -631,7 +623,7 @@ static struct ast_sorcery_object_type *sorcery_object_type_alloc(const char *typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Order matters for object wizards */
|
/* Order matters for object wizards */
|
||||||
if (!(object_type->wizards = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 1, NULL, sorcery_wizard_cmp))) {
|
if (!(object_type->wizards = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 1, NULL, NULL))) {
|
||||||
ao2_ref(object_type, -1);
|
ao2_ref(object_type, -1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -691,8 +683,7 @@ static void sorcery_object_wizard_destructor(void *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Internal function which creates an object type and adds a wizard mapping */
|
/*! \brief Internal function which creates an object type and adds a wizard mapping */
|
||||||
static enum ast_sorcery_apply_result sorcery_apply_wizard_mapping(struct ast_sorcery *sorcery,
|
static int sorcery_apply_wizard_mapping(struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data, unsigned int caching)
|
||||||
const char *type, const char *module, const char *name, const char *data, unsigned int caching)
|
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
|
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
|
||||||
RAII_VAR(struct ast_sorcery_wizard *, wizard, ao2_find(wizards, name, OBJ_KEY), ao2_cleanup);
|
RAII_VAR(struct ast_sorcery_wizard *, wizard, ao2_find(wizards, name, OBJ_KEY), ao2_cleanup);
|
||||||
@@ -700,30 +691,18 @@ static enum ast_sorcery_apply_result sorcery_apply_wizard_mapping(struct ast_sor
|
|||||||
int created = 0;
|
int created = 0;
|
||||||
|
|
||||||
if (!wizard || !object_wizard) {
|
if (!wizard || !object_wizard) {
|
||||||
return AST_SORCERY_APPLY_FAIL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!object_type) {
|
if (!object_type) {
|
||||||
if (!(object_type = sorcery_object_type_alloc(type, module))) {
|
if (!(object_type = sorcery_object_type_alloc(type, module))) {
|
||||||
return AST_SORCERY_APPLY_FAIL;
|
return -1;
|
||||||
}
|
}
|
||||||
created = 1;
|
created = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!created) {
|
|
||||||
struct ast_sorcery_wizard *found;
|
|
||||||
|
|
||||||
found = ao2_find(object_type->wizards, wizard, OBJ_SEARCH_OBJECT);
|
|
||||||
if (found) {
|
|
||||||
ast_debug(1, "Wizard %s already applied to object type %s\n",
|
|
||||||
wizard->name, object_type->name);
|
|
||||||
ao2_cleanup(found);
|
|
||||||
return AST_SORCERY_APPLY_DUPLICATE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wizard->open && !(object_wizard->data = wizard->open(data))) {
|
if (wizard->open && !(object_wizard->data = wizard->open(data))) {
|
||||||
return AST_SORCERY_APPLY_FAIL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_module_ref(wizard->module);
|
ast_module_ref(wizard->module);
|
||||||
@@ -737,18 +716,18 @@ static enum ast_sorcery_apply_result sorcery_apply_wizard_mapping(struct ast_sor
|
|||||||
ao2_link(sorcery->types, object_type);
|
ao2_link(sorcery->types, object_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
return AST_SORCERY_APPLY_SUCCESS;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ast_sorcery_apply_result __ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name, const char *module)
|
int __ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name, const char *module)
|
||||||
{
|
{
|
||||||
struct ast_flags flags = { 0 };
|
struct ast_flags flags = { 0 };
|
||||||
struct ast_config *config = ast_config_load2("sorcery.conf", "sorcery", flags);
|
struct ast_config *config = ast_config_load2("sorcery.conf", "sorcery", flags);
|
||||||
struct ast_variable *mapping;
|
struct ast_variable *mapping;
|
||||||
int res = AST_SORCERY_APPLY_SUCCESS;
|
int res = 0;
|
||||||
|
|
||||||
if (!config || config == CONFIG_STATUS_FILEINVALID) {
|
if (!config || config == CONFIG_STATUS_FILEINVALID) {
|
||||||
return AST_SORCERY_APPLY_FAIL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (mapping = ast_variable_browse(config, name); mapping; mapping = mapping->next) {
|
for (mapping = ast_variable_browse(config, name); mapping; mapping = mapping->next) {
|
||||||
@@ -771,8 +750,8 @@ enum ast_sorcery_apply_result __ast_sorcery_apply_config(struct ast_sorcery *so
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Any error immediately causes us to stop */
|
/* Any error immediately causes us to stop */
|
||||||
if (sorcery_apply_wizard_mapping(sorcery, type, module, wizard, data, caching) == AST_SORCERY_APPLY_FAIL) {
|
if (sorcery_apply_wizard_mapping(sorcery, type, module, wizard, data, caching)) {
|
||||||
res = AST_SORCERY_APPLY_FAIL;
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -782,13 +761,13 @@ enum ast_sorcery_apply_result __ast_sorcery_apply_config(struct ast_sorcery *so
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ast_sorcery_apply_result __ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data)
|
int __ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
|
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
|
||||||
|
|
||||||
/* Defaults can not be added if any existing mapping exists */
|
/* Defaults can not be added if any existing mapping exists */
|
||||||
if (object_type) {
|
if (object_type) {
|
||||||
return AST_SORCERY_APPLY_DEFAULT_UNNECESSARY;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sorcery_apply_wizard_mapping(sorcery, type, module, name, data, 0);
|
return sorcery_apply_wizard_mapping(sorcery, type, module, name, data, 0);
|
||||||
|
@@ -163,8 +163,10 @@ static int mwi_sorcery_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Map the external MWI wizards. */
|
/* Map the external MWI wizards. */
|
||||||
if (ast_sorcery_apply_default(mwi_sorcery, MWI_MAILBOX_TYPE, "astdb",
|
res = !!ast_sorcery_apply_config(mwi_sorcery, "res_mwi_external");
|
||||||
MWI_ASTDB_PREFIX) == AST_SORCERY_APPLY_FAIL) {
|
res &= !!ast_sorcery_apply_default(mwi_sorcery, MWI_MAILBOX_TYPE, "astdb",
|
||||||
|
MWI_ASTDB_PREFIX);
|
||||||
|
if (res) {
|
||||||
ast_log(LOG_ERROR, "MWI external: Sorcery could not setup wizards.\n");
|
ast_log(LOG_ERROR, "MWI external: Sorcery could not setup wizards.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -116,6 +116,8 @@ int ast_sip_initialize_system(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ast_sorcery_apply_config(system_sorcery, "res_pjsip");
|
||||||
|
|
||||||
ast_sorcery_apply_default(system_sorcery, "system", "config", "pjsip.conf,criteria=type=system");
|
ast_sorcery_apply_default(system_sorcery, "system", "config", "pjsip.conf,criteria=type=system");
|
||||||
|
|
||||||
if (ast_sorcery_object_register_no_reload(system_sorcery, "system", system_alloc, NULL, system_apply)) {
|
if (ast_sorcery_object_register_no_reload(system_sorcery, "system", system_alloc, NULL, system_apply)) {
|
||||||
|
@@ -1619,6 +1619,8 @@ int ast_res_pjsip_initialize_configuration(const struct ast_module_info *ast_mod
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ast_sorcery_apply_config(sip_sorcery, "res_pjsip");
|
||||||
|
|
||||||
ast_sip_initialize_cli();
|
ast_sip_initialize_cli();
|
||||||
|
|
||||||
if (ast_sip_initialize_sorcery_auth()) {
|
if (ast_sip_initialize_sorcery_auth()) {
|
||||||
|
@@ -306,7 +306,7 @@ static struct ast_sorcery *alloc_and_initialize_sorcery(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) ||
|
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
|
||||||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
|
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
|
||||||
ast_sorcery_unref(sorcery);
|
ast_sorcery_unref(sorcery);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -452,17 +452,17 @@ AST_TEST_DEFINE(apply_default)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "dummy", NULL) != AST_SORCERY_APPLY_FAIL) {
|
if (!ast_sorcery_apply_default(sorcery, "test", "dummy", NULL)) {
|
||||||
ast_test_status_update(test, "Successfully set a default wizard that doesn't exist\n");
|
ast_test_status_update(test, "Successfully set a default wizard that doesn't exist\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
|
||||||
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_DEFAULT_UNNECESSARY) {
|
if (!ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
|
||||||
ast_test_status_update(test, "Successfully set a default wizard on a type twice\n");
|
ast_test_status_update(test, "Successfully set a default wizard on a type twice\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
@@ -493,7 +493,7 @@ AST_TEST_DEFINE(apply_config)
|
|||||||
return AST_TEST_NOT_RUN;
|
return AST_TEST_NOT_RUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ast_category_get(config, "test_sorcery_section")) {
|
if (!ast_category_get(config, "test_sorcery")) {
|
||||||
ast_test_status_update(test, "Sorcery configuration file does not have test_sorcery section\n");
|
ast_test_status_update(test, "Sorcery configuration file does not have test_sorcery section\n");
|
||||||
ast_config_destroy(config);
|
ast_config_destroy(config);
|
||||||
return AST_TEST_NOT_RUN;
|
return AST_TEST_NOT_RUN;
|
||||||
@@ -506,7 +506,7 @@ AST_TEST_DEFINE(apply_config)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_config(sorcery, "test_sorcery_section") != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_config(sorcery, "test_sorcery")) {
|
||||||
ast_test_status_update(test, "Failed to apply configured object mappings\n");
|
ast_test_status_update(test, "Failed to apply configured object mappings\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
@@ -535,7 +535,7 @@ AST_TEST_DEFINE(object_register)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
|
||||||
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
@@ -608,7 +608,7 @@ AST_TEST_DEFINE(object_field_register)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
|
||||||
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
@@ -657,7 +657,7 @@ AST_TEST_DEFINE(object_fields_register)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
|
||||||
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
@@ -1192,7 +1192,7 @@ AST_TEST_DEFINE(objectset_create_regex)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) ||
|
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
|
||||||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
|
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
|
||||||
ast_test_status_update(test, "Failed to register 'test' object type\n");
|
ast_test_status_update(test, "Failed to register 'test' object type\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
@@ -1292,7 +1292,7 @@ AST_TEST_DEFINE(objectset_apply_handler)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) ||
|
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
|
||||||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
|
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
|
||||||
ast_test_status_update(test, "Failed to register 'test' object type\n");
|
ast_test_status_update(test, "Failed to register 'test' object type\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
@@ -1387,7 +1387,7 @@ AST_TEST_DEFINE(objectset_transform)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
|
||||||
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
@@ -1453,7 +1453,7 @@ AST_TEST_DEFINE(objectset_apply_fields)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) ||
|
if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
|
||||||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
|
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
|
||||||
ast_test_status_update(test, "Failed to register 'test' object type\n");
|
ast_test_status_update(test, "Failed to register 'test' object type\n");
|
||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
@@ -2244,7 +2244,7 @@ AST_TEST_DEFINE(caching_wizard_behavior)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_config(sorcery, "test_sorcery_cache") != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_config(sorcery, "test_sorcery_cache")) {
|
||||||
ast_test_status_update(test, "Failed to apply configured object mappings\n");
|
ast_test_status_update(test, "Failed to apply configured object mappings\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -2489,7 +2489,7 @@ AST_TEST_DEFINE(configuration_file_wizard)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf") != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf")) {
|
||||||
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
||||||
return AST_TEST_NOT_RUN;
|
return AST_TEST_NOT_RUN;
|
||||||
}
|
}
|
||||||
@@ -2552,7 +2552,7 @@ AST_TEST_DEFINE(configuration_file_wizard_with_file_integrity)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf,integrity=file") != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf,integrity=file")) {
|
||||||
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
||||||
return AST_TEST_NOT_RUN;
|
return AST_TEST_NOT_RUN;
|
||||||
}
|
}
|
||||||
@@ -2606,7 +2606,7 @@ AST_TEST_DEFINE(configuration_file_wizard_with_criteria)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf,criteria=type=zombies") != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf,criteria=type=zombies")) {
|
||||||
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
||||||
return AST_TEST_NOT_RUN;
|
return AST_TEST_NOT_RUN;
|
||||||
}
|
}
|
||||||
@@ -2665,7 +2665,7 @@ AST_TEST_DEFINE(configuration_file_wizard_retrieve_field)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf") != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf")) {
|
||||||
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
||||||
return AST_TEST_NOT_RUN;
|
return AST_TEST_NOT_RUN;
|
||||||
}
|
}
|
||||||
@@ -2728,7 +2728,7 @@ AST_TEST_DEFINE(configuration_file_wizard_retrieve_multiple)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf") != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf")) {
|
||||||
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
||||||
return AST_TEST_NOT_RUN;
|
return AST_TEST_NOT_RUN;
|
||||||
}
|
}
|
||||||
@@ -2799,7 +2799,7 @@ AST_TEST_DEFINE(configuration_file_wizard_retrieve_multiple_all)
|
|||||||
return AST_TEST_FAIL;
|
return AST_TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf") != AST_SORCERY_APPLY_SUCCESS) {
|
if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf")) {
|
||||||
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
|
||||||
return AST_TEST_NOT_RUN;
|
return AST_TEST_NOT_RUN;
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ static struct ast_sorcery *alloc_and_initialize_sorcery(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ast_sorcery_apply_default(sorcery, "test", "astdb", "test") != AST_SORCERY_APPLY_SUCCESS) ||
|
if (ast_sorcery_apply_default(sorcery, "test", "astdb", "test") ||
|
||||||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
|
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
|
||||||
ast_sorcery_unref(sorcery);
|
ast_sorcery_unref(sorcery);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -212,7 +212,7 @@ static struct ast_sorcery *alloc_and_initialize_sorcery(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ast_sorcery_apply_default(sorcery, "test", "realtime", "sorcery_realtime_test") != AST_SORCERY_APPLY_SUCCESS) ||
|
if (ast_sorcery_apply_default(sorcery, "test", "realtime", "sorcery_realtime_test") ||
|
||||||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL) ||
|
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL) ||
|
||||||
!(realtime_objects = ast_config_new())) {
|
!(realtime_objects = ast_config_new())) {
|
||||||
ast_sorcery_unref(sorcery);
|
ast_sorcery_unref(sorcery);
|
||||||
|
Reference in New Issue
Block a user