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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Sep 15 08:34:40 CDT 2010


branch "master" has been updated
       via  f5a0579ebe4ae136ca4d9c2a9f13a8ac09aaf839 (commit)
       via  c10bda1ee43be07c23fe35b8c55abb310f28d778 (commit)
       via  764258b6e33273034690bc26463515d132682352 (commit)
       via  f2b461328fffeb3390d657985f86d123a1295b43 (commit)
       via  45ebee714888fe9b89761ce69de150ad7fb52ad9 (commit)
       via  65bdbc4f258257e48bc27c2c49bb9b10c151198a (commit)
      from  8400eee14f05c8224e398d3085e46b0474a9c79f (commit)

Summary of changes:
 src/BridgeImpl.cpp              |   39 +-
 test/BridgeListenerI.cpp        |   38 +
 test/BridgeListenerI.h          |   12 +
 test/BridgeManagerListenerI.cpp |   12 +
 test/BridgeManagerListenerI.h   |    4 +
 test/TestBridging.cpp           | 1861 ++-------------------------------------
 test/channel_driver             |    2 +-
 7 files changed, 182 insertions(+), 1786 deletions(-)


- Log -----------------------------------------------------------------
commit f5a0579ebe4ae136ca4d9c2a9f13a8ac09aaf839
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Sep 15 10:53:39 2010 -0230

    Fixed bridge to propogate connect calls on a connected callback from a session.
    This currently goes out to all sessions except the source. Modified ringing
    to be the same.
    Added some listener oriented tests for the bridge manager.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 7f33680..834027e 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -67,12 +67,23 @@ namespace BridgeService
         AsteriskSCF::SessionCommunications::V1::ResponseCodePtr mResponse;
     };
 
-    struct RingImpl : public std::unary_function<BridgeImpl::BridgeSession, void>
+    class RingImpl : public std::unary_function<BridgeImpl::BridgeSession, void>
     {
+    public:
+        RingImpl(const AsteriskSCF::SessionCommunications::V1::SessionPrx& exclude) :
+            mExclude(exclude)
+        {
+        }
+        
         void operator()(const BridgeImpl::BridgeSession& b) 
         {
-            b.session->ring();
+            if(b.session != mExclude)
+            {
+                b.session->ring();
+            }
         }
+    private:
+        AsteriskSCF::SessionCommunications::V1::SessionPrx mExclude;
     };
 
     struct FlashImpl : public std::unary_function<BridgeImpl::BridgeSession, void>
@@ -99,6 +110,26 @@ namespace BridgeService
         }
     };
 
+    class ConnectImpl : public std::unary_function<BridgeImpl::BridgeSession, void>
+    {
+    public:
+        ConnectImpl(const AsteriskSCF::SessionCommunications::V1::SessionPrx& exclude) :
+            mExclude(exclude)
+        {
+        }
+        
+        void operator()(const BridgeImpl::BridgeSession& b)
+        {
+            if(b.session != mExclude)
+            {
+                b.session->connect();
+            }
+        }
+
+    private:
+        AsteriskSCF::SessionCommunications::V1::SessionPrx mExclude;
+    };
+
     class FindImpl : public std::unary_function<BridgeImpl::BridgeSession, bool>
     {
     public:
@@ -132,6 +163,8 @@ namespace BridgeService
         void connected(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source, const Ice::Current&)
         {
             mBridge->sessionConnected(source);
+            std::vector<BridgeImpl::BridgeSession> sessions(mBridge->currentSessions());
+            std::for_each(sessions.begin(), sessions.end(), ConnectImpl(source));
         }
 
         void flashed(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source, const Ice::Current&)
@@ -151,7 +184,7 @@ namespace BridgeService
             std::vector<BridgeImpl::BridgeSession> sessions(mBridge->currentSessions());
             if(sessions.size() > 0)
             {
-                std::for_each(sessions.begin(), sessions.end(), RingImpl());
+                std::for_each(sessions.begin(), sessions.end(), RingImpl(source));
             }
         }
 
diff --git a/test/BridgeListenerI.cpp b/test/BridgeListenerI.cpp
index a3ccfd1..2bc6e21 100644
--- a/test/BridgeListenerI.cpp
+++ b/test/BridgeListenerI.cpp
@@ -15,10 +15,16 @@ BridgeListenerI::BridgeListenerI() :
 
 void BridgeListenerI::sessionsAdded(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
 {
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mAddMonitor);
+    mAdded = sessions;
+    mAddMonitor.notify();
 }
 
 void BridgeListenerI::sessionsRemoved(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
 {
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mRemoveMonitor);
+    mRemoved = sessions;
+    mRemoveMonitor.notify();
 }
 
 void BridgeListenerI::stopping(const Ice::Current& current)
@@ -28,7 +34,9 @@ void BridgeListenerI::stopping(const Ice::Current& current)
 
 void BridgeListenerI::stopped(const Ice::Current& current)
 {
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStateMonitor);
     mStopped = true;
+    mStateMonitor.notify();
 }
 
 bool BridgeListenerI::resetShuttingDown()
@@ -44,3 +52,33 @@ bool BridgeListenerI::resetStopped()
     mStopped = false;
     return result;
 }
+
+bool BridgeListenerI::waitForAdded(unsigned long milliseconds, AsteriskSCF::SessionCommunications::V1::SessionSeq& added)
+{
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mAddMonitor);
+    bool waitResult = mAddMonitor.timedWait(IceUtil::Time::milliSeconds(milliseconds));
+    if(waitResult && mAdded.size() > 0)
+    {
+        added = mAdded;
+        return true;
+    }
+    return false;
+}
+
+bool BridgeListenerI::waitForRemoved(unsigned long milliseconds, AsteriskSCF::SessionCommunications::V1::SessionSeq& removed)
+{
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mRemoveMonitor);
+    bool waitResult = mRemoveMonitor.timedWait(IceUtil::Time::milliSeconds(milliseconds));
+    if(waitResult && mRemoved.size() > 0)
+    {
+        removed = mRemoved;
+        return true;
+    }
+    return false;
+}
+
+bool BridgeListenerI::waitForStopped(unsigned long milliseconds)
+{
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStateMonitor);
+    return mStateMonitor.timedWait(IceUtil::Time::milliSeconds(milliseconds));
+}
diff --git a/test/BridgeListenerI.h b/test/BridgeListenerI.h
index 075a4f7..136739e 100644
--- a/test/BridgeListenerI.h
+++ b/test/BridgeListenerI.h
@@ -20,7 +20,19 @@ public:
     bool resetShuttingDown();
     bool resetStopped();
 
