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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Sep 21 14:15:55 CDT 2011


branch "master" has been updated
       via  649687f8e6d0723c82155cf25b7f2fbe014b6517 (commit)
      from  2791d5926944131ea67ddd03ea9011632d47803a (commit)

Summary of changes:
 config/test_bridging.conf |    2 +-
 test/BridgeListenerI.cpp  |   19 +++++++++++++------
 test/BridgeListenerI.h    |    4 +++-
 test/TestBridging.cpp     |   11 +++++++++--
 4 files changed, 26 insertions(+), 10 deletions(-)


- Log -----------------------------------------------------------------
commit 649687f8e6d0723c82155cf25b7f2fbe014b6517
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Sep 21 16:44:53 2011 -0230

    Fix component test config file to indicate the secondary is actually in standby
    mode and fix the test suite to wait on different monitors for steps along
    the lifecycle instead of sharing a single monitor.

diff --git a/config/test_bridging.conf b/config/test_bridging.conf
index 35eced0..a2c794d 100644
--- a/config/test_bridging.conf
+++ b/config/test_bridging.conf
@@ -84,7 +84,7 @@ TestBridge.Standby=false
 
 TestBridge2.InstanceName=TestBridge2
 TestBridge2.BridgeManagerObjectId=TestBridgeManager2
-TestBridge2.Standby=false
+TestBridge2.Standby=true
 TestBridge2.ServiceAdapter.Endpoints=default -p 57010
 TestBridge2.ServiceAdapter.ThreadPool.Size=4
 TestBridge2.BackplaneAdapter.Endpoints=default -p 57011
diff --git a/test/BridgeListenerI.cpp b/test/BridgeListenerI.cpp
index 8a95767..1d47802 100644
--- a/test/BridgeListenerI.cpp
+++ b/test/BridgeListenerI.cpp
@@ -48,18 +48,18 @@ void BridgeListenerI::stopping(const AsteriskSCF::SessionCommunications::V1::Bri
     const AsteriskSCF::SessionCommunications::V1::BridgeCookies& cookies, const Ice::Current&)
 {
     updateCookieMap("stopping", cookies);
-    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStateMonitor);
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStoppingMonitor);
     mShuttingDown = true;
-    mStateMonitor.notify();
+    mStoppingMonitor.notify();
 }
 
 void BridgeListenerI::stopped(const AsteriskSCF::SessionCommunications::V1::BridgePrx&, 
     const AsteriskSCF::SessionCommunications::V1::BridgeCookies& cookies, const Ice::Current&)
 {
     updateCookieMap("stopped", cookies);
-    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStateMonitor);
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStoppedMonitor);
     mStopped = true;
-    mStateMonitor.notify();
+    mStoppedMonitor.notify();
 }
 
 bool BridgeListenerI::resetShuttingDown()
@@ -98,11 +98,18 @@ bool BridgeListenerI::waitForRemoved(unsigned long milliseconds, AsteriskSCF::Se
 
 bool BridgeListenerI::waitForStopped(unsigned long milliseconds)
 {
-    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStateMonitor);
-    mStateMonitor.timedWait(IceUtil::Time::milliSeconds(milliseconds));
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStoppedMonitor);
+    mStoppedMonitor.timedWait(IceUtil::Time::milliSeconds(milliseconds));
     return mStopped;
 }
 
+bool BridgeListenerI::waitForStopping(unsigned long milliseconds)
+{
+    IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStoppingMonitor);
+    mStoppingMonitor.timedWait(IceUtil::Time::milliSeconds(milliseconds));
+    return mShuttingDown;
+}
+
 size_t BridgeListenerI::addedCount()
 {
     return mAdded.size();
diff --git a/test/BridgeListenerI.h b/test/BridgeListenerI.h
index 881de6b..05f12b9 100644
--- a/test/BridgeListenerI.h
+++ b/test/BridgeListenerI.h
@@ -45,6 +45,7 @@ public:
     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);
+    bool waitForStopping(unsigned long milliseconds);
 
     size_t addedCount();
     size_t removedCount();
@@ -57,7 +58,8 @@ private:
 
     IceUtil::Monitor<IceUtil::Mutex> mAddMonitor;
     IceUtil::Monitor<IceUtil::Mutex> mRemoveMonitor;
-    IceUtil::Monitor<IceUtil::Mutex> mStateMonitor;
+    IceUtil::Monitor<IceUtil::Mutex> mStoppingMonitor;
+    IceUtil::Monitor<IceUtil::Mutex> mStoppedMonitor;
 
     IceUtil::Monitor<IceUtil::Mutex> mCookieMapMonitor;
     CookieMap mCookieMap;
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 088e85f..f988c68 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -935,7 +935,7 @@ public:
                 //
                 mgrPrx->listBridges();
 
-                BOOST_CHECK(servant->createCalls() == 1); // XXX
+                BOOST_CHECK(servant->createCalls() == 1);
                 mgrPrx->removeListener(listenerPrx);
                 
                 bridge = mgrPrx->createBridge(sessions, 0);
@@ -967,8 +967,15 @@ public:
                 BOOST_CHECK(secondaryReplica->isActive() == true);
 
                 BridgeSeq bridges2 = mgrPrx2->listBridges();
+                if (bridges.size() != bridges2.size())
+                {
+                    stringstream os;
+                    os << __FILE__ << ':' << __LINE__ << " Bridge count differs, primary: " << bridges.size() << " vs: "
+                        << bridges2.size();
+                    BOOST_MESSAGE(os.str());
+                }
 
-                BOOST_CHECK(bridges.size() == bridges2.size()); // XXX
+                BOOST_CHECK(bridges.size() == bridges2.size());
 
                 // Set the components back to original state.
                 secondaryReplica->standby();

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


-- 
asterisk-scf/release/bridging.git



More information about the asterisk-scf-commits mailing list