[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "transfer" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Oct 13 07:14:13 CDT 2010


branch "transfer" has been updated
       via  05b4f9eb527c80f2a716778673d4c771ece0b500 (commit)
      from  c0f4738d47d5cc17c7c37b9a7b4f2ac24cf5d6a3 (commit)

Summary of changes:
 src/BridgeImpl.cpp    |    5 -----
 test/TestBridging.cpp |   45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit 05b4f9eb527c80f2a716778673d4c771ece0b500
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Oct 13 09:43:16 2010 -0230

    Add simple replaceSession test case and fix refactor snafu.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index ed5646f..a52a2ed 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -464,11 +464,6 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
             toRemove->disconnect();
             mSessions.erase(i);
         }
-
-        for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = newSessions.begin(); i != newSessions.end(); ++i)
-        {
-            newMembers.push_back(new BridgeSession(*i, 0, false));
-        }
         //
         // We don't do anything else with the new members just yet. We are going to release the lock and continue with things.
         //
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 4ea316d..f10ec58 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -399,6 +399,49 @@ public:
         }
     };
 
+    void testReplaceSession()
+    {
+        try
+        {
+            IceEnvironment testEnv(env()->properties());
+            TestChannelWrapper channel(env()->properties());
+            try
+            {
+                Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
+                testAdapter->activate();
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx = 
+                    AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::checkedCast(testEnv.communicator()->propertyToProxy("TestBridge.Proxy"));
+                BOOST_CHECK(mgrPrx);
+                AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
+                AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("111");
+                sessions.push_back(a);
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                sessions.clear();
+                AsteriskSCF::SessionCommunications::V1::SessionPrx b = channel.getSession("222");
+                sessions.push_back(b);
+                bridge->replaceSession(a, sessions);
+                sessions = bridge->listSessions();
+                BOOST_CHECK(sessions.size() == 1);
+                BOOST_CHECK(sessions.back() == b);
+                bridge->shutdown();
+
+            }
+            catch(const Ice::Exception& ex)
+            {
+                std::cerr << ex << std::endl;
+                BOOST_CHECK(false);
+            }
+            catch(...)
+            {
+                BOOST_CHECK(false);
+            }
+        }
+        catch(...)
+        {
+            BOOST_CHECK(false);
+        }
+    }
+
 private:
     TestEnvironmentPtr mTestEnvironment;
 };
@@ -414,6 +457,8 @@ bool init_unit_test()
         add(BOOST_TEST_CASE(boost::bind(&BridgeTester::simpleBridgingTest, bridgeTester)));
     framework::master_test_suite().
         add(BOOST_TEST_CASE(boost::bind(&BridgeTester::bridgeManagerListeners, bridgeTester)));
+    framework::master_test_suite().
+        add(BOOST_TEST_CASE(boost::bind(&BridgeTester::testReplaceSession, bridgeTester)));
     return true;
 }
 

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list