[asterisk-scf-commits] asterisk-scf/release/routing.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Apr 19 07:15:32 CDT 2011
branch "master" has been updated
via b3ca1721ff1e4ff3f5dab1f3e18daf95246bd9fa (commit)
from 42c99da77483e81f27dd51caf997df6f3999b6f3 (commit)
Summary of changes:
test/MockBridge.cpp | 76 ++++++++++++++++++++++++++++++++++---------
test/MockBridge.h | 12 +++++--
test/MockBridgeManager.cpp | 26 +++++++++++----
test/MockBridgeManager.h | 4 ++-
4 files changed, 91 insertions(+), 27 deletions(-)
- Log -----------------------------------------------------------------
commit b3ca1721ff1e4ff3f5dab1f3e18daf95246bd9fa
Author: Brent Eagles <beagles at digium.com>
Date: Tue Apr 19 09:44:02 2011 -0230
Merge async-bridging branch. Some bridging methods were changed
to use AMD so the mock objects in the routing test suite needed
to be updated.
diff --git a/test/MockBridge.cpp b/test/MockBridge.cpp
index b85244d..38ff06b 100644
--- a/test/MockBridge.cpp
+++ b/test/MockBridge.cpp
@@ -77,7 +77,7 @@ MockBridge::MockBridge(const SessionSeq& sessions, const BridgeListenerPrx&)
Ice::ObjectPrx bridgeObjectPrx = SharedTestData::instance.adapterIn->addWithUUID(this);
mBridgePrx = BridgePrx::checkedCast(bridgeObjectPrx);
- addSessions(sessions);
+ addSessionsImpl(sessions);
}
MockBridge::~MockBridge()
@@ -88,22 +88,42 @@ MockBridge::~MockBridge()
mListener = 0;
}
-void MockBridge::addSessions(const SessionSeq& newSessions, const Ice::Current&)
+void MockBridge::addSessions_async(const AMD_Bridge_addSessionsPtr& callback, const SessionSeq& newSessions,
+ const Ice::Current&)
{
- mSessions.reserve( mSessions.size() + newSessions.size());
- mSessions.insert( mSessions.end(), newSessions.begin(), newSessions.end());
-
- for (SessionSeq::const_iterator s = newSessions.begin(); s != newSessions.end(); ++s)
+ try
{
- (*s)->setBridge(mBridgePrx, mListenerPrx);
+ addSessionsImpl(newSessions);
+ callback->ice_response();
+ }
+ catch (const std::exception& ex)
+ {
+ callback->ice_exception(ex);
+ }
+ catch (...)
+ {
+ callback->ice_exception();
}
}
-void MockBridge::removeSessions(const SessionSeq& sessions, const Ice::Current&)
+void MockBridge::removeSessions_async(const AMD_Bridge_removeSessionsPtr& callback, const SessionSeq& sessions,
+ const Ice::Current&)
{
- for(SessionSeq::const_iterator s = sessions.begin(); s != sessions.end(); ++s)
+ try
+ {
+ for(SessionSeq::const_iterator s = sessions.begin(); s != sessions.end(); ++s)
+ {
+ removeSession(*s);
+ }
+ callback->ice_response();
+ }
+ catch (const std::exception& ex)
+ {
+ callback->ice_exception(ex);
+ }
+ catch (...)
{
- removeSession(*s);
+ callback->ice_exception();
}
}
@@ -141,17 +161,30 @@ void MockBridge::shutdown(const Ice::Current&)
{
}
-void MockBridge::replaceSession(const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
+void MockBridge::replaceSession_async(const AsteriskSCF::SessionCommunications::V1::AMD_Bridge_replaceSessionPtr& cb,
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions,
const Ice::Current&)
{
- SharedTestData::instance.mSessionReplaced = true;
+ try
+ {
+ SharedTestData::instance.mSessionReplaced = true;
- removeSession(sessionToReplace);
- addSessions(newSessions);
+ removeSession(sessionToReplace);
+ addSessionsImpl(newSessions);
- ResponseCodePtr response = new ResponseCode(1);
- sessionToReplace->stop(response);
+ ResponseCodePtr response = new ResponseCode(1);
+ sessionToReplace->stop(response);
+ cb->ice_response();
+ }
+ catch (const std::exception& ex)
+ {
+ cb->ice_exception(ex);
+ }
+ catch (...)
+ {
+ cb->ice_exception();
+ }
}
void MockBridge::connected(const AsteriskSCF::SessionCommunications::V1::SessionPrx&)
@@ -159,6 +192,17 @@ void MockBridge::connected(const AsteriskSCF::SessionCommunications::V1::Session
SharedTestData::instance.mBridgeConnected = true;
}
+void MockBridge::addSessionsImpl(const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions)
+{
+ mSessions.reserve( mSessions.size() + newSessions.size());
+ mSessions.insert( mSessions.end(), newSessions.begin(), newSessions.end());
+
+ for (SessionSeq::const_iterator s = newSessions.begin(); s != newSessions.end(); ++s)
+ {
+ (*s)->setBridge(mBridgePrx, mListenerPrx);
+ }
+}
+
} // RoutingTest
} // AsteriskSCF
diff --git a/test/MockBridge.h b/test/MockBridge.h
index 5a116bb..92b4d46 100644
--- a/test/MockBridge.h
+++ b/test/MockBridge.h
@@ -34,16 +34,20 @@ public:
~MockBridge();
// Overrides
- void addSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions, const Ice::Current& = ::Ice::Current());
+ void addSessions_async(const AsteriskSCF::SessionCommunications::V1::AMD_Bridge_addSessionsPtr&,
+ const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions,
+ const Ice::Current& = ::Ice::Current());
void destroy(const Ice::Current& ) ;
- void removeSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq&, const Ice::Current&);
+ void removeSessions_async(const AsteriskSCF::SessionCommunications::V1::AMD_Bridge_removeSessionsPtr&,
+ const AsteriskSCF::SessionCommunications::V1::SessionSeq&, const Ice::Current&);
AsteriskSCF::SessionCommunications::V1::SessionSeq listSessions(const Ice::Current&);
void shutdown(const Ice::Current&) ;
void addListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current& );
void removeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current& );
- void replaceSession(const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
+ void replaceSession_async(const AsteriskSCF::SessionCommunications::V1::AMD_Bridge_replaceSessionPtr&,
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions,
const Ice::Current&);
@@ -57,6 +61,8 @@ private:
BridgeSessionListenerPtr mListener;
AsteriskSCF::SessionCommunications::V1::SessionListenerPrx mListenerPrx;
AsteriskSCF::SessionCommunications::V1::BridgePrx mBridgePrx;
+
+ void addSessionsImpl(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions);
};
} // RoutingTest
diff --git a/test/MockBridgeManager.cpp b/test/MockBridgeManager.cpp
index 2210c31..5b1d58d 100644
--- a/test/MockBridgeManager.cpp
+++ b/test/MockBridgeManager.cpp
@@ -30,16 +30,28 @@ void MockBridgeManager::addListener(const BridgeManagerListenerPrx&, const Ice::
{
}
-BridgePrx MockBridgeManager::createBridge(const SessionSeq& sessions, const BridgeListenerPrx& listener, const Ice::Current&)
+void MockBridgeManager::createBridge_async(const AMD_BridgeManager_createBridgePtr& callback,
+ const SessionSeq& sessions, const BridgeListenerPrx& listener, const Ice::Current&)
{
- MockBridge *mockBridge = new MockBridge(sessions, listener);
- BridgePtr bridge(mockBridge);
- mBridgeServants.push_back(bridge);
+ try
+ {
+ MockBridge *mockBridge = new MockBridge(sessions, listener);
+ BridgePtr bridge(mockBridge);
+ mBridgeServants.push_back(bridge);
- BridgePrx bridgePrx = mockBridge->getProxy();
- mBridges.push_back(bridgePrx);
+ BridgePrx bridgePrx = mockBridge->getProxy();
+ mBridges.push_back(bridgePrx);
- return bridgePrx;
+ callback->ice_response(bridgePrx);
+ }
+ catch (const std::exception& ex)
+ {
+ callback->ice_exception(ex);
+ }
+ catch (...)
+ {
+ callback->ice_exception();
+ }
}
void MockBridgeManager::removeListener(const BridgeManagerListenerPrx&, const Ice::Current& )
diff --git a/test/MockBridgeManager.h b/test/MockBridgeManager.h
index f741908..1a25413 100644
--- a/test/MockBridgeManager.h
+++ b/test/MockBridgeManager.h
@@ -31,7 +31,9 @@ public:
}
void addListener(const AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx&, const Ice::Current&);
- AsteriskSCF::SessionCommunications::V1::BridgePrx createBridge(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener, const Ice::Current&);
+ void createBridge_async(const AsteriskSCF::SessionCommunications::V1::AMD_BridgeManager_createBridgePtr&,
+ const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
+ const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener, const Ice::Current&);
void removeListener(const AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx&, const Ice::Current&);
void addDefaultBridgeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current&);
void removeDefaultBridgeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current&);
-----------------------------------------------------------------------
--
asterisk-scf/release/routing.git
More information about the asterisk-scf-commits
mailing list