[asterisk-scf-commits] asterisk-scf/integration/ice-util-cpp.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Feb 29 14:38:09 CST 2012


branch "retry_deux" has been updated
       via  a61ab1c5009b600b1b1a5ce85f388fada8a34cc2 (commit)
      from  7be8e3ee16b1f3bad551fb52ba69aea51044bc57 (commit)

Summary of changes:
 include/AsteriskSCF/Replication/StateReplicator.h |   12 +++++--
 src/Component/Component.cpp                       |   20 ++++++------
 src/Operations/OperationContext.cpp               |    2 -
 test/Component/ComponentTest.cpp                  |    9 +++--
 test/Replication/CMakeLists.txt                   |    1 +
 test/Replication/MockStateReplicatorListener.h    |    6 ++--
 test/Replication/TestStateReplicator.cpp          |   34 +++++++++++----------
 test/Replication/slice/StateReplicatorTestIf.ice  |   28 +++++++++--------
 8 files changed, 60 insertions(+), 52 deletions(-)


- Log -----------------------------------------------------------------
commit a61ab1c5009b600b1b1a5ce85f388fada8a34cc2
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Feb 29 17:06:17 2012 -0330

    Fix build issues uncovered under GCC build, some formatting changes and syncing up with
    recent slice changes.

diff --git a/include/AsteriskSCF/Replication/StateReplicator.h b/include/AsteriskSCF/Replication/StateReplicator.h
index eb57812..d9a4424 100644
--- a/include/AsteriskSCF/Replication/StateReplicator.h
+++ b/include/AsteriskSCF/Replication/StateReplicator.h
@@ -20,6 +20,7 @@
 #include <boost/thread/thread.hpp>
 #include <boost/thread/shared_mutex.hpp>
 #include <AsteriskSCF/System/OperationsIf.h>