+    bool waitForAdded(unsigned long milliseconds, AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions);
+    bool waitForRemoved(unsigned long milliseconds, AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions);
+    bool waitForStopped(unsigned long milliseconds);
+
 private:
     bool mShuttingDown;
     bool mStopped;
+
+    IceUtil::Monitor<IceUtil::Mutex> mAddMonitor;
+    IceUtil::Monitor<IceUtil::Mutex> mRemoveMonitor;
+    IceUtil::Monitor<IceUtil::Mutex> mStateMonitor;
+    AsteriskSCF::SessionCommunications::V1::SessionSeq mAdded;
+    AsteriskSCF::SessionCommunications::V1::SessionSeq mRemoved;
+    bool mSessionsAdded;
+    bool mSessionsRemoved;
 };
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 6fdee13..3a62c2e 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -254,6 +254,13 @@ BOOST_AUTO_TEST_CASE(CreateBridgeFactory)
             BOOST_CHECK(servant->stoppedCalls() == 0);
             mgrPrx->shutdown();
             bridgeEnv.communicator()->waitForShutdown();
+            //
+            // Give IceStorm a chance to get the event to the listeners!
+            //
+            for(int i = 0; i < 3 && servant->stoppedCalls() < 1; ++i)
+            {
+                servant->wait(5000);
+            }
             BOOST_CHECK(servant->stoppingCalls() == 1);
         }
         catch(const Ice::Exception& ex)
@@ -308,7 +315,7 @@ BOOST_AUTO_TEST_CASE(CreateEmptyBridge)
             //
             // Give IceStorm a chance to get the event to the listeners!
             //
-            if(servant->stoppingCalls() < 1)
+            for(int i = 0; i < 3 && servant->stoppedCalls() < 1; ++i)
             {
                 servant->wait(5000);
             }
@@ -397,7 +404,7 @@ BOOST_AUTO_TEST_CASE(SimpleBridgingTest)
             //
             // Give IceStorm a chance to get the event to the listeners!
             //
-            if(servant->stoppingCalls() < 1)
+            for(int i = 0; i < 3 && servant->stoppedCalls() < 1; ++i)
             {
                 servant->wait(5000);
             }
@@ -458,50 +465,28 @@ BOOST_AUTO_TEST_CASE(BridgeManagerListeners)
             BOOST_CHECK(servant->createCalls() == 0);
             AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
             AsteriskSCF::SessionCommunications::Bridging::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
-            
-            AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
-            AsteriskSCF::SessionCommunications::V1::SessionPrx b = channel.getSession("312");
-            sessions.push_back(a);
-            sessions.push_back(b);
-            //
-            // precondition checks for test validity.
-            //
-            std::string idA = testEnv.communicator()->identityToString(a->ice_getIdentity());
-            std::string idB = testEnv.communicator()->identityToString(b->ice_getIdentity());
-            std::vector<std::string> log;
-            channel.commands()->getlog(idA, log);
-            BOOST_CHECK(!find(log, "start"));
-            channel.commands()->getlog(idB, log);
-            BOOST_CHECK(!find(log, "start"));
-            
-            bridge->addSessions(sessions);
-            channel.commands()->getlog(idA, log);
-            BOOST_CHECK(find(log, "start"));
-            channel.commands()->getlog(idB, log);
-            BOOST_CHECK(find(log, "start"));
+            servant->wait(5000);
+            BOOST_CHECK(servant->createCalls() == 1);
+            mgrPrx->removeListener(listenerPrx);
+            bridge = mgrPrx->createBridge(sessions, 0);
+            servant->wait(5000);
+            BOOST_CHECK(servant->createCalls() == 1);
+            mgrPrx->addListener(listenerPrx);
+            bridge = mgrPrx->createBridge(sessions, 0);
+            servant->wait(5000);
+            BOOST_CHECK(servant->createCalls() == 2);
 
-            //
-            // Should result in a media hookup!
-            //
-            channel.commands()->answer(idA);
-            channel.commands()->answer(idB);
-            
             mgrPrx->shutdown();
             bridgeEnv.communicator()->waitForShutdown();
             //
             // Give IceStorm a chance to get the event to the listeners!
             //
-            if(servant->stoppingCalls() < 1)
+            for(int i = 0; i < 3 && servant->stoppedCalls() < 1; ++i)
             {
                 servant->wait(5000);
             }
             BOOST_CHECK(servant->stoppingCalls() == 1);
             BOOST_CHECK(servant->stoppedCalls() == 1);
-            BOOST_CHECK(servant->createCalls() == 1);
-            channel.commands()->getlog(idA, log);
-            BOOST_CHECK(find(log, "stop"));
-            channel.commands()->getlog(idB, log);
-            BOOST_CHECK(find(log, "stop"));
         }
         catch(const Ice::Exception& ex)
         {

commit c10bda1ee43be07c23fe35b8c55abb310f28d778
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Sep 15 10:06:00 2010 -0230

    Modified to use updated channel driver that allows multiple instances
    of endpoint to be created and destroyed.

diff --git a/test/BridgeManagerListenerI.cpp b/test/BridgeManagerListenerI.cpp
index e88f404..37f0781 100644
--- a/test/BridgeManagerListenerI.cpp
+++ b/test/BridgeManagerListenerI.cpp
@@ -17,15 +17,27 @@ BridgeManagerListenerI::BridgeManagerListenerI() :
 void BridgeManagerListenerI::bridgeCreated(const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx& manager,
         const AsteriskSCF::SessionCommunications::Bridging::V1::BridgePrx& bridge, const Ice::Current&)
 {
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mMonitor);
     ++mCreated;
+    mMonitor.notify();
 }
 
 void BridgeManagerListenerI::stopped(const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx& manager, const Ice::Current&)
 {
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mMonitor);
     ++mStopped;
