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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Mar 22 10:22:30 CDT 2011


branch "workqueue" has been updated
       via  12d737fef992d5d20ef2d3c1cfc8bd6007cd2e7e (commit)
       via  43257138e3d47aa4a09c6c4344bbf2956ebb5456 (commit)
      from  1ac48658c2ecb86905f1f589c71be87fa42775c6 (commit)

Summary of changes:
 .../include/AsteriskSCF/SuspendableWorkQueue.h     |   10 ++++----
 WorkQueue/include/AsteriskSCF/WorkQueue.h          |   10 ++++----
 WorkQueue/src/SuspendableWorkQueue.cpp             |   12 +++++-----
 WorkQueue/src/WorkQueue.cpp                        |   12 +++++-----
 WorkQueue/test/TestSuspendableWorkQueue.cpp        |   24 ++++++++++---------
 WorkQueue/test/TestWorkQueue.cpp                   |   18 ++++++++------
 6 files changed, 45 insertions(+), 41 deletions(-)


- Log -----------------------------------------------------------------
commit 12d737fef992d5d20ef2d3c1cfc8bd6007cd2e7e
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Mar 22 10:21:47 2011 -0500

    Make sure to place reference operator next to type instead of variable name.

diff --git a/WorkQueue/include/AsteriskSCF/SuspendableWorkQueue.h b/WorkQueue/include/AsteriskSCF/SuspendableWorkQueue.h
index dc65f34..bcc586f 100644
--- a/WorkQueue/include/AsteriskSCF/SuspendableWorkQueue.h
+++ b/WorkQueue/include/AsteriskSCF/SuspendableWorkQueue.h
@@ -31,13 +31,13 @@ class SuspendableWorkQueue : public AsteriskSCF::System::WorkQueue::V1::Suspenda
 {
 public:
     SuspendableWorkQueue();
-    SuspendableWorkQueue(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr &listener);
-    void enqueueWork(const AsteriskSCF::System::WorkQueue::V1::SuspendableWorkPtr &work);
-    void enqueueWorkSeq(const AsteriskSCF::System::WorkQueue::V1::SuspendableWorkSeq &works);
-    void cancelWork(const AsteriskSCF::System::WorkQueue::V1::SuspendableWorkPtr &work);
+    SuspendableWorkQueue(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr& listener);
+    void enqueueWork(const AsteriskSCF::System::WorkQueue::V1::SuspendableWorkPtr& work);
+    void enqueueWorkSeq(const AsteriskSCF::System::WorkQueue::V1::SuspendableWorkSeq& works);
+    void cancelWork(const AsteriskSCF::System::WorkQueue::V1::SuspendableWorkPtr& work);
     bool executeWork();
     int workCount();
-    void setListener(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr &listener);
+    void setListener(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr& listener);
 private:
     boost::shared_ptr<SuspendableWorkQueueImpl> mImpl;
 };
diff --git a/WorkQueue/include/AsteriskSCF/WorkQueue.h b/WorkQueue/include/AsteriskSCF/WorkQueue.h
index 2c47179..86b07d5 100644
--- a/WorkQueue/include/AsteriskSCF/WorkQueue.h
+++ b/WorkQueue/include/AsteriskSCF/WorkQueue.h
@@ -30,13 +30,13 @@ class WorkQueue : public AsteriskSCF::System::WorkQueue::V1::Queue
 {
 public:
     WorkQueue();
-    WorkQueue(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr &listener);
-    void enqueueWork(const AsteriskSCF::System::WorkQueue::V1::WorkPtr &work);
-    void enqueueWorkSeq(const AsteriskSCF::System::WorkQueue::V1::WorkSeq &works);
-    void cancelWork(const AsteriskSCF::System::WorkQueue::V1::WorkPtr &work);
+    WorkQueue(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr& listener);
+    void enqueueWork(const AsteriskSCF::System::WorkQueue::V1::WorkPtr& work);
+    void enqueueWorkSeq(const AsteriskSCF::System::WorkQueue::V1::WorkSeq& works);
+    void cancelWork(const AsteriskSCF::System::WorkQueue::V1::WorkPtr& work);
     bool executeWork();
     int workCount();
-    void setListener(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr &listener);
+    void setListener(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr& listener);
 private:
     boost::shared_ptr<WorkQueueImpl> mImpl;
 };
