[asterisk-scf-commits] asterisk-scf/integration/media_operations_core.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Mar 9 15:20:57 CST 2012


branch "retry_deux" has been updated
       via  1a4ed1cd8a7c95d30a80fc7a46fd116793074f38 (commit)
       via  773de3a417fe87cf5d8913b28a72fb3f4cdcfdd2 (commit)
      from  8c3d88469962d52d5c8209bf2ba562fd7e3d99e5 (commit)

Summary of changes:
 .../MediaOperationsCore/MediaOperationsCoreIf.ice  |   17 ++--
 src/InbandTelephonyEvents.cpp                      |    2 +-
 src/MediaOperationStateReplicator.h                |    6 +-
 src/MediaOperationStateReplicatorApp.cpp           |    7 +-
 src/MediaOperationStateReplicatorListener.cpp      |    3 +
 src/MediaOperationsCore.cpp                        |    4 +-
 src/TranslatorOperation.cpp                        |    6 +-
 test/TestMediaOperations.cpp                       |   93 ++++++++-----------
 8 files changed, 65 insertions(+), 73 deletions(-)


- Log -----------------------------------------------------------------
commit 1a4ed1cd8a7c95d30a80fc7a46fd116793074f38
Author: David M. Lee <dlee at digium.com>
Date:   Fri Mar 9 15:19:07 2012 -0600

    Pass exceptions on up to the test framework.
    
    Fixes set-but-not-used errors, and avoids BOOST_CHECK in fixtures
    (where apparently it's not allowed).

diff --git a/test/TestMediaOperations.cpp b/test/TestMediaOperations.cpp
index ca5c6c1..eb28327 100644
--- a/test/TestMediaOperations.cpp
+++ b/test/TestMediaOperations.cpp
@@ -280,70 +280,55 @@ struct GlobalIceFixture
         ::boost::debug::detect_memory_leaks(false);
         ::boost::unit_test::unit_test_log.set_stream( std::cout );
 
-        int status = 0;
-        try
-        {
-            //Since our translator makes calls to pjlib, we have to
-            //register our threads with pjlib
-            Ice::InitializationData id;
-            id.threadHook = new pjlibHook();
-            id.properties = IceBoxTestEnv.communicator->getProperties();
-            Testbed.communicator = Ice::initialize(id);
-
-            Testbed.adapter = 
-                Testbed.communicator->createObjectAdapterWithEndpoints("Adapter", "default");
-            Testbed.adapter->activate();
-            Testbed.locator = ServiceLocatorPrx::checkedCast(Testbed.communicator->propertyToProxy("LocatorService.Proxy"));
-
-            if (!Testbed.locator) {
-                throw "Invalid service locator proxy";
-            }
+        //Since our translator makes calls to pjlib, we have to
+        //register our threads with pjlib
+        Ice::InitializationData id;
+        id.threadHook = new pjlibHook();
+        id.properties = IceBoxTestEnv.communicator->getProperties();
+        Testbed.communicator = Ice::initialize(id);
+
+        Testbed.adapter =
+            Testbed.communicator->createObjectAdapterWithEndpoints("Adapter", "default");
+        Testbed.adapter->activate();
+        Testbed.locator = ServiceLocatorPrx::checkedCast(Testbed.communicator->propertyToProxy("LocatorService.Proxy"));
+
+        if (!Testbed.locator) {
+            throw "Invalid service locator proxy";
+        }
 
-            Testbed.ulaw = new G711uLAW();
-            Testbed.ulaw->name = G711uLAWName;
+        Testbed.ulaw = new G711uLAW();
+        Testbed.ulaw->name = G711uLAWName;
 
-            Testbed.alaw = new G711aLAW();
-            Testbed.alaw->name = G711aLAWName;
+        Testbed.alaw = new G711aLAW();
+        Testbed.alaw->name = G711aLAWName;
 
-            Testbed.slin8 = new SignedLinear();
-            Testbed.slin8->name = SignedLinear8Name;
-            Testbed.slin8->sampleRate = 8000;
+        Testbed.slin8 = new SignedLinear();
+        Testbed.slin8->name = SignedLinear8Name;
+        Testbed.slin8->sampleRate = 8000;
 
-            Testbed.slin16 = new SignedLinear();
-            Testbed.slin16->name = SignedLinear16Name;
-            Testbed.slin16->sampleRate = 16000;
+        Testbed.slin16 = new SignedLinear();
+        Testbed.slin16->name = SignedLinear16Name;
+        Testbed.slin16->sampleRate = 16000;
 
-            Testbed.g722 = new G722();
-            Testbed.g722->name = G722Name;
+        Testbed.g722 = new G722();
+        Testbed.g722->name = G722Name;
 
-            Testbed.sampleAlawFrame = new Frame(Testbed.alaw, new ByteSeqPayload(Ice::ByteSeq(sampleAlaw, sampleAlaw + sizeof(sampleAlaw))));
-            Testbed.sampleAlawFrameSize = sizeof(sampleAlaw);
+        Testbed.sampleAlawFrame = new Frame(Testbed.alaw, new ByteSeqPayload(Ice::ByteSeq(sampleAlaw, sampleAlaw + sizeof(sampleAlaw))));
+        Testbed.sampleAlawFrameSize = sizeof(sampleAlaw);
 
-            Testbed.sampleUlawFrame = new Frame(Testbed.ulaw, new ByteSeqPayload(Ice::ByteSeq(sampleUlaw, sampleUlaw + sizeof(sampleUlaw))));
-            Testbed.sampleUlawFrameSize = sizeof(sampleUlaw);
+        Testbed.sampleUlawFrame = new Frame(Testbed.ulaw, new ByteSeqPayload(Ice::ByteSeq(sampleUlaw, sampleUlaw + sizeof(sampleUlaw))));
+        Testbed.sampleUlawFrameSize = sizeof(sampleUlaw);
 
-            ShortSeqPayloadPtr slin8Payload(new ShortSeqPayload(Ice::ShortSeq(sampleSlin8, sampleSlin8 + (sizeof(sampleSlin8) / 2))));
-            Testbed.sampleSlin8Frame = new Frame(Testbed.slin8, slin8Payload);
-            Testbed.sampleSlin8FrameSize = slin8Payload->payload.size();
+        ShortSeqPayloadPtr slin8Payload(new ShortSeqPayload(Ice::ShortSeq(sampleSlin8, sampleSlin8 + (sizeof(sampleSlin8) / 2))));
+        Testbed.sampleSlin8Frame = new Frame(Testbed.slin8, slin8Payload);
+        Testbed.sampleSlin8FrameSize = slin8Payload->payload.size();
 
-            ShortSeqPayloadPtr slin16Payload(new ShortSeqPayload(Ice::ShortSeq(sampleSlin16, sampleSlin16 + (sizeof(sampleSlin16) / 2))));
-            Testbed.sampleSlin16Frame = new Frame(Testbed.slin16, slin16Payload);
-            Testbed.sampleSlin16FrameSize = slin16Payload->payload.size();
+        ShortSeqPayloadPtr slin16Payload(new ShortSeqPayload(Ice::ShortSeq(sampleSlin16, sampleSlin16 + (sizeof(sampleSlin16) / 2))));
+        Testbed.sampleSlin16Frame = new Frame(Testbed.slin16, slin16Payload);
+        Testbed.sampleSlin16FrameSize = slin16Payload->payload.size();
 
-            Testbed.sampleG722Frame = new Frame(Testbed.g722, new ByteSeqPayload(Ice::ByteSeq(sampleG722, sampleG722 + sizeof(sampleG722))));
-            Testbed.sampleG722FrameSize = sizeof(sampleG722);
-        }
-        catch (const Ice::Exception& ex)
-        {
-            std::cerr << ex << std::endl;
-            status = 1;
-        }
-        catch (...)
-        {
-            std::cerr << "Some non-Ice exception got encaughtened." << std::endl;
-            status = 1;
-        }
-        BOOST_CHECK_EQUAL(0, status);
+        Testbed.sampleG722Frame = new Frame(Testbed.g722, new ByteSeqPayload(Ice::ByteSeq(sampleG722, sampleG722 + sizeof(sampleG722))));
+        Testbed.sampleG722FrameSize = sizeof(sampleG722);
     }
 
     ~GlobalIceFixture()

