[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Aug 16 14:17:29 CDT 2010
branch "master" has been updated
via 0031e4fa8e1b0b5bffae2d9511287e3c8097894a (commit)
via dfd8e50eea14fe2599960c48bc900cee3f1216f5 (commit)
from 75eb6574fec804f6f5e737fd9b9853a36d7fde43 (commit)
Summary of changes:
config/test_media_rtp_pjmedia.conf | 10 +++
test/CMakeLists.txt | 7 ++
test/TestRTPpjmedia.cpp | 132 ++++++++++++++++++++++++++++++++++++
3 files changed, 149 insertions(+), 0 deletions(-)
create mode 100644 config/test_media_rtp_pjmedia.conf
create mode 100644 test/CMakeLists.txt
create mode 100644 test/TestRTPpjmedia.cpp
- Log -----------------------------------------------------------------
commit 0031e4fa8e1b0b5bffae2d9511287e3c8097894a
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Aug 16 16:23:33 2010 -0300
Add skeleton test driver for media_rtp_pjmedia. So far it confirms that the service is being properly added to the service locator.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..0234733
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,7 @@
+hydra_component_init(media_rtp_pjmedia_test CXX)
+hydra_component_add_file(media_rtp_pjmedia_test TestRTPpjmedia.cpp)
+hydra_component_add_slice(media_rtp_pjmedia_test MediaIf)
+hydra_component_add_slice(media_rtp_pjmedia_test MediaRTPIf)
+hydra_component_add_boost_libraries(media_rtp_pjmedia_test unit_test_framework)
+hydra_component_build_standalone(media_rtp_pjmedia_test)
+hydra_component_install(media_rtp_pjmedia_test RUNTIME bin "PJmedia RTP Media Test Driver." Core)
diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
new file mode 100644
index 0000000..82527ad
--- /dev/null
+++ b/test/TestRTPpjmedia.cpp
@@ -0,0 +1,132 @@
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE RTPpjmediaTestSuite
+#define BOOST_TEST_NO_MAIN
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/debug.hpp>
+
+#include <Ice/Ice.h>
+
+#include "Core/Discovery/ServiceLocatorIf.h"
+#include "Media/MediaIf.h"
+#include "Media/RTP/MediaRTPIf.h"
+
+using namespace std;
+using namespace Hydra::Core::Discovery::V1;
+using namespace Hydra::Media::V1;
+using namespace Hydra::Media::RTP::V1;
+
+/* Cache the command line arguments so that Ice can be initialized within the global fixture. */
+struct ArgCacheType
+{
+public:
+ int argc;
+ char **argv;
+};
+static ArgCacheType mCachedArgs;
+
+/**
+ * It seems odd that boost doesn't provide an easy way to access the GLOBAL_FIXTURE members.
+ * But it doesn't seem to, so I'm sharing global setup stuff here.
+ */
+struct SharedTestData
+{
+public:
+ /**
+ * ICE Communicator used for talking to the service locator and eventually media format service.
+ */
+ Ice::CommunicatorPtr communicator;
+
+ /**
+ * A proxy to the service locator service.
+ */
+ ServiceLocatorPrx locator;
+};
+static SharedTestData Testbed;
+
+/**
+ * A global fixture for Ice initialization.
+ * Provides setup/teardown for the entire set of tests.
+ */
+struct GlobalIceFixture
+{
+ GlobalIceFixture()
+ {
+ BOOST_TEST_MESSAGE("Setting up pjmedia rtp media test fixture");
+
+ ::boost::debug::detect_memory_leaks(false);
+ ::boost::unit_test::unit_test_log.set_stream( std::cout );
+
+ int status = 0;
+ try
+ {
+ Testbed.communicator = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
+
+ Testbed.locator = ServiceLocatorPrx::checkedCast(Testbed.communicator->stringToProxy("LocatorService:tcp -p 2657"));
+
+ if (!Testbed.locator) {
+ throw "Invalid service locator proxy";
+ }
+ }
+ catch (const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = 1;
+ }
+ catch (const char* msg)
+ {
+ cerr << msg << endl;
+ status = 1;
+ }
+
+ } // end Fixture() constructor
+
+ ~GlobalIceFixture()
+ {
+ BOOST_TEST_MESSAGE("Tearing down pjmedia rtp media test fixture");
+
+
+ if (Testbed.communicator) {
+ Testbed.communicator->shutdown();
+ Testbed.communicator = 0;
+ }
+ }
+private:
+};
+
+BOOST_GLOBAL_FIXTURE(GlobalIceFixture);
+
+/**
+ * Implement our own main to intercept the command line args.
+ * (A default main() is provided if we hadn't set BOOST_TEST_NO_MAIN at the top of file.)
+ * NOTE: Pass in --log_level=message to see the debug print statements.
+ */
+int BOOST_TEST_CALL_DECL main( int argc, char* argv[] )
+{
+ mCachedArgs.argc = argc;
+ mCachedArgs.argv = argv;
+ return ::boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
+}
+
+/**
+ * Confirm that we find the rtp media session service based on category
+ */
+BOOST_AUTO_TEST_CASE(ServiceFoundUsingName)
+{
+ bool found = false;
+
+ try {
+ ServiceLocatorParamsPtr params = new ServiceLocatorParams();
+ params->category = "rtp";
+
+ Testbed.locator->locate(params);
+
+ found = true;
+ } catch (const Ice::Exception &e) {
+ BOOST_TEST_MESSAGE(e.ice_name());
+ BOOST_TEST_MESSAGE(e.what());
+ } catch (...) {
+ }
+
+ BOOST_CHECK(found);
+}
commit dfd8e50eea14fe2599960c48bc900cee3f1216f5
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Aug 16 16:11:29 2010 -0300
Add a configuration file for testing media_rtp_pjmedia.
diff --git a/config/test_media_rtp_pjmedia.conf b/config/test_media_rtp_pjmedia.conf
new file mode 100644
index 0000000..3e5ca6a
--- /dev/null
+++ b/config/test_media_rtp_pjmedia.conf
@@ -0,0 +1,10 @@
+# This is a configuration file used in conjunction with the pjmedia rtp component test driver
+
+# Adapter parameters for this component
+MediaRTPpjmediaAdapter.Endpoints=default
+
+# A proxy to the service locator management service
+ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 5674
+
+# A proxy to the service locator service
+ServiceLocatorProxy=LocatorService:tcp -p 2657
-----------------------------------------------------------------------
--
asterisk-scf/integration/media_rtp_pjmedia.git
More information about the asterisk-scf-commits
mailing list