[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "async-bridging" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Feb 15 09:05:18 CST 2011
branch "async-bridging" has been updated
via 46820583024c35051f30aaea460171cf9836c04c (commit)
from 4838f17d8deeb4991ee6bd0edc1ba23a197fa0f2 (commit)
Summary of changes:
test/MockBridge.cpp | 53 ++++++++++++++++++++++++++++++++++---------
test/MockBridge.h | 9 +++++-
test/MockBridgeManager.cpp | 26 +++++++++++++++-----
test/MockBridgeManager.h | 4 ++-
4 files changed, 71 insertions(+), 21 deletions(-)
- Log -----------------------------------------------------------------
commit 46820583024c35051f30aaea460171cf9836c04c
Author: Brent Eagles <beagles at digium.com>
Date: Tue Feb 15 11:34:05 2011 -0330
AMD'ifying the router test code.
diff --git a/test/MockBridge.cpp b/test/MockBridge.cpp
index b383f61..12ea938 100644
--- a/test/MockBridge.cpp
+++ b/test/MockBridge.cpp
@@ -77,7 +77,7 @@ MockBridge::MockBridge(const SessionSeq& sessions, const BridgeListenerPrx& list
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)
{
- removeSession(*s);
+ callback->ice_exception(ex);
+ }
+ catch (...)
+ {
+ callback->ice_exception();
}
}
@@ -148,7 +168,7 @@ void MockBridge::replaceSession(const AsteriskSCF::SessionCommunications::V1::Se
SharedTestData::instance.mSessionReplaced = true;
removeSession(sessionToReplace);
- addSessions(newSessions);
+ addSessionsImpl(newSessions);
ResponseCodePtr response = new ResponseCode(1);
sessionToReplace->stop(response);
@@ -159,6 +179,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..10a04b6 100644
--- a/test/MockBridge.h
+++ b/test/MockBridge.h
@@ -34,9 +34,12 @@ 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&) ;
@@ -57,6 +60,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/integration/routing.git
More information about the asterisk-scf-commits
mailing list