commit 773de3a417fe87cf5d8913b28a72fb3f4cdcfdd2
Author: David M. Lee <dlee at digium.com>
Date:   Fri Mar 9 14:52:41 2012 -0600

    Fixed for latest retry_deux in ice-util-cpp.
    
    * Added OperationContext throughout state replicator
    * Moved OperationContext.h to Operations/ from Helpers/

diff --git a/slice/AsteriskSCF/Replication/MediaOperationsCore/MediaOperationsCoreIf.ice b/slice/AsteriskSCF/Replication/MediaOperationsCore/MediaOperationsCoreIf.ice
index 33e8497..6737d2e 100644
--- a/slice/AsteriskSCF/Replication/MediaOperationsCore/MediaOperationsCoreIf.ice
+++ b/slice/AsteriskSCF/Replication/MediaOperationsCore/MediaOperationsCoreIf.ice
@@ -20,6 +20,7 @@
 #include <Ice/BuiltinSequences.ice>
 
 #include <AsteriskSCF/Media/MediaIf.ice>
+#include <AsteriskSCF/System/OperationsIf.ice>
 
 module AsteriskSCF
 {
@@ -120,18 +121,18 @@ class InbandTelephonyEventOperationStateItem extends TranslatorMediaOperationSta
 
 interface MediaOperationStateReplicatorListener
 {
-    void stateRemoved(Ice::StringSeq itemKeys);
-    void stateRemovedForItems(MediaOperationStateItemSeq items);
-    void stateSet(MediaOperationStateItemSeq items);
+    idempotent void stateRemoved(AsteriskSCF::System::V1::OperationContext operationContext, Ice::StringSeq itemKeys);
+    idempotent void stateRemovedForItems(AsteriskSCF::System::V1::OperationContext operationContext, MediaOperationStateItemSeq items);
+    idempotent void stateSet(AsteriskSCF::System::V1::OperationContext operationContext, MediaOperationStateItemSeq items);
 };
 
 interface MediaOperationStateReplicator
 {
-    void addListener(MediaOperationStateReplicatorListener *listener);
-    void removeListener(MediaOperationStateReplicatorListener *listener);
-    void setState (MediaOperationStateItemSeq items);
-    void removeState(Ice::StringSeq items);
-    void removeStateForItems(MediaOperationStateItemSeq items);
+    idempotent void addListener(AsteriskSCF::System::V1::OperationContext operationContext, MediaOperationStateReplicatorListener *listener);
+    idempotent void removeListener(AsteriskSCF::System::V1::OperationContext operationContext, MediaOperationStateReplicatorListener *listener);
+    idempotent void setState (AsteriskSCF::System::V1::OperationContext operationContext, MediaOperationStateItemSeq items);
+    idempotent void removeState(AsteriskSCF::System::V1::OperationContext operationContext, Ice::StringSeq items);
+    idempotent void removeStateForItems(AsteriskSCF::System::V1::OperationContext operationContext, MediaOperationStateItemSeq items);
     idempotent MediaOperationStateItemSeq getState(Ice::StringSeq iteKeys);
     idempotent MediaOperationStateItemSeq getAllState();
 };
diff --git a/src/InbandTelephonyEvents.cpp b/src/InbandTelephonyEvents.cpp
index 4676cdc..57a8ec9 100644
--- a/src/InbandTelephonyEvents.cpp
+++ b/src/InbandTelephonyEvents.cpp
@@ -238,7 +238,7 @@ class InbandTelephonyEventOperation : public TranslatorOperation
             {
                 MediaOperationStateItemSeq items;
                 items.push_back(mStateItem);
-                mReplicationContext->getReplicator()->setState(items);
+                mReplicationContext->getReplicator()->setState(AsteriskSCF::Operations::createContext(), items);
             }
         }
 