+#include <AsteriskSCF/Operations/OperationContext.h>
 
 namespace AsteriskSCF
 {
@@ -193,7 +194,8 @@ public:
      * Adds a listener of state update notices.
      * @Override
      */
-    void addListener(const L& listener, const Ice::Current& = ::Ice::Current())
+    void addListener(const AsteriskSCF::System::V1::OperationContextPtr&, 
+        const L& listener, const Ice::Current& = ::Ice::Current())
     {
         {   // critical scope
             boost::unique_lock<boost::shared_mutex> lock(mListenerLock);
@@ -202,14 +204,15 @@ public:
 
         // Give this new listener the current state.
         boost::shared_lock<boost::shared_mutex> lock(mStateLock);
-        listener->stateSet(new AsteriskSCF::System::V1::OperationContext(IceUtil::generateUUID()), mStateItems);
+        listener->stateSet(AsteriskSCF::Operations::createContext(), mStateItems);
     }
 
     /**
      * Removes a listener of state update notices.
      * @Override
      */
-    void removeListener(const L& listener, const Ice::Current& = ::Ice::Current())
+    void removeListener(const AsteriskSCF::System::V1::OperationContextPtr&, 
+        const L& listener, const Ice::Current& = ::Ice::Current())
     {
         boost::unique_lock<boost::shared_mutex> lock(mListenerLock);
         typename std::vector<L>::iterator it = std::find_if(mListeners.begin(), mListeners.end(), IdentifyListener<L>(listener));
@@ -234,6 +237,7 @@ public:
      */
     void clearState()
     {
+        AsteriskSCF::System::V1::OperationContextPtr op = AsteriskSCF::Operations::createContext();
         std::vector<S> items;
 
         {   // critical scope
@@ -243,7 +247,7 @@ public:
         }
 
         boost::shared_lock<boost::shared_mutex> lock(mListenerLock);
-        for_each(mListeners.begin(), mListeners.end(), RemoveStateNotice<L,std::vector<S> >(items));
+        for_each(mListeners.begin(), mListeners.end(), RemoveStateNotice<L,std::vector<S> >(op, items));
     }
 
     /**
diff --git a/src/Component/Component.cpp b/src/Component/Component.cpp
index 6a0ac23..7939dfe 100644
--- a/src/Component/Component.cpp
+++ b/src/Component/Component.cpp
@@ -61,17 +61,17 @@ public:
     }
 
 public: // Overrides of the ComponentService interface.
-    void suspend(const OperationContextPtr& operationContext, const ::Ice::Current&)
+    void suspend(const OperationContextPtr&, const ::Ice::Current&)
     {
         mComponent.suspended();
     }
 
-    void resume(const OperationContextPtr& operationContext, const ::Ice::Current&)
+    void resume(const OperationContextPtr&, const ::Ice::Current&)
     {
         mComponent.resumed();
     }
 
-    void shutdown(const OperationContextPtr& operationContext, const ::Ice::Current&)
+    void shutdown(const OperationContextPtr&, const ::Ice::Current&)
     {
         // This should probably get the icebox admin interface and call 
         // that shutdown() operartion. 
@@ -97,13 +97,13 @@ public:
     {
     }
 
-    void setTestMode(const OperationContextPtr& operationContext,
-                    const std::string& mode, const ::Ice::Current&)
+    void setTestMode(const OperationContextPtr&,
+        const std::string& mode, const ::Ice::Current&)
     {
         mComponent.setTestMode(mode);
     }
 
-    void setTestModeWithArgs(const OperationContextPtr& operationContext,
+    void setTestModeWithArgs(const OperationContextPtr&,
                              const std::string& mode, 
                              const ComponentTestParamSeq& args, 
                              const ::Ice::Current&)
@@ -111,13 +111,13 @@ public:
         mComponent.setTestModeWithArgs(mode, args);
     }
 
-    void clearTestMode(const OperationContextPtr& operationContext,
+    void clearTestMode(const OperationContextPtr&,
                        const string& mode, const ::Ice::Current&)
     {
         mComponent.clearTestMode(mode);
     }
 
-    void clearTestModes(const OperationContextPtr& operationContext,
+    void clearTestModes(const OperationContextPtr&,
                         const ::Ice::Current&)
     {
         mComponent.clearTestModes();
@@ -203,7 +203,7 @@ public:
         }
     }
 
-    void addListener(const OperationContextPtr& operationContext,
+    void addListener(const OperationContextPtr&,
                      const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, 
                      const ::Ice::Current&)
     {
@@ -216,7 +216,7 @@ public:
         mListeners.push_back(listener);
     }
 
-    void removeListener(const OperationContextPtr& operationContext,
+    void removeListener(const OperationContextPtr&,
                         const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, 
                         const ::Ice::Current&)
     {
diff --git a/src/Operations/OperationContext.cpp b/src/Operations/OperationContext.cpp
index 8a2c847..0848914 100755
--- a/src/Operations/OperationContext.cpp
+++ b/src/Operations/OperationContext.cpp
@@ -13,8 +13,6 @@
  * the GNU General Public License Version 2. See the LICENSE.txt file
  * at the top of the source tree.
  */
-#pragma once
-
 #include <IceUtil/UUID.h>
 #include <AsteriskSCF/System/OperationsIf.h>
 #include <AsteriskSCF/Operations/OperationContext.h>
diff --git a/test/Component/ComponentTest.cpp b/test/Component/ComponentTest.cpp
index cc56c5a..f099ef1 100644
--- a/test/Component/ComponentTest.cpp
+++ b/test/Component/ComponentTest.cpp
@@ -30,6 +30,7 @@
 #include <AsteriskSCF/System/Component/ComponentServiceIf.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
+#include <AsteriskSCF/Operations/OperationContext.h>
 
 #include "ComponentTestIf.h"
 
@@ -215,13 +216,13 @@ BOOST_AUTO_TEST_CASE(ManipulateComponentService)
 
     BOOST_CHECK(accessMockService(mockService));
 
-    componentService->suspend();
+    componentService->suspend(AsteriskSCF::Operations::createContext());
     BOOST_CHECK(sharedTestData.mListener->suspendCount == 1);
 
     // Should be inaccessible while in suspended mode. 
     BOOST_CHECK(!accessMockService(mockService));
 
-    componentService->resume();
+    componentService->resume(AsteriskSCF::Operations::createContext());
     BOOST_CHECK(sharedTestData.mListener->resumeCount == 1);
 
     // Should be accessible once more. 
@@ -272,11 +273,11 @@ BOOST_AUTO_TEST_CASE(CheckReplica)
 
     BOOST_CHECK(prx->isActive());
 
-    prx->standby();
+    prx->standby(AsteriskSCF::Operations::createContext());
 
     BOOST_CHECK(!prx->isActive());
 
-    prx->activate();
+    prx->activate(AsteriskSCF::Operations::createContext());
 
     BOOST_CHECK(prx->isActive());
 
diff --git a/test/Replication/CMakeLists.txt b/test/Replication/CMakeLists.txt
index 7e6583d..87a9ce1 100644
--- a/test/Replication/CMakeLists.txt
+++ b/test/Replication/CMakeLists.txt
@@ -7,3 +7,4 @@ astscf_component_add_slices(StateReplicatorTest LOCAL StateReplicatorTestIf.ice)
 astscf_component_add_boost_libraries(StateReplicatorTest unit_test_framework thread date_time)
 astscf_component_build_standalone(StateReplicatorTest)
 astscf_test_boost(StateReplicatorTest)
+target_link_libraries(StateReplicatorTest ASTSCFIceUtilCpp)
diff --git a/test/Replication/MockStateReplicatorListener.h b/test/Replication/MockStateReplicatorListener.h
index e91da85..e8e7db9 100644
--- a/test/Replication/MockStateReplicatorListener.h
+++ b/test/Replication/MockStateReplicatorListener.h
@@ -39,7 +39,7 @@ public:
     {
     }
 
-    void stateRemoved(const ::Ice::StringSeq& itemKeys, const ::Ice::Current& )
+    void stateRemoved(const AsteriskSCF::System::V1::OperationContextPtr&, const ::Ice::StringSeq& itemKeys, const ::Ice::Current& )
     {
         mItemKeys = itemKeys;
         mRemoveStateCalled = true;
@@ -47,7 +47,7 @@ public:
         removeByKeys(itemKeys);
     }
 
-    void stateRemovedForItems(const ::AsteriskSCF::StateReplicatorTest::V1::TestStateItemSeq& items,  const ::Ice::Current& )
+    void stateRemovedForItems(const AsteriskSCF::System::V1::OperationContextPtr&, const ::AsteriskSCF::StateReplicatorTest::V1::TestStateItemSeq& items,  const ::Ice::Current& )
     {
         mRemoveItems = items;
         mRemoveStateForItemsCalled = true;
@@ -55,7 +55,7 @@ public:
         removeByItems(items);
     }
 
-    void stateSet(const ::AsteriskSCF::StateReplicatorTest::V1::TestStateItemSeq& items, const ::Ice::Current& )
+    void stateSet(const AsteriskSCF::System::V1::OperationContextPtr&, const ::AsteriskSCF::StateReplicatorTest::V1::TestStateItemSeq& items, const ::Ice::Current& )
     {
         mStateItems = items;
         mSetStateCalled = true;
diff --git a/test/Replication/TestStateReplicator.cpp b/test/Replication/TestStateReplicator.cpp
index eeaf3fe..f793ecb 100644
--- a/test/Replication/TestStateReplicator.cpp
+++ b/test/Replication/TestStateReplicator.cpp
@@ -161,8 +161,10 @@ public:
             SharedTestData::instance.mMockStateListener1Ptr->reset();
             SharedTestData::instance.mMockStateListener2Ptr->reset();
 
-            SharedTestData::instance.mTestStateReplicatorPrx->addListener(SharedTestData::instance.mTestStateListener1Prx);
-            SharedTestData::instance.mTestStateReplicatorPrx->addListener(SharedTestData::instance.mTestStateListener2Prx);
+            SharedTestData::instance.mTestStateReplicatorPrx->addListener(
+                AsteriskSCF::Operations::createContext(), SharedTestData::instance.mTestStateListener1Prx);
+            SharedTestData::instance.mTestStateReplicatorPrx->addListener(
+                AsteriskSCF::Operations::createContext(), SharedTestData::instance.mTestStateListener2Prx);
 
             mTestValues.clear();
 
@@ -217,8 +219,8 @@ BOOST_AUTO_TEST_CASE(AddRemoveListeners)
 {
     try
     {
-        SharedTestData::instance.mTestStateReplicatorPrx->addListener(SharedTestData::instance.mTestStateListener1Prx);
-        SharedTestData::instance.mTestStateReplicatorPrx->addListener(SharedTestData::instance.mTestStateListener2Prx);
+        SharedTestData::instance.mTestStateReplicatorPrx->addListener(AsteriskSCF::Operations::createContext(), SharedTestData::instance.mTestStateListener1Prx);
+        SharedTestData::instance.mTestStateReplicatorPrx->addListener(AsteriskSCF::Operations::createContext(), SharedTestData::instance.mTestStateListener2Prx);
     }
     catch (...)
     {
@@ -229,8 +231,8 @@ BOOST_AUTO_TEST_CASE(AddRemoveListeners)
 
     try
     {
-        SharedTestData::instance.mTestStateReplicatorPrx->removeListener(SharedTestData::instance.mTestStateListener1Prx);
-        SharedTestData::instance.mTestStateReplicatorPrx->removeListener(SharedTestData::instance.mTestStateListener2Prx);
+        SharedTestData::instance.mTestStateReplicatorPrx->removeListener(AsteriskSCF::Operations::createContext(), SharedTestData::instance.mTestStateListener1Prx);
+        SharedTestData::instance.mTestStateReplicatorPrx->removeListener(AsteriskSCF::Operations::createContext(), SharedTestData::instance.mTestStateListener2Prx);
     }
     catch (...)
     {
@@ -249,7 +251,7 @@ BOOST_FIXTURE_TEST_CASE(PushData, PerTestFixture)
 {
     try
     {
-        SharedTestData::instance.mTestStateReplicatorPrx->setState(mTestValues);
+        SharedTestData::instance.mTestStateReplicatorPrx->setState(AsteriskSCF::Operations::createContext(), mTestValues);
     }
     catch(const IceUtil::Exception &ie)
     {
@@ -280,14 +282,14 @@ BOOST_FIXTURE_TEST_CASE(ForwardRemoveState, PerTestFixture)
 
     try
     {
-        SharedTestData::instance.mTestStateReplicatorPrx->setState(mTestValues);
+        SharedTestData::instance.mTestStateReplicatorPrx->setState(AsteriskSCF::Operations::createContext(), mTestValues);
         // {FooBabar, BarMouse, FooDumbo}
 
         Ice::StringSeq keys;
         keys.push_back("FooBabar");
         keys.push_back("FooDumbo");
 
-        SharedTestData::instance.mTestStateReplicatorPrx->removeState(keys);
+        SharedTestData::instance.mTestStateReplicatorPrx->removeState(AsteriskSCF::Operations::createContext(), keys);
     }
     catch(const IceUtil::Exception &ie)
     {
@@ -320,14 +322,14 @@ BOOST_FIXTURE_TEST_CASE(RemoveState, PerTestFixture)
     {
         // Set the basic 3 items of state.
         // {FooBabar, BarMouse, FooDumbo}
-        SharedTestData::instance.mTestStateReplicatorPrx->setState(mTestValues);
+        SharedTestData::instance.mTestStateReplicatorPrx->setState(AsteriskSCF::Operations::createContext(), mTestValues);
 
         // Try removing two of them.
         Ice::StringSeq keys;
         keys.push_back("FooBabar");
         keys.push_back("FooDumbo");
 
-        SharedTestData::instance.mTestStateReplicatorPrx->removeState(keys);
+        SharedTestData::instance.mTestStateReplicatorPrx->removeState(AsteriskSCF::Operations::createContext(), keys);
 
         retrievedValues = SharedTestData::instance.mTestStateReplicatorPrx->getAllState();
     }
@@ -361,7 +363,7 @@ BOOST_FIXTURE_TEST_CASE(GetSomeState, PerTestFixture)
 
     try
     {
-        SharedTestData::instance.mTestStateReplicatorPrx->setState(mTestValues);
+        SharedTestData::instance.mTestStateReplicatorPrx->setState(AsteriskSCF::Operations::createContext(), mTestValues);
         // {FooBabar, BarMouse, FooDumbo}
 
         Ice::StringSeq keys;
@@ -400,12 +402,12 @@ BOOST_FIXTURE_TEST_CASE(PreserveOrder, PerTestFixture)
 
     try
     {
-        SharedTestData::instance.mTestStateReplicatorPrx->setState(mTestValues);
+        SharedTestData::instance.mTestStateReplicatorPrx->setState(AsteriskSCF::Operations::createContext(), mTestValues);
 
         // {FooBabar, BarMouse, FooDumbo}
         Ice::StringSeq keys;
         keys.push_back("BarMouse");
-        SharedTestData::instance.mTestStateReplicatorPrx->removeState(keys);
+        SharedTestData::instance.mTestStateReplicatorPrx->removeState(AsteriskSCF::Operations::createContext(), keys);
         // {FooBabar, FooDumbo}
 
         TestStateItemSeq moreItems;
@@ -418,7 +420,7 @@ BOOST_FIXTURE_TEST_CASE(PreserveOrder, PerTestFixture)
         item2->key = "BarMouse";
         moreItems.push_back(item2);
 
-        SharedTestData::instance.mTestStateReplicatorPrx->setState(moreItems);
+        SharedTestData::instance.mTestStateReplicatorPrx->setState(AsteriskSCF::Operations::createContext(), moreItems);
         // {FooBabar, FooDumbo, Extra, BarMouse}
 
         retrievedValues = SharedTestData::instance.mTestStateReplicatorPrx->getAllState();
@@ -447,7 +449,7 @@ BOOST_FIXTURE_TEST_CASE(PreserveOrder, PerTestFixture)
     try
     {
         //Insure that a late joiner is pushed the correct current state, in correct order.
-        SharedTestData::instance.mTestStateReplicatorPrx->addListener(SharedTestData::instance.mTestStateListener3Prx);
+        SharedTestData::instance.mTestStateReplicatorPrx->addListener(AsteriskSCF::Operations::createContext(), SharedTestData::instance.mTestStateListener3Prx);
 
         // NOTE: This test currently is reliable only because we are NOT doing asynchronous sends to the listeners.
         // Will need a delay when asynch.
diff --git a/test/Replication/slice/StateReplicatorTestIf.ice b/test/Replication/slice/StateReplicatorTestIf.ice
index bd54489..d0df9a1 100644
--- a/test/Replication/slice/StateReplicatorTestIf.ice
+++ b/test/Replication/slice/StateReplicatorTestIf.ice
@@ -16,6 +16,7 @@
  
 #pragma once
 #include <Ice/BuiltinSequences.ice>
+#include <AsteriskSCF/System/OperationsIf.ice>
 
 module AsteriskSCF
 {
@@ -33,27 +34,28 @@ module V1
 
    interface TestStateReplicatorListener
    {
-      void stateRemoved(Ice::StringSeq itemKeys);
-	  void stateRemovedForItems(TestStateItemSeq items);
-	  void stateSet(TestStateItemSeq items);
+      idempotent void stateRemoved(AsteriskSCF::System::V1::OperationContext opContext,
+          Ice::StringSeq itemKeys);
+      idempotent void stateRemovedForItems(AsteriskSCF::System::V1::OperationContext opContext, TestStateItemSeq items);
+      idempotent void stateSet(AsteriskSCF::System::V1::OperationContext opContext, TestStateItemSeq items);
    };
 
    interface TestStateReplicator
    {
-      void addListener(TestStateReplicatorListener *listener);
-	  void removeListener(TestStateReplicatorListener *listener);
-	  void setState (TestStateItemSeq items);
-	  void removeState(Ice::StringSeq itemKeys);
-	  void removeStateForItems(TestStateItemSeq items);
-	  idempotent TestStateItemSeq getState(Ice::StringSeq itemKeys);
-	  idempotent TestStateItemSeq getAllState();
+      idempotent void addListener(AsteriskSCF::System::V1::OperationContext opContext, TestStateReplicatorListener *listener);
+      idempotent void removeListener(AsteriskSCF::System::V1::OperationContext opContext, TestStateReplicatorListener *listener);
+      idempotent void setState (AsteriskSCF::System::V1::OperationContext opContext, TestStateItemSeq items);
+      idempotent void removeState(AsteriskSCF::System::V1::OperationContext opContext, Ice::StringSeq itemKeys);
+      idempotent void removeStateForItems(AsteriskSCF::System::V1::OperationContext opContext, TestStateItemSeq items);
+      idempotent TestStateItemSeq getState(Ice::StringSeq itemKeys);
+      idempotent TestStateItemSeq getAllState();
    };
    
    class TestStateItemFoo extends TestStateItem
    {
-      string mFooString;
-	  bool mIsFoo;
-	  int mFooCount;
+       string mFooString;
+       bool mIsFoo;
+       int mFooCount;
    };
 
    class TestStateItemBar extends TestStateItem

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


-- 
asterisk-scf/integration/ice-util-cpp.git



More information about the asterisk-scf-commits mailing list