diff --git a/WorkQueue/src/SuspendableWorkQueue.cpp b/WorkQueue/src/SuspendableWorkQueue.cpp
index 5bd6a9f..aaaa921 100644
--- a/WorkQueue/src/SuspendableWorkQueue.cpp
+++ b/WorkQueue/src/SuspendableWorkQueue.cpp
@@ -31,7 +31,7 @@ class SuspendableWorkQueueImpl
 public:
     SuspendableWorkQueueImpl()
         : mListener(0), state(Ready), currentWork(0) { }
-    SuspendableWorkQueueImpl(const QueueListenerPtr &listener)
+    SuspendableWorkQueueImpl(const QueueListenerPtr& listener)
         : mListener(listener), state(Ready), currentWork(0) { }
 
     QueueListenerPtr mListener;
@@ -178,10 +178,10 @@ typedef IceUtil::Handle<WorkListener> WorkListenerPtr;
 SuspendableWorkQueue::SuspendableWorkQueue()
     : mImpl(new SuspendableWorkQueueImpl) { }
 
-SuspendableWorkQueue::SuspendableWorkQueue(const QueueListenerPtr &listener)
+SuspendableWorkQueue::SuspendableWorkQueue(const QueueListenerPtr& listener)
     : mImpl(new SuspendableWorkQueueImpl(listener)) { }
 
-void SuspendableWorkQueue::enqueueWork(const SuspendableWorkPtr &work)
+void SuspendableWorkQueue::enqueueWork(const SuspendableWorkPtr& work)
 {
     boost::unique_lock<boost::mutex> lock(mImpl->mLock);
 
@@ -199,7 +199,7 @@ void SuspendableWorkQueue::enqueueWork(const SuspendableWorkPtr &work)
     mImpl->mListener->workAdded(wasEmpty);
 }
 
-void SuspendableWorkQueue::enqueueWorkSeq(const SuspendableWorkSeq &works)
+void SuspendableWorkQueue::enqueueWorkSeq(const SuspendableWorkSeq& works)
 {
     boost::unique_lock<boost::mutex> lock(mImpl->mLock);
     
@@ -224,7 +224,7 @@ void SuspendableWorkQueue::enqueueWorkSeq(const SuspendableWorkSeq &works)
     mImpl->mListener->workAdded(wasEmpty);
 }
 
-void SuspendableWorkQueue::cancelWork(const SuspendableWorkPtr &work)
+void SuspendableWorkQueue::cancelWork(const SuspendableWorkPtr& work)
 {
     boost::unique_lock<boost::mutex> lock(mImpl->mLock);
 
@@ -326,7 +326,7 @@ int SuspendableWorkQueue::workCount()
     return mImpl->q.size() + (mImpl->currentWork ? 1 : 0);
 }
 
-void SuspendableWorkQueue::setListener(const QueueListenerPtr &listener)
+void SuspendableWorkQueue::setListener(const QueueListenerPtr& listener)
 {
     mImpl->mListener = listener;
 }
diff --git a/WorkQueue/src/WorkQueue.cpp b/WorkQueue/src/WorkQueue.cpp
index 0b22843..de80d03 100644
--- a/WorkQueue/src/WorkQueue.cpp
+++ b/WorkQueue/src/WorkQueue.cpp
@@ -31,7 +31,7 @@ class WorkQueueImpl
 public:
     WorkQueueImpl()
         : mListener(0) { }
-    WorkQueueImpl(const QueueListenerPtr &listener)
+    WorkQueueImpl(const QueueListenerPtr& listener)
         : mListener(listener) { }
 
     QueueListenerPtr mListener;
@@ -42,10 +42,10 @@ public:
 WorkQueue::WorkQueue()
     : mImpl(new WorkQueueImpl) { }
 
-WorkQueue::WorkQueue(const QueueListenerPtr &listener)
+WorkQueue::WorkQueue(const QueueListenerPtr& listener)
     : mImpl(new WorkQueueImpl(listener)) { }
 
-void WorkQueue::enqueueWork(const WorkPtr &work)
+void WorkQueue::enqueueWork(const WorkPtr& work)
 {
     boost::unique_lock<boost::mutex> lock(mImpl->mLock);
     
@@ -64,7 +64,7 @@ void WorkQueue::enqueueWork(const WorkPtr &work)
     mImpl->mListener->workAdded(wasEmpty);
 }
 