diff --git a/src/MediaOperationStateReplicator.h b/src/MediaOperationStateReplicator.h
index f8485d8..e64669d 100644
--- a/src/MediaOperationStateReplicator.h
+++ b/src/MediaOperationStateReplicator.h
@@ -36,9 +36,9 @@ class MediaOperationStateReplicatorListenerImpl : public AsteriskSCF::Replicatio
 {
 public:
     MediaOperationStateReplicatorListenerImpl(const Ice::ObjectAdapterPtr& adapter);
-    void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
-    void stateRemovedForItems(const AsteriskSCF::Replication::MediaOperationsCore::V1::MediaOperationStateItemSeq&, const Ice::Current&);
-    void stateSet(const AsteriskSCF::Replication::MediaOperationsCore::V1::MediaOperationStateItemSeq&, const Ice::Current&);
+    void stateRemoved(const AsteriskSCF::System::V1::OperationContextPtr&, const Ice::StringSeq&, const Ice::Current&);
+    void stateRemovedForItems(const AsteriskSCF::System::V1::OperationContextPtr&, const AsteriskSCF::Replication::MediaOperationsCore::V1::MediaOperationStateItemSeq&, const Ice::Current&);
+    void stateSet(const AsteriskSCF::System::V1::OperationContextPtr&, const AsteriskSCF::Replication::MediaOperationsCore::V1::MediaOperationStateItemSeq&, const Ice::Current&);
 private:
     /**
      * Note this is the "service" object adapter, and not the "backplane"
diff --git a/src/MediaOperationStateReplicatorApp.cpp b/src/MediaOperationStateReplicatorApp.cpp
index 8223eb5..555ec71 100644
--- a/src/MediaOperationStateReplicatorApp.cpp
+++ b/src/MediaOperationStateReplicatorApp.cpp
@@ -22,7 +22,7 @@
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/Replication/MediaOperationsCore/MediaOperationsCoreIf.h>
 #include <AsteriskSCF/Logger.h>
-#include <AsteriskSCF/Helpers/OperationContext.h>
+#include <AsteriskSCF/Operations/OperationContext.h>
 
 using namespace AsteriskSCF::System::Logging;
 
@@ -73,13 +73,14 @@ void MediaOperationStateReplicatorService::registerWithServiceLocator(const Ice:
     MediaOperationStateReplicatorPrx stateReplicatorProxy =
         MediaOperationStateReplicatorPrx::uncheckedCast(mAdapter->createDirectProxy(communicator->stringToIdentity(ReplicatorId)));
 
-    ServiceManagementPrx serviceManagement = mManagement->addService(stateReplicatorProxy, ReplicatorId);
+    ServiceManagementPrx serviceManagement = mManagement->addService(AsteriskSCF::Operations::createContext(),
+        stateReplicatorProxy, ReplicatorId);
 
     ServiceLocatorParamsPtr params = new ServiceLocatorParams();
     params->category = StateReplicatorDiscoveryCategory;
     params->service = communicator->getProperties()->getPropertyWithDefault(appName + ".ServiceName", "default");
     params->id = appName;
-    serviceManagement->addLocatorParams(AsteriskSCF::createContext(), params, "");
+    serviceManagement->addLocatorParams(AsteriskSCF::Operations::createContext(), params, "");
 }
 
 void MediaOperationStateReplicatorService::start(
diff --git a/src/MediaOperationStateReplicatorListener.cpp b/src/MediaOperationStateReplicatorListener.cpp
index d6e1d5c..9eb510c 100644
--- a/src/MediaOperationStateReplicatorListener.cpp
+++ b/src/MediaOperationStateReplicatorListener.cpp
@@ -35,6 +35,7 @@ MediaOperationStateReplicatorListenerImpl::MediaOperationStateReplicatorListener
 }
 
 void MediaOperationStateReplicatorListenerImpl::stateRemoved(
+        const AsteriskSCF::System::V1::OperationContextPtr&,
         const Ice::StringSeq&,
         const Ice::Current&)
 {
@@ -42,6 +43,7 @@ void MediaOperationStateReplicatorListenerImpl::stateRemoved(
 }
 
 void MediaOperationStateReplicatorListenerImpl::stateRemovedForItems(
+        const AsteriskSCF::System::V1::OperationContextPtr&,
         const MediaOperationStateItemSeq& items,
         const Ice::Current&)
 {
@@ -80,6 +82,7 @@ void MediaOperationStateReplicatorListenerImpl::stateRemovedForItems(
 }
 
 void MediaOperationStateReplicatorListenerImpl::stateSet(
+        const AsteriskSCF::System::V1::OperationContextPtr&,
         const MediaOperationStateItemSeq& items,
         const Ice::Current&)
 {
diff --git a/src/MediaOperationsCore.cpp b/src/MediaOperationsCore.cpp
index f26334c..1296c34 100644
--- a/src/MediaOperationsCore.cpp
+++ b/src/MediaOperationsCore.cpp
@@ -272,7 +272,7 @@ private:
         {
             if (context->getState() == STANDBY_IN_REPLICA_GROUP)
             {
-                context->getReplicator()->addListener(mReplicatorListenerProxy);
+                context->getReplicator()->addListener(AsteriskSCF::Operations::createContext(), mReplicatorListenerProxy);
                 mListeningToReplicator = true;
             }
         }
@@ -295,7 +295,7 @@ private:
 
         try
         {
-            context->getReplicator()->removeListener(mReplicatorListenerProxy);
+            context->getReplicator()->removeListener(AsteriskSCF::Operations::createContext(), mReplicatorListenerProxy);
             mListeningToReplicator = false;
         }
         catch (const Ice::Exception& e)
diff --git a/src/TranslatorOperation.cpp b/src/TranslatorOperation.cpp
index ea25865..10ba244 100644
--- a/src/TranslatorOperation.cpp
+++ b/src/TranslatorOperation.cpp
@@ -16,6 +16,8 @@
 
 #include "TranslatorOperation.h"
 
+#include <AsteriskSCF/Operations/OperationContext.h>
+
 namespace AsteriskSCF
 {
 
@@ -75,7 +77,7 @@ void TranslatorOperation::setState()
     {
         MediaOperationStateItemSeq seq;
         seq.push_back(mStateItem);
-        mReplicationContext->getReplicator().tryOneWay()->setState(seq);
+        mReplicationContext->getReplicator().tryOneWay()->setState(AsteriskSCF::Operations::createContext(), seq);
     }
     catch (const Ice::Exception& ex)
     {
@@ -94,7 +96,7 @@ void TranslatorOperation::removeState()
     {
         MediaOperationStateItemSeq seq;
         seq.push_back(mStateItem);
-        mReplicationContext->getReplicator().tryOneWay()->removeStateForItems(seq);
+        mReplicationContext->getReplicator().tryOneWay()->removeStateForItems(AsteriskSCF::Operations::createContext(), seq);
     }
     catch (const Ice::Exception& ex)
     {

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


-- 
asterisk-scf/integration/media_operations_core.git



More information about the asterisk-scf-commits mailing list