res_parking: Unit tests

Adds the following unit tests:
* create_lot: tests adding and removal of a new parking lot (baseline)
* park_extensions: creates a parking lot that registers extensions and
      then confirms that all of the expected extensions exist
* extensions_conflicts: creates numerous parking lots to test that
      extension conflicts in parking lots result in parking lot
      creation failing
* dynamic_parking_variables: Tests that the creation of dynamic
      parking lots respects the related channel variables set on the
      channel that requests them.
* park_call: Tests adding a channel to a parking lot's holding bridge
      by standard parking functions.
* retrieve_call: Tests pulling a channel out of a parking lot's
      holding bridge via parked call retrieval functions.

(closes issue ASTERISK-22138)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2714/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2013-08-05 16:00:01 +00:00
parent 357b275239
commit 98b02d98f3
4 changed files with 922 additions and 4 deletions

View File

@@ -110,6 +110,20 @@ struct parked_user {
enum park_call_resolution resolution; /*!< How did the parking session end? If the call is in a bridge, lock parked_user before checking/setting */
};
#if defined(TEST_FRAMEWORK)
/*!
* \since 12.0.0
* \brief Create an empty parking lot configuration structure
* useful for unit tests.
*
* \param cat name given to the parking lot
*
* \retval NULL failure
* \retval non-NULL successfully allocated parking lot
*/
struct parking_lot_cfg *parking_lot_cfg_create(const char *cat);
#endif
/*!
* \since 12.0.0
* \brief If a parking lot exists in the parking lot list already, update its status to match the provided
@@ -268,10 +282,25 @@ struct parking_lot *parking_lot_find_by_name(const char *lot_name);
* \retval NULL on error
*
* \note This should be called only after verifying that the named parking lot doesn't already exist in a non-dynamic way.
* The parking lots container should be locked before verifying and remain locked until after this function is called.
*/
struct parking_lot *parking_create_dynamic_lot(const char *name, struct ast_channel *chan);
#if defined(TEST_FRAMEWORK)
/*!
* \since 12.0.0
* \brief Create a dynamic parking lot without respect to whether they are enabled by configuration
*
* \param name Dynamic parking lot name to create
* \param chan Channel parkee to get the dynamic parking lot parameters from
*
* \retval dynamically created parking lot on success
* \retval NULL on error
*
* \note This should be called only after verifying that the named parking lot doesn't already exist in a non-dynamic way.
*/
struct parking_lot *parking_create_dynamic_lot_forced(const char *name, struct ast_channel *chan);
#endif
/*!
* \since 12.0.0
* \brief Find parking lot name from channel
@@ -525,3 +554,21 @@ int load_parking_devstate(void);
* \brief Unregister Parking devstate handler
*/
void unload_parking_devstate(void);
/*!
* \since 12.0.0
* \brief Register parking unit tests
*
* \retval 0 on success
* \retval nonzero on failure
*/
int load_parking_tests(void);
/*!
* \since 12.0.0
* \brief Unregister parking unit tests
*
* \retval 0 on success
* \retval nonzero on failure
*/
int unload_parking_tests(void);