-void WorkQueue::enqueueWorkSeq(const WorkSeq &works)
+void WorkQueue::enqueueWorkSeq(const WorkSeq& works)
 {
     boost::unique_lock<boost::mutex> lock(mImpl->mLock);
     
@@ -88,7 +88,7 @@ void WorkQueue::enqueueWorkSeq(const WorkSeq &works)
     mImpl->mListener->workAdded(wasEmpty);
 }
 
-void WorkQueue::cancelWork(const WorkPtr &work)
+void WorkQueue::cancelWork(const WorkPtr& work)
 {
     boost::unique_lock<boost::mutex> lock(mImpl->mLock);
 
@@ -135,7 +135,7 @@ int WorkQueue::workCount()
     return mImpl->q.size();
 }
 
-void WorkQueue::setListener(const QueueListenerPtr &listener)
+void WorkQueue::setListener(const QueueListenerPtr& listener)
 {
     mImpl->mListener = listener;
 }
diff --git a/WorkQueue/test/TestSuspendableWorkQueue.cpp b/WorkQueue/test/TestSuspendableWorkQueue.cpp
index edafd9e..121cee4 100644
--- a/WorkQueue/test/TestSuspendableWorkQueue.cpp
+++ b/WorkQueue/test/TestSuspendableWorkQueue.cpp
@@ -78,7 +78,7 @@ class SimpleTask : public SuspendableWork
 {
 public:
     SimpleTask() : taskExecuted(false) { }
-    SuspendableWorkResult execute(const SuspendableWorkListenerPtr &listener)
+    SuspendableWorkResult execute(const SuspendableWorkListenerPtr& listener)
     {
         taskExecuted = true;
         return Complete;
@@ -102,7 +102,7 @@ public:
         mThread.join();
     }
 
-    SuspendableWorkResult execute(const SuspendableWorkListenerPtr &listener)
+    SuspendableWorkResult execute(const SuspendableWorkListenerPtr& listener)
     {
         mListener = listener;
         switch (currentState)
@@ -147,7 +147,7 @@ class RacyTask : public SuspendableWork
 {
 public:
     RacyTask() : currentState(Initial) { }
-    SuspendableWorkResult execute(const SuspendableWorkListenerPtr &listener)
+    SuspendableWorkResult execute(const SuspendableWorkListenerPtr& listener)
     {
         switch (currentState)
         {
@@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(addWork)
     {
         queue->enqueueWork(work);
     }
-    catch (const SuspendableWorkExists &)
+    catch (const SuspendableWorkExists& )
     {
         excepted = true;
     }
@@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE(addWorkSeq)
     {
         queue->enqueueWorkSeq(works);
     }
-    catch (const SuspendableWorkExists &)
+    catch (const SuspendableWorkExists& )
     {
         excepted = true;
     }
@@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE(appendWork)
     {
         queue->enqueueWork(work2);
     }
-    catch (const SuspendableWorkExists &)
+    catch (const SuspendableWorkExists& )
     {
         excepted = true;
     }
diff --git a/WorkQueue/test/TestWorkQueue.cpp b/WorkQueue/test/TestWorkQueue.cpp
index b46fd57..ef20a70 100644
--- a/WorkQueue/test/TestWorkQueue.cpp
+++ b/WorkQueue/test/TestWorkQueue.cpp
@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(addWork)
     {
         queue->enqueueWork(work);
     }
-    catch (const WorkExists &)
+    catch (const WorkExists& )
     {
         excepted = true;
     }
@@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(addWorkSeq)
     {
         queue->enqueueWorkSeq(works);
     }
-    catch (const WorkExists &)
+    catch (const WorkExists& )
     {
         excepted = true;
     }
@@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(appendWork)
     {
         queue->enqueueWork(work2);
     }
-    catch (const WorkExists &)
+    catch (const WorkExists& )
     {
         excepted = true;
     }
@@ -213,7 +213,7 @@ BOOST_AUTO_TEST_CASE(cancelWork)
     {
         queue->cancelWork(work1);
     }
-    catch (const WorkNotFound &)
+    catch (const WorkNotFound& )
     {
         excepted = true;
     }
@@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE(cancelNonExistent1)
     {
         queue->cancelWork(work);
     }
-    catch (const WorkNotFound &)
+    catch (const WorkNotFound& )
     {
         excepted = true;
     }

commit 43257138e3d47aa4a09c6c4344bbf2956ebb5456
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Mar 22 10:13:47 2011 -0500

    Check that exceptions have correct data in them.

diff --git a/WorkQueue/test/TestSuspendableWorkQueue.cpp b/WorkQueue/test/TestSuspendableWorkQueue.cpp
index 8a8aced..edafd9e 100644
--- a/WorkQueue/test/TestSuspendableWorkQueue.cpp
+++ b/WorkQueue/test/TestSuspendableWorkQueue.cpp
@@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(addWork)
     {
         queue->enqueueWork(work);
     }
-    catch (const WorkExists &)
+    catch (const SuspendableWorkExists &)
     {
         excepted = true;
     }
@@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE(addWorkSeq)
     {
         queue->enqueueWorkSeq(works);
     }
-    catch (const WorkExists &)
+    catch (const SuspendableWorkExists &)
     {
         excepted = true;
     }
@@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE(appendWork)
     {
         queue->enqueueWork(work2);
     }
-    catch (const WorkExists &)
+    catch (const SuspendableWorkExists &)
     {
         excepted = true;
     }
@@ -268,9 +268,10 @@ BOOST_AUTO_TEST_CASE(addExistentWork)
     {
         queue->enqueueWork(work);
     }
-    catch(const WorkExists&)
+    catch(const SuspendableWorkExists& error)
     {
         excepted = true;
+        BOOST_CHECK(error.items.front() == work);
     }
 
     BOOST_CHECK(excepted == true);
@@ -298,9 +299,10 @@ BOOST_AUTO_TEST_CASE(addExistentWorkSeq)
     {
         queue->enqueueWorkSeq(works2);
     }
-    catch (const WorkExists &)
+    catch (const SuspendableWorkExists& error)
     {
         excepted = true;
+        BOOST_CHECK(error.items.front() == work2);
     }
 
     BOOST_CHECK(excepted == true);
@@ -323,7 +325,7 @@ BOOST_AUTO_TEST_CASE(cancelWork)
     {
         queue->cancelWork(work1);
     }
-    catch (const WorkNotFound &)
+    catch (const WorkNotFound&)
     {
         excepted = true;
     }
@@ -344,7 +346,7 @@ BOOST_AUTO_TEST_CASE(cancelNonExistent1)
     {
         queue->cancelWork(work);
     }
-    catch (const WorkNotFound &)
+    catch (const WorkNotFound&)
     {
         excepted = true;
     }
@@ -370,7 +372,7 @@ BOOST_AUTO_TEST_CASE(cancelNonExistent2)
     {
         queue->cancelWork(work2);
     }
-    catch (const WorkNotFound &wnf)
+    catch (const WorkNotFound&)
     {
         excepted = true;
     }
diff --git a/WorkQueue/test/TestWorkQueue.cpp b/WorkQueue/test/TestWorkQueue.cpp
index 0434214..b46fd57 100644
--- a/WorkQueue/test/TestWorkQueue.cpp
+++ b/WorkQueue/test/TestWorkQueue.cpp
@@ -156,9 +156,10 @@ BOOST_AUTO_TEST_CASE(addExistentWork)
     {
         queue->enqueueWork(work);
     }
-    catch(const WorkExists&)
+    catch(const WorkExists& error)
     {
         excepted = true;
+        BOOST_CHECK(error.items.front() == work);
     }
 
     BOOST_CHECK(excepted == true);
@@ -186,9 +187,10 @@ BOOST_AUTO_TEST_CASE(addExistentWorkSeq)
     {
         queue->enqueueWorkSeq(works2);
     }
-    catch (const WorkExists &)
+    catch (const WorkExists& error)
     {
         excepted = true;
+        BOOST_CHECK(error.items.front() == work2);
     }
 
     BOOST_CHECK(excepted == true);
@@ -258,7 +260,7 @@ BOOST_AUTO_TEST_CASE(cancelNonExistent2)
     {
         queue->cancelWork(work2);
     }
-    catch (const WorkNotFound &wnf)
+    catch (const WorkNotFound&)
     {
         excepted = true;
     }

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


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



More information about the asterisk-scf-commits mailing list