+    mMonitor.notify();
 }
 
 void BridgeManagerListenerI::stopping(const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx& manager, const Ice::Current&)
 {
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mMonitor);
     ++mStopping;
+    mMonitor.notify();
+}
+
+bool BridgeManagerListenerI::wait(unsigned long milliseconds)
+{
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mMonitor);
+    return mMonitor.timedWait(IceUtil::Time::milliSeconds(milliseconds));
 }
diff --git a/test/BridgeManagerListenerI.h b/test/BridgeManagerListenerI.h
index ebb9570..8541c18 100644
--- a/test/BridgeManagerListenerI.h
+++ b/test/BridgeManagerListenerI.h
@@ -21,7 +21,11 @@ public:
     unsigned long createCalls() { return mCreated; }
     unsigned long stoppedCalls() { return mStopped; }
     unsigned long stoppingCalls() { return mStopping; }
+
+    bool wait(unsigned long milliseconds);
+    
 private:
+    IceUtil::Monitor<IceUtil::Mutex> mMonitor;
     unsigned long mCreated;
     unsigned long mStopped;
     unsigned long mStopping;
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 32e265d..6fdee13 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -156,7 +156,7 @@ public:
         mAdapter = mCommunicator->createObjectAdapter(adapterName);
         mAdapter->activate();
         mDriver = new TestCommandDriver;
-        mLocator = AsteriskSCF::TestUtil::TestEndpoint::initialize(mDriver, mAdapter, id);
+        mLocator = AsteriskSCF::TestUtil::TestEndpoint::create(mDriver, mAdapter, id);
         addServant(mLocatorPrx, mAdapter, mLocator, mCommunicator->stringToIdentity(id));
     }
 
@@ -179,8 +179,12 @@ public:
     AsteriskSCF::SessionCommunications::V1::SessionPrx getSession(const std::string& id)
     {
         AsteriskSCF::Core::Endpoint::V1::EndpointSeq eps = mLocatorPrx->lookup(id);
-        assert(eps.size() > 0);
-        return AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx::checkedCast(eps[0])->createSession(id, 0);
+        assert(eps.size() > 0 && eps[0] != 0);
+        AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx proxy(AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx::checkedCast(eps[0]));
+        assert(proxy);
+        AsteriskSCF::SessionCommunications::V1::SessionPrx session(proxy->createSession(id, 0));
+        assert(session);
+        return session;
     }
 
     CommandsPtr commands()
@@ -249,6 +253,7 @@ BOOST_AUTO_TEST_CASE(CreateBridgeFactory)
             BOOST_CHECK(servant->stoppingCalls() == 0);
             BOOST_CHECK(servant->stoppedCalls() == 0);
             mgrPrx->shutdown();
+            bridgeEnv.communicator()->waitForShutdown();
             BOOST_CHECK(servant->stoppingCalls() == 1);
         }
         catch(const Ice::Exception& ex)
@@ -300,6 +305,13 @@ BOOST_AUTO_TEST_CASE(CreateEmptyBridge)
             AsteriskSCF::SessionCommunications::Bridging::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
             mgrPrx->shutdown();
             bridgeEnv.communicator()->waitForShutdown();
+            //
+            // Give IceStorm a chance to get the event to the listeners!
+            //
+            if(servant->stoppingCalls() < 1)
+            {
+                servant->wait(5000);
+            }
             BOOST_CHECK(servant->stoppingCalls() == 1);
             BOOST_CHECK(servant->stoppedCalls() == 1);
             BOOST_CHECK(servant->createCalls() == 1);
@@ -382,6 +394,13 @@ BOOST_AUTO_TEST_CASE(SimpleBridgingTest)
             
             mgrPrx->shutdown();
             bridgeEnv.communicator()->waitForShutdown();
+            //
+            // Give IceStorm a chance to get the event to the listeners!
+            //
+            if(servant->stoppingCalls() < 1)
+            {
+                servant->wait(5000);
+            }
             BOOST_CHECK(servant->stoppingCalls() == 1);
             BOOST_CHECK(servant->stoppedCalls() == 1);
             BOOST_CHECK(servant->createCalls() == 1);
@@ -406,1802 +425,96 @@ BOOST_AUTO_TEST_CASE(SimpleBridgingTest)
     }
 }
 
-#if 0
-BOOST_AUTO_TEST_CASE(BridgeEndpointValidationAddInvalidType)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        AsteriskSCF::BridgeService::BridgeImplPtr b(new AsteriskSCF::BridgeService::BridgeImpl(adapter, 0, AsteriskSCF::Session::V1::SessionEndpointSeq(), 0, 0));
-        try
-        {
-            Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Core::Endpoint::V1::BaseEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            b->addEndpoint(p, dummy);
-            BOOST_CHECK("Should not have succeeded" == 0);
-        }
-        catch(Hydra::Core::Bridging::V1::UnsupportedEndpoint&)
-        {
-            BOOST_CHECK(true);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeEndpointValidationAddInvalidValue)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeImplPtr b(new Hydra::BridgeService::BridgeImpl(adapter, 0, Hydra::Session::V1::SessionEndpointSeq(), 0, 0));
-        try
-        {
-            b->addEndpoint(0, dummy);
-            BOOST_CHECK("Should not have succeeded" == 0);
-        }
-        catch(Hydra::Core::Endpoint::V1::InvalidEndpointId&)
-        {
-            BOOST_CHECK(true);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
 
-BOOST_AUTO_TEST_CASE(BridgeEndpointValidationAddValidTypeNullId)
+//
+// Employs the test channel driver to create a *live* test.
+//
+BOOST_AUTO_TEST_CASE(BridgeManagerListeners)
 {
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    Hydra::BridgeService::BridgeImplPtr b(new Hydra::BridgeService::BridgeImpl(adapter, 0, Hydra::Session::V1::SessionEndpointSeq(), 0, 0));
+    UseIceStorm iceStorm;
     try
     {
+        IceEnvironment testEnv;
+        IceEnvironment bridgeEnv;
+        TestChannelDriver channel;
         try
         {
-            Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-            p->mediaSession = createTestSession(adapter, "testsession");
-            p->command = createTestCommand(adapter);
-            b->addEndpoint(p, dummy);
-            BOOST_CHECK("Should not have succeeded" == 0);
-        }
-        catch(Hydra::Core::Endpoint::V1::InvalidEndpointId&)
-        {
-            BOOST_CHECK(true);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
+            Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
+            testAdapter->activate();
+            BridgeManagerListenerIPtr servant = new BridgeManagerListenerI;
+            AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerListenerPrx listenerPrx;
+            addServant(listenerPrx, testAdapter, servant, testEnv.strToIdent("testBridgeManagerListener"));
 
-BOOST_AUTO_TEST_CASE(BridgeEndpointValidationAddValidTypeInvalidId)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    Hydra::BridgeService::BridgeImplPtr b(new Hydra::BridgeService::BridgeImpl(adapter, 0, Hydra::Session::V1::SessionEndpointSeq(), 0, 0));
-    try
-    {
-        try
-        {
-            Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "";
-            p->id->destinationId = "";
-            p->mediaSession = createTestSession(adapter, "testsession");
-            p->command = createTestCommand(adapter);
-            b->addEndpoint(p, dummy);
-            BOOST_CHECK("Should not have succeeded" == 0);
-        }
-        catch(Hydra::Core::Endpoint::V1::InvalidEndpointId& ex)
-        {
-            BOOST_CHECK(ex.badId->endpointManagerId == "");
-            BOOST_CHECK(ex.badId->destinationId == "");
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
+            Ice::ObjectAdapterPtr bridgeAdapter = bridgeEnv.communicator()->createObjectAdapter("TestBridgeAdapter");
+            bridgeAdapter->activate();
+            AsteriskSCF::BridgeService::BridgeManagerImplPtr mgrServant(
+                new AsteriskSCF::BridgeService::BridgeManagerImpl(bridgeAdapter, "TestBridgeManager"));
+            AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx mgrPrx;
+            addServant(mgrPrx, bridgeAdapter, mgrServant, bridgeEnv.strToIdent("testBridgeManager"));
+            mgrServant->setPublishProxy(mgrPrx);
+            mgrPrx->addListener(listenerPrx);
+            BOOST_CHECK(servant->stoppingCalls() == 0);
+            BOOST_CHECK(servant->stoppedCalls() == 0);
+            BOOST_CHECK(servant->createCalls() == 0);
+            AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
+            AsteriskSCF::SessionCommunications::Bridging::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+            
+            AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
+            AsteriskSCF::SessionCommunications::V1::SessionPrx b = channel.getSession("312");
+            sessions.push_back(a);
+            sessions.push_back(b);
+            //
+            // precondition checks for test validity.
+            //
+            std::string idA = testEnv.communicator()->identityToString(a->ice_getIdentity());
+            std::string idB = testEnv.communicator()->identityToString(b->ice_getIdentity());
+            std::vector<std::string> log;
+            channel.commands()->getlog(idA, log);
+            BOOST_CHECK(!find(log, "start"));
+            channel.commands()->getlog(idB, log);
+            BOOST_CHECK(!find(log, "start"));
+            
+            bridge->addSessions(sessions);
+            channel.commands()->getlog(idA, log);
+            BOOST_CHECK(find(log, "start"));
+            channel.commands()->getlog(idB, log);
+            BOOST_CHECK(find(log, "start"));
 
-BOOST_AUTO_TEST_CASE(BridgeEndpointAddValidTypeValidValue)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    Hydra::BridgeService::BridgeImplPtr b(new Hydra::BridgeService::BridgeImpl(adapter, 0, Hydra::Session::V1::SessionEndpointSeq(), 0, 0));
-    try
-    {
-        try
-        {
-            Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            p->mediaSession = createTestSession(adapter, "testsession");
-            p->command = createTestCommand(adapter);
-            b->addEndpoint(p, dummy);
-            BOOST_CHECK(true);
-        }
-        catch(...)
-        {
-            BOOST_CHECK("Unexpected exception thrown!" == 0);
+            //
+            // Should result in a media hookup!
+            //
+            channel.commands()->answer(idA);
+            channel.commands()->answer(idB);
+            
+            mgrPrx->shutdown();
+            bridgeEnv.communicator()->waitForShutdown();
+            //
+            // Give IceStorm a chance to get the event to the listeners!
+            //
+            if(servant->stoppingCalls() < 1)
+            {
+                servant->wait(5000);
+            }
+            BOOST_CHECK(servant->stoppingCalls() == 1);
+            BOOST_CHECK(servant->stoppedCalls() == 1);
+            BOOST_CHECK(servant->createCalls() == 1);
+            channel.commands()->getlog(idA, log);
+            BOOST_CHECK(find(log, "stop"));
+            channel.commands()->getlog(idB, log);
+            BOOST_CHECK(find(log, "stop"));
         }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeEndpointListEp)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    Hydra::BridgeService::BridgeImplPtr b(new Hydra::BridgeService::BridgeImpl(adapter, 0, Hydra::Session::V1::SessionEndpointSeq(), 0, 0));
-    try
-    {
-        try
+        catch(const Ice::Exception& ex)
         {
-            Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            p->mediaSession = createTestSession(adapter, "testsession");
-            p->command = createTestCommand(adapter);
-            b->addEndpoint(p, dummy);
-            Hydra::Core::Endpoint::V1::EndpointSeq endpoints = b->listEndpoints(dummy);
-            BOOST_CHECK(endpoints.size() == 1);
-            BOOST_CHECK(endpoints.back()->id->endpointManagerId == "foo" && endpoints.back()->id->destinationId == "bar");
+            std::cerr << ex << std::endl;
+            BOOST_CHECK(false);
         }
         catch(...)
         {
-            BOOST_CHECK("Unexpected exception thrown!" == 0);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryCreateBridgeWithInvalidAdminEndpoint)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-
-        try
-        {
-            Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Core::Endpoint::V1::BaseEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(p, Hydra::Core::Endpoint::V1::EndpointSeq(), 0, dummy);
-            BOOST_CHECK("Should not have succeeded" == 0);
-        }
-        catch(const Hydra::Core::Bridging::V1::UnsupportedEndpoint& x)
-        {
-            BOOST_CHECK(x.ep->endpointManagerId == "foo" && x.ep->destinationId == "bar");
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryCreateBridgeWithInvalidAdminEndpointId)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-
-        try
-        {
-            Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "";
-            p->id->destinationId = "";
-
-            Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-            Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-            Hydra::Core::Bridging::V1::BridgeMonitorPrx monitor;
-            Hydra::Core::Bridging::V1::BridgePrx b = factory->createBridge(p, Hydra::Core::Endpoint::V1::EndpointSeq(), 0, dummy);
-            BOOST_CHECK("Should not have succeeded" == 0);
-        }
-        catch(const Hydra::Core::Endpoint::V1::InvalidEndpointId& id)
-        {
-            BOOST_CHECK(true);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryCreateBridgeWithValidAdminEndpoint)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(p, Hydra::Core::Endpoint::V1::EndpointSeq(), 0, dummy);
-        BOOST_CHECK(b);
-        Hydra::Core::Endpoint::V1::EndpointSeq endpoints = b->listEndpoints();
-        BOOST_CHECK(endpoints.size() == 1);
-        BOOST_CHECK(endpoints.back()->id->endpointManagerId == "foo" && endpoints.back()->id->destinationId == "bar");
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryEmptyBridge)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-        Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(0, Hydra::Core::Endpoint::V1::EndpointSeq(), 0, dummy);
-        BOOST_CHECK(b);
-        Hydra::Core::Endpoint::V1::EndpointSeq endpoints = b->listEndpoints();
-        BOOST_CHECK(endpoints.size() == 0);
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryInitialEndpointInvalidType)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Core::Endpoint::V1::BaseEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-
-        Hydra::Core::Endpoint::V1::EndpointSeq eps;
-        eps.push_back(p);
-
-        Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(0, eps, 0, dummy);
-        BOOST_CHECK("Should not have succeeded" == 0);
-    }
-    catch(const Hydra::Core::Bridging::V1::UnsupportedEndpoint& ex)
-    {
-        BOOST_CHECK(ex.ep->endpointManagerId == "foo" && ex.ep->destinationId == "bar");
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryInitialEndpointNullId)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = 0;
-        Hydra::Core::Endpoint::V1::EndpointSeq eps;
-        eps.push_back(p);
-
-        Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(0, eps, 0, dummy);
-        BOOST_CHECK("Should not have succeeded" == 0);
-    }
-    catch(const Hydra::Core::Endpoint::V1::InvalidEndpointId&)
-    {
-        BOOST_CHECK(true);
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryInitialEndpointInvalidId)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "";
-        p->id->destinationId = "bar";
-
-        Hydra::Core::Endpoint::V1::EndpointSeq eps;
-        eps.push_back(p);
-
-        Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(0, eps, 0, dummy);
-        BOOST_CHECK("Should not have succeeded" == 0);
-    }
-    catch(const Hydra::Core::Endpoint::V1::InvalidEndpointId& ex)
-    {
-        BOOST_CHECK(ex.badId != 0);
-        BOOST_CHECK(ex.badId->endpointManagerId.size() == 0 && ex.badId->destinationId == "bar");
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryCreateBridgeWithValidEndpoint)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Core::Endpoint::V1::EndpointSeq eps;
-        eps.push_back(p);
-        Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(0, eps, 0, dummy);
-        BOOST_CHECK(b);
-        Hydra::Core::Endpoint::V1::EndpointSeq endpoints = b->listEndpoints();
-        BOOST_CHECK(endpoints.size() == 1);
-        BOOST_CHECK(endpoints.back()->id->endpointManagerId == "foo" && endpoints.back()->id->destinationId == "bar");
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryCreateBridgeWithCollidingAdminAndInitialEndpoint)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Core::Endpoint::V1::EndpointSeq eps;
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession1");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(p, eps, 0, dummy);
-        BOOST_CHECK("Should not have succeeded." == 0);
-    }
-    catch(const Hydra::Core::Bridging::V1::EndpointCollision& ex)
-    {
-        BOOST_CHECK(ex.first->endpointManagerId == "foo" && ex.first->destinationId == "bar");
-        BOOST_CHECK(ex.second->endpointManagerId == "foo" && ex.second->destinationId == "bar");
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryCreateBridgeWithCollisions)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Core::Endpoint::V1::EndpointSeq eps;
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession1");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(0, eps, 0, dummy);
-        BOOST_CHECK("Should not have succeeded." == 0);
-    }
-    catch(const Hydra::Core::Bridging::V1::EndpointCollision& ex)
-    {
-        BOOST_CHECK(ex.first->endpointManagerId == "foo" && ex.first->destinationId == "bar");
-        BOOST_CHECK(ex.second->endpointManagerId == "foo" && ex.second->destinationId == "bar");
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactoryCreateBridgeWithValidInitialSet)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Core::Endpoint::V1::EndpointSeq eps;
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo1";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession1");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar1";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession2");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "fooa";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession3");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(p, eps, 0, dummy);
-        BOOST_CHECK(b);
-        Hydra::Core::Endpoint::V1::EndpointSeq endpoints = b->listEndpoints();
-        BOOST_CHECK(endpoints.size() == 4);
-
-        //
-        // It so happens that we know the admin endpoint is inserted at the beginning of
-        // the result. If this changes, then so will the test.
-        //
-        eps.insert(eps.begin(), p);
-        Hydra::Core::Endpoint::V1::EndpointSeq::const_iterator j = endpoints.begin(); 
-        for(Hydra::Core::Endpoint::V1::EndpointSeq::const_iterator i = eps.begin(); i != eps.end(); ++i, ++j)
-        {
-            BOOST_CHECK((*i)->id->endpointManagerId == (*j)->id->endpointManagerId);
-            BOOST_CHECK((*i)->id->destinationId == (*j)->id->destinationId);
-            Hydra::Session::V1::SessionEndpointPtr sp(Hydra::Session::V1::SessionEndpointPtr::dynamicCast(*j));
-            BOOST_CHECK(sp);
-        }
-    }
-    catch(const Hydra::Core::Bridging::V1::EndpointCollision& ex)
-    {
-        BOOST_CHECK(ex.first->endpointManagerId == "foo" && ex.first->destinationId == "bar");
-        BOOST_CHECK(ex.second->endpointManagerId == "foo" && ex.second->destinationId == "bar");
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeAddEndpoint)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo1";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession1");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar1";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession2");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "fooa";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession3");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, p, eps, 0, 0));
-        eps.insert(eps.begin(), p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo2";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession4");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        bridge->addEndpoint(p, dummy);
-        eps.push_back(p);
-        Hydra::Core::Endpoint::V1::EndpointSeq endpoints = bridge->listEndpoints(dummy);
-        BOOST_CHECK(endpoints.size() == 5);
-
-        //
-        // It so happens that we know the admin endpoint is inserted at the beginning of
-        // the result. If this changes, then so will the test.
-        //
-        Hydra::Core::Endpoint::V1::EndpointSeq::const_iterator j = endpoints.begin(); 
-        for(Hydra::Session::V1::SessionEndpointSeq::const_iterator i = eps.begin(); i != eps.end(); ++i, ++j)
-        {
-            BOOST_CHECK((*i)->id->endpointManagerId == (*j)->id->endpointManagerId);
-            BOOST_CHECK((*i)->id->destinationId == (*j)->id->destinationId);
-            Hydra::Session::V1::SessionEndpointPtr sp(Hydra::Session::V1::SessionEndpointPtr::dynamicCast(*j));
-            BOOST_CHECK(sp);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeAddEndpointAlreadyRegistered)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo1";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession1");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar1";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession2");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "fooa";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession3");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, p, eps, 0, 0));
-        eps.insert(eps.begin(), p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        try
-        {
-            bridge->addEndpoint(p, dummy);
-        }
-        catch(const Hydra::Core::Bridging::V1::EndpointAlreadyRegistered& ex)
-        {
-            BOOST_CHECK(ex.ep->endpointManagerId == "foo" && ex.ep->destinationId == "bar");
-        }
-
-        Hydra::Core::Endpoint::V1::EndpointSeq endpoints = bridge->listEndpoints(dummy);
-        BOOST_CHECK(endpoints.size() == 4);
-
-        //
-        // It so happens that we know the admin endpoint is inserted at the beginning of
-        // the result. If this changes, then so will the test.
-        //
-        Hydra::Core::Endpoint::V1::EndpointSeq::const_iterator j = endpoints.begin(); 
-        for(Hydra::Session::V1::SessionEndpointSeq::const_iterator i = eps.begin(); i != eps.end(); ++i, ++j)
-        {
-            BOOST_CHECK((*i)->id->endpointManagerId == (*j)->id->endpointManagerId);
-            BOOST_CHECK((*i)->id->destinationId == (*j)->id->destinationId);
-            Hydra::Session::V1::SessionEndpointPtr sp(Hydra::Session::V1::SessionEndpointPtr::dynamicCast(*j));
-            BOOST_CHECK(sp);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeAddInvalidEndpoint)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, 0, eps, 0, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Core::Endpoint::V1::BaseEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "foo";
-        bridge->addEndpoint(p, dummy);
-        BOOST_CHECK("Should not have succeeded." == 0);
-    }
-    catch(const Hydra::Core::Bridging::V1::UnsupportedEndpoint& ex)
-    {
-        BOOST_CHECK(ex.ep->endpointManagerId == "foo" && ex.ep->destinationId == "foo");
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeAddInvalidId1)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, 0, eps, 0, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "";
-        p->id->destinationId = "";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        bridge->addEndpoint(p, dummy);
-        BOOST_CHECK("Should not have succeeded." == 0);
-    }
-    catch(const Hydra::Core::Endpoint::V1::InvalidEndpointId& ex)
-    {
-        BOOST_CHECK(ex.badId->endpointManagerId.size() == 0 && ex.badId->destinationId.size() == 0);
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeAddInvalidId2)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, 0, eps, 0, 0));
-        Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        bridge->addEndpoint(p, dummy);
-        BOOST_CHECK("Should not have succeeded." == 0);
-    }
-    catch(const Hydra::Core::Endpoint::V1::InvalidEndpointId& ex)
-    {
-        BOOST_CHECK(ex.badId->endpointManagerId.size() == 0 && ex.badId->destinationId.size() == 0);
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeRemoveEndpoint)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo1";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession1");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar1";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession2");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "fooa";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession3");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, p, eps, 0, 0));
-        eps.insert(eps.begin(), p);
-        Hydra::Core::Endpoint::V1::EndpointIdPtr id(new Hydra::Core::Endpoint::V1::EndpointId);
-        id->endpointManagerId = "foo1";
-        id->destinationId = "bar";
-        Hydra::Core::Endpoint::V1::EndpointSeq endpoints = bridge->listEndpoints(dummy);
-        BOOST_CHECK(endpoints.size() == 4);
-        bridge->removeEndpoint(id, dummy);
-        endpoints = bridge->listEndpoints(dummy);
-        BOOST_CHECK(endpoints.size() == 3);
-
-
-        //
-        // It so happens that we know the admin endpoint is inserted at the beginning of
-        // the result. If this changes, then so will the test.
-        //
-        for(Hydra::Core::Endpoint::V1::EndpointSeq::const_iterator j = endpoints.begin(); j != endpoints.end(); ++j)
-        {
-            BOOST_CHECK((*j)->id->endpointManagerId != id->endpointManagerId || (*j)->id->destinationId != id->destinationId);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeRemoveEndpointUnknownEndpoint)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo1";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession1");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "foo";
-        p->id->destinationId = "bar1";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession2");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        eps.push_back(p);
-        p = new Hydra::Session::V1::SessionEndpoint;
-        p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-        p->id->endpointManagerId = "fooa";
-        p->id->destinationId = "bar";
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession3");
-        Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, p, eps, 0, 0 ));
-        Hydra::Core::Endpoint::V1::EndpointIdPtr id(new Hydra::Core::Endpoint::V1::EndpointId);
-        id->endpointManagerId = "foo1";
-        id->destinationId = "unknown";
-        bridge->removeEndpoint(id, dummy);
-        BOOST_CHECK("Should not have succeeded." == 0);
-    }
-    catch(const Hydra::Core::Bridging::V1::UnknownEndpoint& ex)
-    {
-        BOOST_CHECK(ex.ep->endpointManagerId == "foo1" && ex.ep->destinationId == "unknown");
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeRemoveEndpointNullId)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, 0, eps, 0, 0));
-        bridge->removeEndpoint(0, dummy);
-        BOOST_CHECK("Should not have succeeded." == 0);
-    }
-    catch(const Hydra::Core::Endpoint::V1::InvalidEndpointId& ex)
-    {
-        BOOST_CHECK(ex.badId == 0);
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeRemoveEndpointInvalidId)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, 0, eps, 0, 0));
-        Hydra::Core::Endpoint::V1::EndpointIdPtr id(new Hydra::Core::Endpoint::V1::EndpointId);
-        id->endpointManagerId = "";
-        id->destinationId = "";
-        bridge->removeEndpoint(id, dummy);
-        BOOST_CHECK("Should not have succeeded." == 0);
-    }
-    catch(const Hydra::Core::Endpoint::V1::InvalidEndpointId& ex)
-    {
-        BOOST_CHECK(ex.badId->endpointManagerId.size() == 0 && ex.badId->destinationId.size() == 0);
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-//
-// These are actually several very small test cases packed in one boost test case.
-// This simply checks to make sure that a bridge that is shutting down does 
-// try to perform any additional requests.
-//
-BOOST_AUTO_TEST_CASE(BridgeOperationsAfterShutdown)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, 0, eps, 0, 0));
-        bridge->shutdown(dummy);
-        //
-        // Calling shutdown while in the process of shutting down is permitted but is a no-op.
-        //
-        bridge->shutdown(dummy);
-        BOOST_CHECK("Calling shutdown while in the process of shutting down" != 0);
-        try
-        {
-            bridge->listEndpoints(dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Hydra::System::Component::V1::ShuttingDown&)
-        {
-        }
-        try
-        {
-            Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-            Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-            bridge->addEndpoint(p, dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Hydra::System::Component::V1::ShuttingDown&)
-        {
-        }
-        try
-        {
-            Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            bridge->removeEndpoint(p->id, dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Hydra::System::Component::V1::ShuttingDown&)
-        {
-        }
-        try
-        {
-            bridge->destroy(dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Hydra::System::Component::V1::ShuttingDown&)
-        {
-        }
-        try
-        {
-            Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Core::Endpoint::V1::BaseEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            bridge->addEndpoint(p, dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Hydra::Core::Bridging::V1::UnsupportedEndpoint&)
-        {
-            BOOST_CHECK("this occurs fo the time being" != 0);
-        }
-        catch(const Hydra::System::Component::V1::ShuttingDown&)
-        {
-            BOOST_CHECK("but this might happen in the future" != 0);
-        }
-        try
-        {
-            Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Core::Endpoint::V1::BaseEndpoint);
-            bridge->addEndpoint(p, dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Hydra::Core::Endpoint::V1::InvalidEndpointId&)
-        {
-            BOOST_CHECK("this occurs fo the time being" != 0);
-        }
-        catch(const Hydra::System::Component::V1::ShuttingDown&)
-        {
-            BOOST_CHECK("but this might happen in the future" != 0);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-//
-// These are actually several very small test cases packed in one boost test case.
-// This simply checks to make sure that a bridge that is in the process of being 
-// destroy does not try to perform any additional requests.
-//
-BOOST_AUTO_TEST_CASE(BridgeOperationsAfterDestroy)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::Session::V1::SessionEndpointSeq eps;
-        Hydra::BridgeService::BridgeImplPtr bridge(new Hydra::BridgeService::BridgeImpl(adapter, 0, eps, 0, 0));
-        Hydra::Core::Bridging::V1::BridgePrx bridgePrx =
-            Hydra::Core::Bridging::V1::BridgePrx::checkedCast(adapter->addWithUUID(bridge));
-        bridgePrx->destroy();
-        //
-        // Calling shutdown while in the process of shutting down is permitted but is a no-op.
-        //
-        BOOST_CHECK("Calling shutdown while in the process of shutting down" != 0);
-        try
-        {
-            bridge->listEndpoints(dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Ice::ObjectNotExistException&)
-        {
-            BOOST_CHECK(true);
-        }
-        catch(const Ice::NotRegisteredException&)
-        {
-            BOOST_CHECK(true);
-        }
-        try
-        {
-            Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->mediaSession = createTestSession(adapter, "testsession");
-            Hydra::Session::V1::SessionEndpointPtr::dynamicCast(p)->command = createTestCommand(adapter);
-            bridge->addEndpoint(p, dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Ice::ObjectNotExistException&)
-        {
-        }
-        catch(const Ice::NotRegisteredException&)
-        {
-            BOOST_CHECK(true);
-        }
-        try
-        {
-            Hydra::Session::V1::SessionEndpointPtr p(new Hydra::Session::V1::SessionEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            bridge->removeEndpoint(p->id, dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Ice::ObjectNotExistException&)
-        {
-            BOOST_CHECK(true);
-        }
-        catch(const Ice::NotRegisteredException&)
-        {
-            BOOST_CHECK(true);
-        }
-        try
-        {
-            bridge->destroy(dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Ice::ObjectNotExistException&)
-        {
-            BOOST_CHECK(true);
-        }
-        catch(const Ice::NotRegisteredException&)
-        {
-            BOOST_CHECK(true);
-        }
-        try
-        {
-            Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Core::Endpoint::V1::BaseEndpoint);
-            p->id = new Hydra::Core::Endpoint::V1::EndpointId;
-            p->id->endpointManagerId = "foo";
-            p->id->destinationId = "bar";
-            bridge->addEndpoint(p, dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Hydra::Core::Bridging::V1::UnsupportedEndpoint&)
-        {
-            BOOST_CHECK("this occurs fo the time being" != 0);
-        }
-        catch(const Hydra::System::Component::V1::ShuttingDown&)
-        {
-            BOOST_CHECK("but this might happen in the future" != 0);
-        }
-        catch(const Ice::ObjectNotExistException&)
-        {
-            BOOST_CHECK(true);
-        }
-        catch(const Ice::NotRegisteredException&)
-        {
-            BOOST_CHECK(true);
-        }
-        try
-        {
-            Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Core::Endpoint::V1::BaseEndpoint);
-            bridge->addEndpoint(p, dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Hydra::Core::Endpoint::V1::InvalidEndpointId&)
-        {
-            BOOST_CHECK("this occurs fo the time being" != 0);
-        }
-        catch(const Hydra::System::Component::V1::ShuttingDown&)
-        {
-            BOOST_CHECK("but this might happen in the future" != 0);
-        }
-        catch(const Ice::ObjectNotExistException&)
-        {
-            BOOST_CHECK(true);
-        }
-        catch(const Ice::NotRegisteredException&)
-        {
-            BOOST_CHECK(true);
-        }
-        try
-        {
-            Hydra::Core::Endpoint::V1::BaseEndpointPtr p(new Hydra::Core::Endpoint::V1::BaseEndpoint);
-            bridge->shutdown(dummy);
-            BOOST_CHECK("should not have succeeded." == 0);
-        }
-        catch(const Ice::ObjectNotExistException&)
-        {
-            BOOST_CHECK(true);
-        }
-        catch(const Ice::NotRegisteredException&)
-        {
-            BOOST_CHECK(true);
-        }
-    }
-    catch(...)
-    {
-        adapter->destroy();
-        throw;
-    }
-    adapter->destroy();
-}
-
-BOOST_AUTO_TEST_CASE(BridgeFactorySuspendedState)
-{
-    Ice::InitializationData initData;
-    initData.properties = Ice::createProperties(0);
-    initData.properties->setProperty("TestBridging.Endpoints", "default -p 33333 -t 10000");
-    initData.properties->setProperty("Ice.ThreadPool.Server.Size", "5");
-    initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
-    Ice::CommunicatorPtr comm = Ice::initialize(initData);
-    Ice::ObjectAdapterPtr adapter = comm->createObjectAdapter("TestBridging");
-    adapter->activate();
-    Ice::Current dummy;
-    dummy.adapter = adapter;
-    dummy.id = comm->stringToIdentity("testobject");
-    try
-    {
-        Hydra::BridgeService::BridgeFactoryImplPtr factory(new Hydra::BridgeService::BridgeFactoryImpl(adapter, 0));
-
-        try
-        {
-            factory->suspend(dummy);
-
-            // 
-            // This should be ok.
-            //
-            factory->suspend(dummy);
-            try
-            {
-                Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(0, Hydra::Core::Endpoint::V1::EndpointSeq(), 0,dummy);
-                BOOST_CHECK("Should not have succeeded" == 0);
-            }
-            catch(const Hydra::System::Component::V1::Suspended&)
-            {
-                BOOST_CHECK(true);
-            }
-            try
-            {
-                factory->shutdown(dummy);
-                BOOST_CHECK("Should not have succeeded" == 0);
-            }
-            catch(const Hydra::System::Component::V1::Suspended&)
-            {
-                BOOST_CHECK(true);
-            }
-            factory->resume(dummy);
-            factory->shutdown(dummy);
-            try
-            {
-                Hydra::Core::Bridging::V1::BridgePrx b =  factory->createBridge(0, Hydra::Core::Endpoint::V1::EndpointSeq(), 0, dummy);
-                BOOST_CHECK("Should not have succeeded" == 0);
-            }
-            catch(const Hydra::System::Component::V1::ShuttingDown&)
-            {
-                BOOST_CHECK(true);
-            }
-            try
-            {
-                factory->suspend(dummy);
-                BOOST_CHECK("Should not have succeeded" == 0);
-            }
-            catch(const Hydra::System::Component::V1::ShuttingDown&)
-            {
-                BOOST_CHECK(true);
-            }
-            try
-            {
-                factory->resume(dummy);
-                BOOST_CHECK("Should not have succeeded" == 0);
-            }
-            catch(const Hydra::System::Component::V1::ShuttingDown&)
-            {
-                BOOST_CHECK(true);
-            }
... 1109 lines suppressed ...


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list