activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r419365 [19/25] - in /incubator/activemq/trunk: activemq-core/src/main/java/org/apache/activemq/thread/ activemq-core/src/test/java/org/apache/activemq/openwire/v1/ activemq-cpp/src/main/activemq/concurrent/ activemq-cpp/src/main/activemq/c...
Date Wed, 05 Jul 2006 22:27:47 GMT
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h Wed Jul  5 15:27:34 2006
@@ -1,308 +1,308 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ACTIVEMQ_UTIL_QUEUE_H
-#define ACTIVEMQ_UTIL_QUEUE_H
-
-#include <queue>
-#include <activemq/concurrent/Mutex.h>
-#include <activemq/exceptions/ActiveMQException.h>
-
-namespace activemq{
-namespace util{
-
-  /**
-   * The Queue class accepts messages with an psuh(m) command 
-   * where m is the message to be queued.  It destructively 
-   * returns the message with pop().  pop() returns messages in
-   * the order they were enqueued.                                               
-   *                                                              
-   * Queue is implemented with an instance of the STL queue object.
-   * The interface is essentially the same as that of the STL queue
-   * except that the pop method actually reaturns a reference to the
-   * element popped.  This frees the app from having to call the
-   * <code>front</code> method before calling pop.
-   *
-   *  Queue<string> sq;     // make a queue to hold string messages
-   *  sq.push(s);           // enqueues a message m
-   *  string s = sq.pop();  // dequeues a message
-   *
-   * = DESIGN CONSIDERATIONS
-   *
-   * The Queue class inherits from the Synchronizable interface and
-   * provides methods for locking and unlocking this queue as well as
-   * waiting on this queue.  In a multi-threaded app this can allow
-   * for multiple threads to be reading from and writing to the same
-   * Queue.
-   *
-   * Clients should consider that in a multiple threaded app it is 
-   * possible that items could be placed on the queue faster than
-   * you are taking them off, so protection should be placed in your
-   * polling loop to ensure that you don't get stuck there.
-   */
-
-   template <typename T> class Queue : public concurrent::Synchronizable
-   {
-   public:
-   
-      /**
-       * Constructor
-       */
-      Queue(void);
-
-      /**
-       * Destructor
-       */
-      virtual ~Queue(void);
-
-      /**
-       * Returns a Reference to the element at the head of the queue
-       * @return reference to a queue type object or (safe)
-       */
-      T& front(void);
-
-      /**
-       * Returns a Reference to the element at the head of the queue
-       * @return reference to a queue type object or (safe)
-       */
-      const T& front(void) const;
-
-      /**
-       * Returns a Reference to the element at the tail of the queue
-       * @return reference to a queue type object or (safe)
-       */
-      T& back(void);
-
-      /**
-       * Returns a Reference to the element at the tail of the queue
-       * @return reference to a queue type object or (safe)
-       */
-      const T& back(void) const;
-
-      /**
-       * Places a new Object at the Tail of the queue
-       * @param Queue Object Type reference.
-       */
-      void push(const T &t);
-
-      /**
-       * Removes and returns the element that is at the Head of the queue
-       * @return reference to a queue type object or (safe)
-       */
-      T pop(void);
-
-      /**
-       * Gets the Number of elements currently in the Queue
-       * @return Queue Size
-       */
-      size_t size(void) const;
-
-      /**
-       * Checks if this Queue is currently empty
-       * @return boolean indicating queue emptiness
-       */
-      bool empty(void) const;
-   
-      /**
-       * Locks the object.
-       */
-      virtual void lock() throw(exceptions::ActiveMQException){
-         mutex.lock();
-      }
-   
-      /**
-       * Unlocks the object.
-       */
-      virtual void unlock() throw(exceptions::ActiveMQException){   
-         mutex.unlock();
-      }
-       
-      /**
-       * Waits on a signal from this object, which is generated
-       * by a call to Notify.  Must have this object locked before
-       * calling.
-       */
-      virtual void wait() throw(exceptions::ActiveMQException){
-         mutex.wait();
-      }
-    
-      /**
-       * Waits on a signal from this object, which is generated
-       * by a call to Notify.  Must have this object locked before
-       * calling.  This wait will timeout after the specified time
-       * interval.
-       * @param time in millisecsonds to wait, or WAIT_INIFINITE
-       * @throws ActiveMQException
-       */
-      virtual void wait(unsigned long millisecs) 
-         throw(exceptions::ActiveMQException) {
-         
-         mutex.wait(millisecs);
-      }
-
-      /**
-       * Signals a waiter on this object that it can now wake
-       * up and continue.  Must have this object locked before
-       * calling.
-       */
-      virtual void notify() throw(exceptions::ActiveMQException){
-         mutex.notify();
-      }
-        
-      /**
-       * Signals the waiters on this object that it can now wake
-       * up and continue.  Must have this object locked before
-       * calling.
-       */
-      virtual void notifyAll() throw(exceptions::ActiveMQException){
-         mutex.notifyAll();
-      }
-   
-   public:   // Statics
-
-      /**
-       * Fetch a reference to the safe value this object will return
-       * when there is nothing to fetch from the queue.
-       * @return Reference to this Queues safe object
-       */
-      static const T& getSafeValue(void) { return safe; }
-
-   private:
-   
-      // The real queue
-      std::queue<T> queue;
-
-      // Object used for sync
-      concurrent::Mutex mutex;
-
-      // Safe value used when pop, front or back are
-      // called and the queue is empty.
-      static T safe;
-      
-   };
-   
-   //-----{ Static Init }-----------------------------------------------------//
-   template <typename T>
-   T Queue<T>::safe;
-   
-   //-----{ Retrieve current length of Queue }--------------------------------//
-   
-   template <typename T> inline size_t Queue<T>::size() const
-   {
-      return queue.size();
-   }
-   
-   //-----{ Retrieve whether Queue is empty or not }--------------------------//
-   
-   template <typename T> inline bool Queue<T>::empty(void) const
-   {
-      return queue.empty();
-   }
-   
-   //-----{ Defulat Constructor }---------------------------------------------//
-   
-   template <typename T> 
-   Queue<T>::Queue()
-   {
-   }
-
-   //-----{ Default Destructor }----------------------------------------------//
-   
-   template <typename T> Queue<T>::~Queue()
-   {
-   }
-
-   //-----{ Add Elements to Back of Queue }-----------------------------------//
-
-   template <typename T> 
-   void Queue<T>::push(const T &t)
-   {
-      queue.push(t);
-   }
-
-   //-----{ Remove Elements from Front of Queue }-----------------------------//
-
-   template <typename T> 
-   T Queue<T>::pop(void)
-   {
-      if(queue.empty())
-      {   
-         return safe;
-      }
-
-      // Pop the element into a temp, since we need to remain locked.
-      // this means getting front and then popping.
-      T temp = queue.front();
-      queue.pop();
-   
-      return temp;
-   }
-
-   //-----{ Returnreference to element at front of Queue }--------------------//
-
-   template <typename T> 
-   T& Queue<T>::front(void)
-   {
-      if(queue.empty())
-      {
-         return safe;
-      }
-         
-      return queue.front();
-   }
-   
-   //-----{ Returnreference to element at front of Queue }--------------------//
-
-   template <typename T> 
-   const T& Queue<T>::front(void) const
-   {
-      if(queue.empty())
-      {   
-         return safe;
-      }
-
-      return queue.front();
-   }
-   
-   //-----{ Returnreference to element at back of Queue }---------------------//
-
-   template <typename T> 
-   T& Queue<T>::back(void)
-   {
-      if(queue.empty())
-      {
-         return safe;
-      }
-         
-      return queue.back();
-   }
-   
-   //-----{ Returnreference to element at back of Queue }---------------------//
-
-   template <typename T> 
-   const T& Queue<T>::back(void) const
-   {
-      if(queue.empty())
-      {
-         return safe;
-      }
-   
-      return queue.back();
-   }
-
-}}
-
-#endif /* ACTIVEMQ_UTIL_QUEUE_H */
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ACTIVEMQ_UTIL_QUEUE_H
+#define ACTIVEMQ_UTIL_QUEUE_H
+
+#include <queue>
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+namespace activemq{
+namespace util{
+
+  /**
+   * The Queue class accepts messages with an psuh(m) command 
+   * where m is the message to be queued.  It destructively 
+   * returns the message with pop().  pop() returns messages in
+   * the order they were enqueued.                                               
+   *                                                              
+   * Queue is implemented with an instance of the STL queue object.
+   * The interface is essentially the same as that of the STL queue
+   * except that the pop method actually reaturns a reference to the
+   * element popped.  This frees the app from having to call the
+   * <code>front</code> method before calling pop.
+   *
+   *  Queue<string> sq;     // make a queue to hold string messages
+   *  sq.push(s);           // enqueues a message m
+   *  string s = sq.pop();  // dequeues a message
+   *
+   * = DESIGN CONSIDERATIONS
+   *
+   * The Queue class inherits from the Synchronizable interface and
+   * provides methods for locking and unlocking this queue as well as
+   * waiting on this queue.  In a multi-threaded app this can allow
+   * for multiple threads to be reading from and writing to the same
+   * Queue.
+   *
+   * Clients should consider that in a multiple threaded app it is 
+   * possible that items could be placed on the queue faster than
+   * you are taking them off, so protection should be placed in your
+   * polling loop to ensure that you don't get stuck there.
+   */
+
+   template <typename T> class Queue : public concurrent::Synchronizable
+   {
+   public:
+   
+      /**
+       * Constructor
+       */
+      Queue(void);
+
+      /**
+       * Destructor
+       */
+      virtual ~Queue(void);
+
+      /**
+       * Returns a Reference to the element at the head of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      T& front(void);
+
+      /**
+       * Returns a Reference to the element at the head of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      const T& front(void) const;
+
+      /**
+       * Returns a Reference to the element at the tail of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      T& back(void);
+
+      /**
+       * Returns a Reference to the element at the tail of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      const T& back(void) const;
+
+      /**
+       * Places a new Object at the Tail of the queue
+       * @param Queue Object Type reference.
+       */
+      void push(const T &t);
+
+      /**
+       * Removes and returns the element that is at the Head of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      T pop(void);
+
+      /**
+       * Gets the Number of elements currently in the Queue
+       * @return Queue Size
+       */
+      size_t size(void) const;
+
+      /**
+       * Checks if this Queue is currently empty
+       * @return boolean indicating queue emptiness
+       */
+      bool empty(void) const;
+   
+      /**
+       * Locks the object.
+       */
+      virtual void lock() throw(exceptions::ActiveMQException){
+         mutex.lock();
+      }
+   
+      /**
+       * Unlocks the object.
+       */
+      virtual void unlock() throw(exceptions::ActiveMQException){   
+         mutex.unlock();
+      }
+       
+      /**
+       * Waits on a signal from this object, which is generated
+       * by a call to Notify.  Must have this object locked before
+       * calling.
+       */
+      virtual void wait() throw(exceptions::ActiveMQException){
+         mutex.wait();
+      }
+    
+      /**
+       * Waits on a signal from this object, which is generated
+       * by a call to Notify.  Must have this object locked before
+       * calling.  This wait will timeout after the specified time
+       * interval.
+       * @param time in millisecsonds to wait, or WAIT_INIFINITE
+       * @throws ActiveMQException
+       */
+      virtual void wait(unsigned long millisecs) 
+         throw(exceptions::ActiveMQException) {
+         
+         mutex.wait(millisecs);
+      }
+
+      /**
+       * Signals a waiter on this object that it can now wake
+       * up and continue.  Must have this object locked before
+       * calling.
+       */
+      virtual void notify() throw(exceptions::ActiveMQException){
+         mutex.notify();
+      }
+        
+      /**
+       * Signals the waiters on this object that it can now wake
+       * up and continue.  Must have this object locked before
+       * calling.
+       */
+      virtual void notifyAll() throw(exceptions::ActiveMQException){
+         mutex.notifyAll();
+      }
+   
+   public:   // Statics
+
+      /**
+       * Fetch a reference to the safe value this object will return
+       * when there is nothing to fetch from the queue.
+       * @return Reference to this Queues safe object
+       */
+      static const T& getSafeValue(void) { return safe; }
+
+   private:
+   
+      // The real queue
+      std::queue<T> queue;
+
+      // Object used for sync
+      concurrent::Mutex mutex;
+
+      // Safe value used when pop, front or back are
+      // called and the queue is empty.
+      static T safe;
+      
+   };
+   
+   //-----{ Static Init }-----------------------------------------------------//
+   template <typename T>
+   T Queue<T>::safe;
+   
+   //-----{ Retrieve current length of Queue }--------------------------------//
+   
+   template <typename T> inline size_t Queue<T>::size() const
+   {
+      return queue.size();
+   }
+   
+   //-----{ Retrieve whether Queue is empty or not }--------------------------//
+   
+   template <typename T> inline bool Queue<T>::empty(void) const
+   {
+      return queue.empty();
+   }
+   
+   //-----{ Defulat Constructor }---------------------------------------------//
+   
+   template <typename T> 
+   Queue<T>::Queue()
+   {
+   }
+
+   //-----{ Default Destructor }----------------------------------------------//
+   
+   template <typename T> Queue<T>::~Queue()
+   {
+   }
+
+   //-----{ Add Elements to Back of Queue }-----------------------------------//
+
+   template <typename T> 
+   void Queue<T>::push(const T &t)
+   {
+      queue.push(t);
+   }
+
+   //-----{ Remove Elements from Front of Queue }-----------------------------//
+
+   template <typename T> 
+   T Queue<T>::pop(void)
+   {
+      if(queue.empty())
+      {   
+         return safe;
+      }
+
+      // Pop the element into a temp, since we need to remain locked.
+      // this means getting front and then popping.
+      T temp = queue.front();
+      queue.pop();
+   
+      return temp;
+   }
+
+   //-----{ Returnreference to element at front of Queue }--------------------//
+
+   template <typename T> 
+   T& Queue<T>::front(void)
+   {
+      if(queue.empty())
+      {
+         return safe;
+      }
+         
+      return queue.front();
+   }
+   
+   //-----{ Returnreference to element at front of Queue }--------------------//
+
+   template <typename T> 
+   const T& Queue<T>::front(void) const
+   {
+      if(queue.empty())
+      {   
+         return safe;
+      }
+
+      return queue.front();
+   }
+   
+   //-----{ Returnreference to element at back of Queue }---------------------//
+
+   template <typename T> 
+   T& Queue<T>::back(void)
+   {
+      if(queue.empty())
+      {
+         return safe;
+      }
+         
+      return queue.back();
+   }
+   
+   //-----{ Returnreference to element at back of Queue }---------------------//
+
+   template <typename T> 
+   const T& Queue<T>::back(void) const
+   {
+      if(queue.empty())
+      {
+         return safe;
+      }
+   
+      return queue.back();
+   }
+
+}}
+
+#endif /* ACTIVEMQ_UTIL_QUEUE_H */

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp Wed Jul  5 15:27:34 2006
@@ -1,171 +1,171 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "StringTokenizer.h"
-
-using namespace std;
-using namespace activemq;
-using namespace activemq::util;
-using namespace activemq::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-StringTokenizer::StringTokenizer(const std::string& str, 
-                                 const std::string& delim, 
-                                 bool returnDelims)
-{
-   // store off the data
-   this->str = str;
-   this->delim = delim;
-   this->returnDelims = returnDelims;
-   
-   // Start and the beginning
-   pos = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-StringTokenizer::~StringTokenizer(void)
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int StringTokenizer::countTokens(void) const
-{
-   int count = 0;
-   string::size_type localPos = pos;
-   string::size_type lastPos  = pos;
-
-   while(localPos != string::npos)
-   {
-      if(returnDelims && str.find_first_of(delim, localPos) == localPos)
-      {
-         count += 1;
-         localPos += 1;
-
-         continue;
-      }
-
-      // Find first token by spanning the fist non-delimiter, to the
-      // next delimiter, skipping any delimiters that are at the curret
-      // location.
-      lastPos  = str.find_first_not_of(delim, localPos);
-      localPos = str.find_first_of(delim, lastPos);
-
-      if(lastPos != string::npos)
-      {
-         count++;
-      }
-   }
-
-	return count;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool StringTokenizer::hasMoreTokens(void) const
-{
-   string::size_type nextpos = 
-      returnDelims ? str.find_first_of(delim, pos) :
-                     str.find_first_not_of(delim, pos);
-
-   return (nextpos != string::npos);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string StringTokenizer::nextToken(void)
-   throw ( exceptions::NoSuchElementException )
-{
-   if(pos == string::npos)
-   {
-      throw NoSuchElementException(
-         __FILE__, __LINE__,
-         "StringTokenizer::nextToken - No more Tokens available");
-   }
-
-   if(returnDelims)
-   {
-      // if char at current pos is a delim return it and advance pos
-      if(str.find_first_of(delim, pos) == pos)
-      {
-         return str.substr(pos++, 1);
-      }
-   }
-
-   // Skip delimiters at beginning.
-   string::size_type lastPos = str.find_first_not_of(delim, pos);
-   
-   // Find the next delimiter in the string, the charactors in between
-   // will be the token to return.  If this returns string::npos then
-   // there are no more delimiters in the string.
-   pos = str.find_first_of(delim, lastPos);
-
-   if(string::npos != lastPos)
-   {
-      // Found a token, count it, if the pos of the next delim is npos
-      // then we set length to copy to npos so that all the remianing
-      // portion of the string is copied, otherwise we set it to the 
-      return str.substr(lastPos, 
-                        pos == string::npos ? pos : pos-lastPos);
-   }
-   else
-   {
-      throw NoSuchElementException(
-         __FILE__, __LINE__,
-         "StringTokenizer::nextToken - No more Tokens available");
-   }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string StringTokenizer::nextToken(const std::string& delim)
-   throw ( exceptions::NoSuchElementException )
-{
-    this->delim = delim;
-
-    return nextToken();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned int StringTokenizer::toArray(std::vector<std::string>& array)
-{
-    int count = 0;
-
-    while(hasMoreTokens())
-    {
-        array.push_back(nextToken());
-        count++;
-    }
-
-    return count;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void StringTokenizer::reset(const std::string& str,
-                            const std::string& delim,
-                            bool returnDelims)
-{
-    if(str != "")
-    {
-        this->str = str;
-    }
-
-    if(delim != "")
-    {
-        this->delim = delim;
-    }
-
-    this->returnDelims = returnDelims;
-
-    // Begin at the Beginning
-    this->pos = 0;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "StringTokenizer.h"
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+StringTokenizer::StringTokenizer(const std::string& str, 
+                                 const std::string& delim, 
+                                 bool returnDelims)
+{
+   // store off the data
+   this->str = str;
+   this->delim = delim;
+   this->returnDelims = returnDelims;
+   
+   // Start and the beginning
+   pos = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+StringTokenizer::~StringTokenizer(void)
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int StringTokenizer::countTokens(void) const
+{
+   int count = 0;
+   string::size_type localPos = pos;
+   string::size_type lastPos  = pos;
+
+   while(localPos != string::npos)
+   {
+      if(returnDelims && str.find_first_of(delim, localPos) == localPos)
+      {
+         count += 1;
+         localPos += 1;
+
+         continue;
+      }
+
+      // Find first token by spanning the fist non-delimiter, to the
+      // next delimiter, skipping any delimiters that are at the curret
+      // location.
+      lastPos  = str.find_first_not_of(delim, localPos);
+      localPos = str.find_first_of(delim, lastPos);
+
+      if(lastPos != string::npos)
+      {
+         count++;
+      }
+   }
+
+	return count;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool StringTokenizer::hasMoreTokens(void) const
+{
+   string::size_type nextpos = 
+      returnDelims ? str.find_first_of(delim, pos) :
+                     str.find_first_not_of(delim, pos);
+
+   return (nextpos != string::npos);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string StringTokenizer::nextToken(void)
+   throw ( exceptions::NoSuchElementException )
+{
+   if(pos == string::npos)
+   {
+      throw NoSuchElementException(
+         __FILE__, __LINE__,
+         "StringTokenizer::nextToken - No more Tokens available");
+   }
+
+   if(returnDelims)
+   {
+      // if char at current pos is a delim return it and advance pos
+      if(str.find_first_of(delim, pos) == pos)
+      {
+         return str.substr(pos++, 1);
+      }
+   }
+
+   // Skip delimiters at beginning.
+   string::size_type lastPos = str.find_first_not_of(delim, pos);
+   
+   // Find the next delimiter in the string, the charactors in between
+   // will be the token to return.  If this returns string::npos then
+   // there are no more delimiters in the string.
+   pos = str.find_first_of(delim, lastPos);
+
+   if(string::npos != lastPos)
+   {
+      // Found a token, count it, if the pos of the next delim is npos
+      // then we set length to copy to npos so that all the remianing
+      // portion of the string is copied, otherwise we set it to the 
+      return str.substr(lastPos, 
+                        pos == string::npos ? pos : pos-lastPos);
+   }
+   else
+   {
+      throw NoSuchElementException(
+         __FILE__, __LINE__,
+         "StringTokenizer::nextToken - No more Tokens available");
+   }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string StringTokenizer::nextToken(const std::string& delim)
+   throw ( exceptions::NoSuchElementException )
+{
+    this->delim = delim;
+
+    return nextToken();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned int StringTokenizer::toArray(std::vector<std::string>& array)
+{
+    int count = 0;
+
+    while(hasMoreTokens())
+    {
+        array.push_back(nextToken());
+        count++;
+    }
+
+    return count;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void StringTokenizer::reset(const std::string& str,
+                            const std::string& delim,
+                            bool returnDelims)
+{
+    if(str != "")
+    {
+        this->str = str;
+    }
+
+    if(delim != "")
+    {
+        this->delim = delim;
+    }
+
+    this->returnDelims = returnDelims;
+
+    // Begin at the Beginning
+    this->pos = 0;
+}

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h Wed Jul  5 15:27:34 2006
@@ -1,139 +1,139 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _ACTIVEMQ_UTIL_STRINGTOKENIZER_H_
-#define _ACTIVEMQ_UTIL_STRINGTOKENIZER_H_
-
-#include <activemq/exceptions/NoSuchElementException.h>
-#include <string>
-
-namespace activemq{
-namespace util{
-
-   class StringTokenizer
-   {
-   private:
-   
-      // String to tokenize
-      std::string str;
-      
-      // The delimiter string
-      std::string delim;
-      
-      // The current pos in the string
-      std::string::size_type pos;
-      
-      // Are we returning delimiters
-      bool returnDelims;
-      
-   public:
-
-      /**
-       * Constructs a string tokenizer for the specified string. All 
-       * characters in the delim argument are the delimiters for separating 
-       * tokens.
-       *
-       * If the returnDelims flag is true, then the delimiter characters are 
-       * also returned as tokens. Each delimiter is returned as a string of 
-       * length one. If the flag is false, the delimiter characters are 
-       * skipped and only serve as separators between tokens.
-       *
-       * Note that if delim is "", this constructor does not throw an 
-       * exception. However, trying to invoke other methods on the resulting 
-       * StringTokenizer may result in an Exception. 
-       * @param string to tokenize
-       * @param String containing the delimiters
-       * @param boolean indicating if the delimiters are returned as tokens
-       */
-      StringTokenizer(const std::string& str,
-                      const std::string& delim = " \t\n\r\f",
-                      bool returnDelims = false);
-
-      /**
-       * Destructor
-       */
-   	  virtual ~StringTokenizer(void);
-      
-      /**
-       * Calculates the number of times that this tokenizer's nextToken 
-       * method can be called before it generates an exception. The current 
-       * position is not advanced.
-       * @return Count of remaining tokens
-       */
-      virtual int countTokens(void) const;
-
-      /**
-       * Tests if there are more tokens available from this tokenizer's 
-       * string.
-       * @return true if there are more tokens remaining
-       */
-      virtual bool hasMoreTokens(void) const;
-      
-      /**
-       * Returns the next token from this string tokenizer.
-       * @return string value of next token
-       * @thorws NoSuchElementException
-       */
-      virtual std::string nextToken(void) 
-         throw ( exceptions::NoSuchElementException );
-      
-      /**
-       * Returns the next token in this string tokenizer's string. First, 
-       * the set of characters considered to be delimiters by this 
-       * StringTokenizer object is changed to be the characters in the 
-       * string delim. Then the next token in the string after the current 
-       * position is returned. The current position is advanced beyond the 
-       * recognized token. The new delimiter set remains the default after 
-       * this call.
-       * @param string containing the new set of delimiters
-       * @return next string in the token list
-       * @throw NoSuchElementException
-       */
-      virtual std::string nextToken(const std::string& delim) 
-         throw ( exceptions::NoSuchElementException );
-
-      /**
-       * Grab all remaining tokens in the String and return them
-       * in the vector that is passed in by reference.
-       * @param vector to place token strings in
-       * @return number of string placed into the vector
-       */
-      virtual unsigned int toArray(std::vector<std::string>& array);
-
-      /**
-       * Resets the Tokenizer's position in the String to the Beginning
-       * calls to countToken and nextToken now start back at the beginning.
-       * This allows this object to be reused, the caller need not create
-       * a new instance every time a String needs tokenizing.
-       * If set the string param will reset the string that this Tokenizer
-       * is working on.  If set to "" no change is made.
-       * If set the delim param will reset the string that this Tokenizer
-       * is using to tokenizer the string.  If set to "", no change is made
-       * If set the return Delims will set if this Tokenizer will return
-       * delimiters as tokens. Defaults to false.
-       * @param New String to tokenize or "", defaults to ""
-       * @param New Delimiter String to use or "", defaults to ""
-       * @param Should the Tokenizer return delimiters as Tokens, default false
-       */
-      virtual void reset(const std::string& str = "",
-                         const std::string& delim = "",
-                         bool returnDelims = false);
-   
-   };
-
-}}
-
-#endif /*_ACTIVEMQ_UTIL_STRINGTOKENIZER_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ACTIVEMQ_UTIL_STRINGTOKENIZER_H_
+#define _ACTIVEMQ_UTIL_STRINGTOKENIZER_H_
+
+#include <activemq/exceptions/NoSuchElementException.h>
+#include <string>
+
+namespace activemq{
+namespace util{
+
+   class StringTokenizer
+   {
+   private:
+   
+      // String to tokenize
+      std::string str;
+      
+      // The delimiter string
+      std::string delim;
+      
+      // The current pos in the string
+      std::string::size_type pos;
+      
+      // Are we returning delimiters
+      bool returnDelims;
+      
+   public:
+
+      /**
+       * Constructs a string tokenizer for the specified string. All 
+       * characters in the delim argument are the delimiters for separating 
+       * tokens.
+       *
+       * If the returnDelims flag is true, then the delimiter characters are 
+       * also returned as tokens. Each delimiter is returned as a string of 
+       * length one. If the flag is false, the delimiter characters are 
+       * skipped and only serve as separators between tokens.
+       *
+       * Note that if delim is "", this constructor does not throw an 
+       * exception. However, trying to invoke other methods on the resulting 
+       * StringTokenizer may result in an Exception. 
+       * @param string to tokenize
+       * @param String containing the delimiters
+       * @param boolean indicating if the delimiters are returned as tokens
+       */
+      StringTokenizer(const std::string& str,
+                      const std::string& delim = " \t\n\r\f",
+                      bool returnDelims = false);
+
+      /**
+       * Destructor
+       */
+   	  virtual ~StringTokenizer(void);
+      
+      /**
+       * Calculates the number of times that this tokenizer's nextToken 
+       * method can be called before it generates an exception. The current 
+       * position is not advanced.
+       * @return Count of remaining tokens
+       */
+      virtual int countTokens(void) const;
+
+      /**
+       * Tests if there are more tokens available from this tokenizer's 
+       * string.
+       * @return true if there are more tokens remaining
+       */
+      virtual bool hasMoreTokens(void) const;
+      
+      /**
+       * Returns the next token from this string tokenizer.
+       * @return string value of next token
+       * @thorws NoSuchElementException
+       */
+      virtual std::string nextToken(void) 
+         throw ( exceptions::NoSuchElementException );
+      
+      /**
+       * Returns the next token in this string tokenizer's string. First, 
+       * the set of characters considered to be delimiters by this 
+       * StringTokenizer object is changed to be the characters in the 
+       * string delim. Then the next token in the string after the current 
+       * position is returned. The current position is advanced beyond the 
+       * recognized token. The new delimiter set remains the default after 
+       * this call.
+       * @param string containing the new set of delimiters
+       * @return next string in the token list
+       * @throw NoSuchElementException
+       */
+      virtual std::string nextToken(const std::string& delim) 
+         throw ( exceptions::NoSuchElementException );
+
+      /**
+       * Grab all remaining tokens in the String and return them
+       * in the vector that is passed in by reference.
+       * @param vector to place token strings in
+       * @return number of string placed into the vector
+       */
+      virtual unsigned int toArray(std::vector<std::string>& array);
+
+      /**
+       * Resets the Tokenizer's position in the String to the Beginning
+       * calls to countToken and nextToken now start back at the beginning.
+       * This allows this object to be reused, the caller need not create
+       * a new instance every time a String needs tokenizing.
+       * If set the string param will reset the string that this Tokenizer
+       * is working on.  If set to "" no change is made.
+       * If set the delim param will reset the string that this Tokenizer
+       * is using to tokenizer the string.  If set to "", no change is made
+       * If set the return Delims will set if this Tokenizer will return
+       * delimiters as tokens. Defaults to false.
+       * @param New String to tokenize or "", defaults to ""
+       * @param New Delimiter String to use or "", defaults to ""
+       * @param Should the Tokenizer return delimiters as Tokens, default false
+       */
+      virtual void reset(const std::string& str = "",
+                         const std::string& delim = "",
+                         bool returnDelims = false);
+   
+   };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_STRINGTOKENIZER_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h Wed Jul  5 15:27:34 2006
@@ -1,38 +1,38 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _CMS_MAPMESSAGE_H_
-#define _CMS_MAPMESSAGE_H_
-
-#include <cms/Message.h>
-
-namespace cms
-{
-
-   class MapMessage : public Message
-   {
-   public:
-
-      /**
-       * Destructor
-       */
-      virtual ~MapMessage(void) {}
-
-   };
-
-}
-
-#endif /*_CMS_MAPMESSAGE_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _CMS_MAPMESSAGE_H_
+#define _CMS_MAPMESSAGE_H_
+
+#include <cms/Message.h>
+
+namespace cms
+{
+
+   class MapMessage : public Message
+   {
+   public:
+
+      /**
+       * Destructor
+       */
+      virtual ~MapMessage(void) {}
+
+   };
+
+}
+
+#endif /*_CMS_MAPMESSAGE_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h Wed Jul  5 15:27:34 2006
@@ -1,46 +1,46 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _CMS_TEMPORARYQUEUE_H_
-#define _CMS_TEMPORARYQUEUE_H_
-
-#include <cms/Destination.h>
-#include <cms/CMSException.h>
-
-namespace cms{
-
-    /**
-     * An interface encapsulating a provider-specific queue name.
-     */
-    class TemporaryQueue : public Destination
-    {
-    public:
-
-        virtual ~TemporaryQueue(void) {}
-
-        /**
-         * Gets the name of this queue.
-         * @return The queue name.
-         */
-        virtual const char* getQueueName(void) const 
-            throw( CMSException ) = 0;
-        
-   };
-
-}
-
-#endif /*_CMS_TEMPORARYQUEUE_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_TEMPORARYQUEUE_H_
+#define _CMS_TEMPORARYQUEUE_H_
+
+#include <cms/Destination.h>
+#include <cms/CMSException.h>
+
+namespace cms{
+
+    /**
+     * An interface encapsulating a provider-specific queue name.
+     */
+    class TemporaryQueue : public Destination
+    {
+    public:
+
+        virtual ~TemporaryQueue(void) {}
+
+        /**
+         * Gets the name of this queue.
+         * @return The queue name.
+         */
+        virtual const char* getQueueName(void) const 
+            throw( CMSException ) = 0;
+        
+   };
+
+}
+
+#endif /*_CMS_TEMPORARYQUEUE_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp Wed Jul  5 15:27:34 2006
@@ -1,227 +1,227 @@
-#include "AbstractTester.h"
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <integration/common/IntegrationCommon.h>
-
-#include <activemq/core/ActiveMQConnectionFactory.h>
-#include <activemq/exceptions/ActiveMQException.h>
-#include <activemq/concurrent/Thread.h>
-#include <activemq/util/Guid.h>
-
-#include <cms/Connection.h>
-#include <cms/Session.h>
-
-#include <sstream>
-
-using namespace std;
-using namespace cms;
-using namespace activemq;
-using namespace activemq::core;
-using namespace activemq::util;
-using namespace activemq::exceptions;
-using namespace activemq::concurrent;
-
-using namespace integration;
-using namespace integration::common;
-
-AbstractTester::AbstractTester( cms::Session::AcknowledgeMode ackMode )
-{
-    try
-    {
-        string url = IntegrationCommon::defaultURL;
-        numReceived = 0;
-    
-        // Create a Factory
-        connectionFactory = new ActiveMQConnectionFactory( url );
-
-        // Now create the connection
-        connection = connectionFactory->createConnection(
-            "", "", Guid().createGUIDString() );
-    
-        // Set ourself as a recipient of Exceptions        
-        connection->setExceptionListener( this );
-        connection->start();
-        
-        // Create a Session
-        session = connection->createSession( ackMode );
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
-}
-
-AbstractTester::~AbstractTester()
-{
-    try
-    {
-        session->close();
-        connection->close();
-
-        delete session;
-        delete connection;
-        delete connectionFactory;
-    }
-    AMQ_CATCH_NOTHROW( ActiveMQException )
-    AMQ_CATCHALL_NOTHROW( )
-}
-
-void AbstractTester::doSleep(void) 
-{
-    Thread::sleep( IntegrationCommon::defaultDelay );
-}
-
-unsigned int AbstractTester::produceTextMessages( 
-    cms::MessageProducer& producer,
-    unsigned int count )
-{
-    try
-    {
-        // Send some text messages.
-        ostringstream stream;
-        string text = "this is a test text message: id = ";
-        
-        cms::TextMessage* textMsg = 
-            session->createTextMessage();
-
-        unsigned int realCount = 0;
-                     
-        for( unsigned int ix=0; ix<count; ++ix ){
-            stream << text << ix << ends;
-            textMsg->setText( stream.str().c_str() );        
-            stream.str("");  
-            producer.send( *textMsg );
-            doSleep();
-            ++realCount;
-        }
-
-        delete textMsg;
-
-        return realCount;
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )    
-}
-
-unsigned int AbstractTester::produceBytesMessages( 
-    cms::MessageProducer& producer,
-    unsigned int count )
-{
-    try
-    {
-        unsigned char buf[10];
-        memset( buf, 0, 10 );
-        buf[0] = 0;
-        buf[1] = 1;
-        buf[2] = 2;
-        buf[3] = 3;
-        buf[4] = 0;
-        buf[5] = 4;
-        buf[6] = 5;
-        buf[7] = 6;
-
-        cms::BytesMessage* bytesMsg = 
-            session->createBytesMessage();
-        bytesMsg->setBodyBytes( buf, 10 );
-
-        unsigned int realCount = 0;
-        for( unsigned int ix=0; ix<count; ++ix ){                
-            producer.send( *bytesMsg ); 
-            doSleep();
-            ++realCount;
-        }
-
-        delete bytesMsg;
-
-        return realCount;
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )    
-}
-
-void AbstractTester::waitForMessages( unsigned int count )
-{
-    try
-    {
-        synchronized( &mutex )
-        {
-            int stopAtZero = count + 5;
-            
-            while( numReceived < count )
-            {
-                mutex.wait( 500 );
-                
-                if( --stopAtZero == 0 )
-                {
-                    break;
-                }
-            }
-        }
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )    
-}
-
-void AbstractTester::onException( const cms::CMSException& error )
-{
-    bool AbstractTester = false;
-    CPPUNIT_ASSERT( AbstractTester );
-}
-
-void AbstractTester::onMessage( const cms::Message& message )
-{
-    try
-    {
-        // Got a text message.
-        const cms::TextMessage& txtMsg = 
-            dynamic_cast<const cms::TextMessage&>(message);
-            
-        std::string text = txtMsg.getText();
-
-//            printf("received text msg: %s\n", txtMsg.getText() );
-
-        numReceived++;
-
-        // Signal that we got one
-        synchronized( &mutex )
-        {
-            mutex.notifyAll();
-        }
-
-        return;
-    }
-    catch( std::bad_cast& ex )
-    {}
-    
-    try
-    {
-        // Got a bytes msg.
-        const cms::BytesMessage& bytesMsg = 
-            dynamic_cast<const cms::BytesMessage&>(message);
-
-        const unsigned char* bytes = bytesMsg.getBodyBytes();
-        
-        string transcode( (const char*)bytes, bytesMsg.getBodyLength() );
-
-        //printf("received bytes msg: " );
-        //int numBytes = bytesMsg.getBodyLength();
-        //for( int ix=0; ix<numBytes; ++ix ){
-           // printf("[%d]", bytes[ix] );
-        //}
-        //printf("\n");
-
-        numReceived++;
-        
-        // Signal that we got one
-        synchronized( &mutex )
-        {
-            mutex.notifyAll();
-        }
-
-        return;
-    }
-    catch( std::bad_cast& ex )
-    {
-        bool AbstractTester = false;
-        CPPUNIT_ASSERT( AbstractTester );
-    }
-}
+#include "AbstractTester.h"
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <integration/common/IntegrationCommon.h>
+
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/exceptions/ActiveMQException.h>
+#include <activemq/concurrent/Thread.h>
+#include <activemq/util/Guid.h>
+
+#include <cms/Connection.h>
+#include <cms/Session.h>
+
+#include <sstream>
+
+using namespace std;
+using namespace cms;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::util;
+using namespace activemq::exceptions;
+using namespace activemq::concurrent;
+
+using namespace integration;
+using namespace integration::common;
+
+AbstractTester::AbstractTester( cms::Session::AcknowledgeMode ackMode )
+{
+    try
+    {
+        string url = IntegrationCommon::defaultURL;
+        numReceived = 0;
+    
+        // Create a Factory
+        connectionFactory = new ActiveMQConnectionFactory( url );
+
+        // Now create the connection
+        connection = connectionFactory->createConnection(
+            "", "", Guid().createGUIDString() );
+    
+        // Set ourself as a recipient of Exceptions        
+        connection->setExceptionListener( this );
+        connection->start();
+        
+        // Create a Session
+        session = connection->createSession( ackMode );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+AbstractTester::~AbstractTester()
+{
+    try
+    {
+        session->close();
+        connection->close();
+
+        delete session;
+        delete connection;
+        delete connectionFactory;
+    }
+    AMQ_CATCH_NOTHROW( ActiveMQException )
+    AMQ_CATCHALL_NOTHROW( )
+}
+
+void AbstractTester::doSleep(void) 
+{
+    Thread::sleep( IntegrationCommon::defaultDelay );
+}
+
+unsigned int AbstractTester::produceTextMessages( 
+    cms::MessageProducer& producer,
+    unsigned int count )
+{
+    try
+    {
+        // Send some text messages.
+        ostringstream stream;
+        string text = "this is a test text message: id = ";
+        
+        cms::TextMessage* textMsg = 
+            session->createTextMessage();
+
+        unsigned int realCount = 0;
+                     
+        for( unsigned int ix=0; ix<count; ++ix ){
+            stream << text << ix << ends;
+            textMsg->setText( stream.str().c_str() );        
+            stream.str("");  
+            producer.send( *textMsg );
+            doSleep();
+            ++realCount;
+        }
+
+        delete textMsg;
+
+        return realCount;
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )    
+}
+
+unsigned int AbstractTester::produceBytesMessages( 
+    cms::MessageProducer& producer,
+    unsigned int count )
+{
+    try
+    {
+        unsigned char buf[10];
+        memset( buf, 0, 10 );
+        buf[0] = 0;
+        buf[1] = 1;
+        buf[2] = 2;
+        buf[3] = 3;
+        buf[4] = 0;
+        buf[5] = 4;
+        buf[6] = 5;
+        buf[7] = 6;
+
+        cms::BytesMessage* bytesMsg = 
+            session->createBytesMessage();
+        bytesMsg->setBodyBytes( buf, 10 );
+
+        unsigned int realCount = 0;
+        for( unsigned int ix=0; ix<count; ++ix ){                
+            producer.send( *bytesMsg ); 
+            doSleep();
+            ++realCount;
+        }
+
+        delete bytesMsg;
+
+        return realCount;
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )    
+}
+
+void AbstractTester::waitForMessages( unsigned int count )
+{
+    try
+    {
+        synchronized( &mutex )
+        {
+            int stopAtZero = count + 5;
+            
+            while( numReceived < count )
+            {
+                mutex.wait( 500 );
+                
+                if( --stopAtZero == 0 )
+                {
+                    break;
+                }
+            }
+        }
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )    
+}
+
+void AbstractTester::onException( const cms::CMSException& error )
+{
+    bool AbstractTester = false;
+    CPPUNIT_ASSERT( AbstractTester );
+}
+
+void AbstractTester::onMessage( const cms::Message& message )
+{
+    try
+    {
+        // Got a text message.
+        const cms::TextMessage& txtMsg = 
+            dynamic_cast<const cms::TextMessage&>(message);
+            
+        std::string text = txtMsg.getText();
+
+//            printf("received text msg: %s\n", txtMsg.getText() );
+
+        numReceived++;
+
+        // Signal that we got one
+        synchronized( &mutex )
+        {
+            mutex.notifyAll();
+        }
+
+        return;
+    }
+    catch( std::bad_cast& ex )
+    {}
+    
+    try
+    {
+        // Got a bytes msg.
+        const cms::BytesMessage& bytesMsg = 
+            dynamic_cast<const cms::BytesMessage&>(message);
+
+        const unsigned char* bytes = bytesMsg.getBodyBytes();
+        
+        string transcode( (const char*)bytes, bytesMsg.getBodyLength() );
+
+        //printf("received bytes msg: " );
+        //int numBytes = bytesMsg.getBodyLength();
+        //for( int ix=0; ix<numBytes; ++ix ){
+           // printf("[%d]", bytes[ix] );
+        //}
+        //printf("\n");
+
+        numReceived++;
+        
+        // Signal that we got one
+        synchronized( &mutex )
+        {
+            mutex.notifyAll();
+        }
+
+        return;
+    }
+    catch( std::bad_cast& ex )
+    {
+        bool AbstractTester = false;
+        CPPUNIT_ASSERT( AbstractTester );
+    }
+}

Propchange: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp Wed Jul  5 15:27:34 2006
@@ -1,8 +1,8 @@
-#include "IntegrationCommon.h"
-
-using namespace integration;
-using namespace integration::common;
-
-const std::string IntegrationCommon::defaultURL = "tcp://127.0.0.1:61613";
-const int         IntegrationCommon::defaultDelay = 5;
-const unsigned int         IntegrationCommon::defaultMsgCount = 1000;
+#include "IntegrationCommon.h"
+
+using namespace integration;
+using namespace integration::common;
+
+const std::string IntegrationCommon::defaultURL = "tcp://127.0.0.1:61613";
+const int         IntegrationCommon::defaultDelay = 5;
+const unsigned int         IntegrationCommon::defaultMsgCount = 1000;

Propchange: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp Wed Jul  5 15:27:34 2006
@@ -1,120 +1,120 @@
-#include "DurableTester.h"
-#include <integration/common/IntegrationCommon.h>
-
-CPPUNIT_TEST_SUITE_REGISTRATION( integration::durable::DurableTester );
-
-#include <activemq/concurrent/Thread.h>
-#include <activemq/connector/stomp/StompConnector.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/transport/TransportFactory.h>
-#include <activemq/util/Guid.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/util/StringTokenizer.h>
-#include <activemq/connector/ConnectorFactoryMap.h>
-#include <activemq/network/SocketFactory.h>
-#include <activemq/transport/TransportFactory.h>
-#include <activemq/network/Socket.h>
-#include <activemq/exceptions/NullPointerException.h>
-#include <activemq/core/ActiveMQConnection.h>
-#include <activemq/core/ActiveMQConsumer.h>
-#include <activemq/core/ActiveMQProducer.h>
-#include <activemq/util/StringTokenizer.h>
-#include <activemq/util/Boolean.h>
-
-#include <cms/Connection.h>
-#include <cms/MessageConsumer.h>
-#include <cms/MessageProducer.h>
-#include <cms/MessageListener.h>
-#include <cms/Startable.h>
-#include <cms/Closeable.h>
-#include <cms/MessageListener.h>
-#include <cms/ExceptionListener.h>
-#include <cms/Topic.h>
-#include <cms/Queue.h>
-#include <cms/TemporaryTopic.h>
-#include <cms/TemporaryQueue.h>
-#include <cms/Session.h>
-#include <cms/BytesMessage.h>
-#include <cms/TextMessage.h>
-#include <cms/MapMessage.h>
-
-using namespace activemq::connector::stomp;
-using namespace activemq::transport;
-using namespace activemq::util;
-using namespace std;
-using namespace cms;
-using namespace activemq;
-using namespace activemq::core;
-using namespace activemq::util;
-using namespace activemq::connector;
-using namespace activemq::exceptions;
-using namespace activemq::network;
-using namespace activemq::transport;
-using namespace activemq::concurrent;
-
-using namespace integration;
-using namespace integration::durable;
-using namespace integration::common;
-
-DurableTester::DurableTester() : AbstractTester()
-{}
-
-DurableTester::~DurableTester()
-{}
-
-void DurableTester::test()
-{
-    try
-    {
-        cout << "Starting activemqcms durable test (sending "
-             << IntegrationCommon::defaultMsgCount
-             << " messages per type and sleeping "
-             << IntegrationCommon::defaultDelay 
-             << " milli-seconds) ...\n"
-             << endl;
-        
-        std::string subName = Guid().createGUID();
-
-        // Create CMS Object for Comms
-        cms::Topic* topic = session->createTopic("mytopic");
-        cms::MessageConsumer* consumer = 
-            session->createDurableConsumer( *topic, subName, "" );            
-        consumer->setMessageListener( this );
-        cms::MessageProducer* producer = 
-            session->createProducer( *topic );
-
-        unsigned int sent;
-
-        // Send some text messages
-        sent = this->produceTextMessages( *producer, 3 );
-        
-        // Wait for all messages
-        waitForMessages( sent );
-
-        printf("received: %d\n", numReceived );
-        CPPUNIT_ASSERT( numReceived == sent );
-
-        // Nuke the consumer
-        delete consumer;
-
-        // Send some text messages
-        sent += this->produceTextMessages( *producer, 3 );
-
-        consumer = session->createDurableConsumer( *topic, subName, "" );            
-
-        // Send some text messages
-        sent += this->produceTextMessages( *producer, 3 );
-
-        // Wait for all remaining messages
-        waitForMessages( sent - numReceived );
-        
-        printf("received: %d\n", numReceived );
- //       CPPUNIT_ASSERT( numReceived == sent );
-
-        printf("Shutting Down\n" );
-        delete producer;                      
-        delete consumer;
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
-}
+#include "DurableTester.h"
+#include <integration/common/IntegrationCommon.h>
+
+CPPUNIT_TEST_SUITE_REGISTRATION( integration::durable::DurableTester );
+
+#include <activemq/concurrent/Thread.h>
+#include <activemq/connector/stomp/StompConnector.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/transport/TransportFactory.h>
+#include <activemq/util/Guid.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/connector/ConnectorFactoryMap.h>
+#include <activemq/network/SocketFactory.h>
+#include <activemq/transport/TransportFactory.h>
+#include <activemq/network/Socket.h>
+#include <activemq/exceptions/NullPointerException.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/core/ActiveMQConsumer.h>
+#include <activemq/core/ActiveMQProducer.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/util/Boolean.h>
+
+#include <cms/Connection.h>
+#include <cms/MessageConsumer.h>
+#include <cms/MessageProducer.h>
+#include <cms/MessageListener.h>
+#include <cms/Startable.h>
+#include <cms/Closeable.h>
+#include <cms/MessageListener.h>
+#include <cms/ExceptionListener.h>
+#include <cms/Topic.h>
+#include <cms/Queue.h>
+#include <cms/TemporaryTopic.h>
+#include <cms/TemporaryQueue.h>
+#include <cms/Session.h>
+#include <cms/BytesMessage.h>
+#include <cms/TextMessage.h>
+#include <cms/MapMessage.h>
+
+using namespace activemq::connector::stomp;
+using namespace activemq::transport;
+using namespace activemq::util;
+using namespace std;
+using namespace cms;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::util;
+using namespace activemq::connector;
+using namespace activemq::exceptions;
+using namespace activemq::network;
+using namespace activemq::transport;
+using namespace activemq::concurrent;
+
+using namespace integration;
+using namespace integration::durable;
+using namespace integration::common;
+
+DurableTester::DurableTester() : AbstractTester()
+{}
+
+DurableTester::~DurableTester()
+{}
+
+void DurableTester::test()
+{
+    try
+    {
+        cout << "Starting activemqcms durable test (sending "
+             << IntegrationCommon::defaultMsgCount
+             << " messages per type and sleeping "
+             << IntegrationCommon::defaultDelay 
+             << " milli-seconds) ...\n"
+             << endl;
+        
+        std::string subName = Guid().createGUID();
+
+        // Create CMS Object for Comms
+        cms::Topic* topic = session->createTopic("mytopic");
+        cms::MessageConsumer* consumer = 
+            session->createDurableConsumer( *topic, subName, "" );            
+        consumer->setMessageListener( this );
+        cms::MessageProducer* producer = 
+            session->createProducer( *topic );
+
+        unsigned int sent;
+
+        // Send some text messages
+        sent = this->produceTextMessages( *producer, 3 );
+        
+        // Wait for all messages
+        waitForMessages( sent );
+
+        printf("received: %d\n", numReceived );
+        CPPUNIT_ASSERT( numReceived == sent );
+
+        // Nuke the consumer
+        delete consumer;
+
+        // Send some text messages
+        sent += this->produceTextMessages( *producer, 3 );
+
+        consumer = session->createDurableConsumer( *topic, subName, "" );            
+
+        // Send some text messages
+        sent += this->produceTextMessages( *producer, 3 );
+
+        // Wait for all remaining messages
+        waitForMessages( sent - numReceived );
+        
+        printf("received: %d\n", numReceived );
+ //       CPPUNIT_ASSERT( numReceived == sent );
+
+        printf("Shutting Down\n" );
+        delete producer;                      
+        delete consumer;
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}

Propchange: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp Wed Jul  5 15:27:34 2006
@@ -1,109 +1,109 @@
-#include "SimpleTester.h"
-#include <integration/common/IntegrationCommon.h>
-
-CPPUNIT_TEST_SUITE_REGISTRATION( integration::simple::SimpleTester );
-
-#include <activemq/concurrent/Thread.h>
-#include <activemq/connector/stomp/StompConnector.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/transport/TransportFactory.h>
-#include <activemq/util/Guid.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/util/StringTokenizer.h>
-#include <activemq/connector/ConnectorFactoryMap.h>
-#include <activemq/network/SocketFactory.h>
-#include <activemq/transport/TransportFactory.h>
-#include <activemq/network/Socket.h>
-#include <activemq/exceptions/NullPointerException.h>
-#include <activemq/core/ActiveMQConnection.h>
-#include <activemq/core/ActiveMQConsumer.h>
-#include <activemq/core/ActiveMQProducer.h>
-#include <activemq/util/StringTokenizer.h>
-#include <activemq/util/Boolean.h>
-
-#include <cms/Connection.h>
-#include <cms/MessageConsumer.h>
-#include <cms/MessageProducer.h>
-#include <cms/MessageListener.h>
-#include <cms/Startable.h>
-#include <cms/Closeable.h>
-#include <cms/MessageListener.h>
-#include <cms/ExceptionListener.h>
-#include <cms/Topic.h>
-#include <cms/Queue.h>
-#include <cms/TemporaryTopic.h>
-#include <cms/TemporaryQueue.h>
-#include <cms/Session.h>
-#include <cms/BytesMessage.h>
-#include <cms/TextMessage.h>
-#include <cms/MapMessage.h>
-
-using namespace activemq::connector::stomp;
-using namespace activemq::transport;
-using namespace activemq::util;
-using namespace std;
-using namespace cms;
-using namespace activemq;
-using namespace activemq::core;
-using namespace activemq::util;
-using namespace activemq::connector;
-using namespace activemq::exceptions;
-using namespace activemq::network;
-using namespace activemq::transport;
-using namespace activemq::concurrent;
-
-using namespace integration;
-using namespace integration::simple;
-using namespace integration::common;
-
-SimpleTester::SimpleTester() : AbstractTester()
-{
-    numReceived = 0;
-}
-
-SimpleTester::~SimpleTester()
-{
-}
-
-void SimpleTester::test()
-{
-    try
-    {
-        cout << "Starting activemqcms test (sending "
-             << IntegrationCommon::defaultMsgCount
-             << " messages per type and sleeping "
-             << IntegrationCommon::defaultDelay 
-             << " milli-seconds) ...\n"
-             << endl;
-        
-        // Create CMS Object for Comms
-        cms::Topic* topic = session->createTopic("mytopic");
-        cms::MessageConsumer* consumer = 
-            session->createConsumer( *topic );            
-        consumer->setMessageListener( this );
-        cms::MessageProducer* producer = 
-            session->createProducer( *topic );
-
-        // Send some text messages
-        this->produceTextMessages( 
-            *producer, IntegrationCommon::defaultMsgCount );
-        
-        // Send some bytes messages.
-        this->produceTextMessages( 
-            *producer, IntegrationCommon::defaultMsgCount );
-
-        // Wait for the messages to get here
-        waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
-        
-        printf("received: %d\n", numReceived );
-        CPPUNIT_ASSERT( 
-            numReceived == IntegrationCommon::defaultMsgCount * 2 );
-
-        printf("Shutting Down\n" );
-        delete producer;                      
-        delete consumer;
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
-}
-
+#include "SimpleTester.h"
+#include <integration/common/IntegrationCommon.h>
+
+CPPUNIT_TEST_SUITE_REGISTRATION( integration::simple::SimpleTester );
+
+#include <activemq/concurrent/Thread.h>
+#include <activemq/connector/stomp/StompConnector.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/transport/TransportFactory.h>
+#include <activemq/util/Guid.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/connector/ConnectorFactoryMap.h>
+#include <activemq/network/SocketFactory.h>
+#include <activemq/transport/TransportFactory.h>
+#include <activemq/network/Socket.h>
+#include <activemq/exceptions/NullPointerException.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/core/ActiveMQConsumer.h>
+#include <activemq/core/ActiveMQProducer.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/util/Boolean.h>
+
+#include <cms/Connection.h>
+#include <cms/MessageConsumer.h>
+#include <cms/MessageProducer.h>
+#include <cms/MessageListener.h>
+#include <cms/Startable.h>
+#include <cms/Closeable.h>
+#include <cms/MessageListener.h>
+#include <cms/ExceptionListener.h>
+#include <cms/Topic.h>
+#include <cms/Queue.h>
+#include <cms/TemporaryTopic.h>
+#include <cms/TemporaryQueue.h>
+#include <cms/Session.h>
+#include <cms/BytesMessage.h>
+#include <cms/TextMessage.h>
+#include <cms/MapMessage.h>
+
+using namespace activemq::connector::stomp;
+using namespace activemq::transport;
+using namespace activemq::util;
+using namespace std;
+using namespace cms;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::util;
+using namespace activemq::connector;
+using namespace activemq::exceptions;
+using namespace activemq::network;
+using namespace activemq::transport;
+using namespace activemq::concurrent;
+
+using namespace integration;
+using namespace integration::simple;
+using namespace integration::common;
+
+SimpleTester::SimpleTester() : AbstractTester()
+{
+    numReceived = 0;
+}
+
+SimpleTester::~SimpleTester()
+{
+}
+
+void SimpleTester::test()
+{
+    try
+    {
+        cout << "Starting activemqcms test (sending "
+             << IntegrationCommon::defaultMsgCount
+             << " messages per type and sleeping "
+             << IntegrationCommon::defaultDelay 
+             << " milli-seconds) ...\n"
+             << endl;
+        
+        // Create CMS Object for Comms
+        cms::Topic* topic = session->createTopic("mytopic");
+        cms::MessageConsumer* consumer = 
+            session->createConsumer( *topic );            
+        consumer->setMessageListener( this );
+        cms::MessageProducer* producer = 
+            session->createProducer( *topic );
+
+        // Send some text messages
+        this->produceTextMessages( 
+            *producer, IntegrationCommon::defaultMsgCount );
+        
+        // Send some bytes messages.
+        this->produceTextMessages( 
+            *producer, IntegrationCommon::defaultMsgCount );
+
+        // Wait for the messages to get here
+        waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        
+        printf("received: %d\n", numReceived );
+        CPPUNIT_ASSERT( 
+            numReceived == IntegrationCommon::defaultMsgCount * 2 );
+
+        printf("Shutting Down\n" );
+        delete producer;                      
+        delete consumer;
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+

Propchange: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp Wed Jul  5 15:27:34 2006
@@ -1,125 +1,125 @@
-#include "TransactionTester.h"
-#include <integration/common/IntegrationCommon.h>
-
-CPPUNIT_TEST_SUITE_REGISTRATION( integration::transactional::TransactionTester );
-
-#include <activemq/concurrent/Thread.h>
-#include <activemq/connector/stomp/StompConnector.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/transport/TransportFactory.h>
-#include <activemq/util/Guid.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/util/StringTokenizer.h>
-#include <activemq/connector/ConnectorFactoryMap.h>
-#include <activemq/network/SocketFactory.h>
-#include <activemq/transport/TransportFactory.h>
-#include <activemq/network/Socket.h>
-#include <activemq/exceptions/NullPointerException.h>
-#include <activemq/core/ActiveMQConnection.h>
-#include <activemq/core/ActiveMQConsumer.h>
-#include <activemq/core/ActiveMQProducer.h>
-#include <activemq/util/StringTokenizer.h>
-#include <activemq/util/Boolean.h>
-
-#include <cms/Connection.h>
-#include <cms/MessageConsumer.h>
-#include <cms/MessageProducer.h>
-#include <cms/MessageListener.h>
-#include <cms/Startable.h>
-#include <cms/Closeable.h>
-#include <cms/MessageListener.h>
-#include <cms/ExceptionListener.h>
-#include <cms/Topic.h>
-#include <cms/Queue.h>
-#include <cms/TemporaryTopic.h>
-#include <cms/TemporaryQueue.h>
-#include <cms/Session.h>
-#include <cms/BytesMessage.h>
-#include <cms/TextMessage.h>
-#include <cms/MapMessage.h>
-
-using namespace activemq::connector::stomp;
-using namespace activemq::transport;
-using namespace activemq::util;
-using namespace std;
-using namespace cms;
-using namespace activemq;
-using namespace activemq::core;
-using namespace activemq::util;
-using namespace activemq::connector;
-using namespace activemq::exceptions;
-using namespace activemq::network;
-using namespace activemq::transport;
-using namespace activemq::concurrent;
-
-using namespace integration;
-using namespace integration::transactional;
-using namespace integration::common;
-
-TransactionTester::TransactionTester() : AbstractTester( cms::Session::Transactional )
-{}
-
-TransactionTester::~TransactionTester()
-{}
-
-void TransactionTester::test()
-{
-    try
-    {
-        cout << "Starting activemqcms transactional test (sending "
-             << IntegrationCommon::defaultMsgCount
-             << " messages per type and sleeping "
-             << IntegrationCommon::defaultDelay 
-             << " milli-seconds) ...\n"
-             << endl;
-        
-        // Create CMS Object for Comms
-        cms::Topic* topic = session->createTopic("mytopic");
-        cms::MessageConsumer* consumer = 
-            session->createConsumer( *topic );            
-        consumer->setMessageListener( this );
-        cms::MessageProducer* producer = 
-            session->createProducer( *topic );
-
-        // Send some text messages
-        this->produceTextMessages( 
-            *producer, IntegrationCommon::defaultMsgCount );
-            
-        session->commit();
-        
-        // Send some bytes messages.
-        this->produceTextMessages( 
-            *producer, IntegrationCommon::defaultMsgCount );
-        
-        session->commit();
-
-        // Wait till we get all the messages
-        waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
-        
-        printf("received: %d\n", numReceived );
-        CPPUNIT_ASSERT( 
-            numReceived == IntegrationCommon::defaultMsgCount * 2 );
-
-        numReceived = 0;
-
-        // Send some text messages
-        this->produceTextMessages( 
-            *producer, IntegrationCommon::defaultMsgCount );
-            
-        session->rollback();
-
-        // Wait till we get all the messages
-        waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
-
-        printf("received: %d\n", numReceived );
-        CPPUNIT_ASSERT( 
-            numReceived == IntegrationCommon::defaultMsgCount );
-
-        printf("Shutting Down\n" );
-        delete producer;                      
-        delete consumer;
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
-}
-
+#include "TransactionTester.h"
+#include <integration/common/IntegrationCommon.h>
+
+CPPUNIT_TEST_SUITE_REGISTRATION( integration::transactional::TransactionTester );
+
+#include <activemq/concurrent/Thread.h>
+#include <activemq/connector/stomp/StompConnector.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/transport/TransportFactory.h>
+#include <activemq/util/Guid.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/connector/ConnectorFactoryMap.h>
+#include <activemq/network/SocketFactory.h>
+#include <activemq/transport/TransportFactory.h>
+#include <activemq/network/Socket.h>
+#include <activemq/exceptions/NullPointerException.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/core/ActiveMQConsumer.h>
+#include <activemq/core/ActiveMQProducer.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/util/Boolean.h>
+
+#include <cms/Connection.h>
+#include <cms/MessageConsumer.h>
+#include <cms/MessageProducer.h>
+#include <cms/MessageListener.h>
+#include <cms/Startable.h>
+#include <cms/Closeable.h>
+#include <cms/MessageListener.h>
+#include <cms/ExceptionListener.h>
+#include <cms/Topic.h>
+#include <cms/Queue.h>
+#include <cms/TemporaryTopic.h>
+#include <cms/TemporaryQueue.h>
+#include <cms/Session.h>
+#include <cms/BytesMessage.h>
+#include <cms/TextMessage.h>
+#include <cms/MapMessage.h>
+
+using namespace activemq::connector::stomp;
+using namespace activemq::transport;
+using namespace activemq::util;
+using namespace std;
+using namespace cms;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::util;
+using namespace activemq::connector;
+using namespace activemq::exceptions;
+using namespace activemq::network;
+using namespace activemq::transport;
+using namespace activemq::concurrent;
+
+using namespace integration;
+using namespace integration::transactional;
+using namespace integration::common;
+
+TransactionTester::TransactionTester() : AbstractTester( cms::Session::Transactional )
+{}
+
+TransactionTester::~TransactionTester()
+{}
+
+void TransactionTester::test()
+{
+    try
+    {
+        cout << "Starting activemqcms transactional test (sending "
+             << IntegrationCommon::defaultMsgCount
+             << " messages per type and sleeping "
+             << IntegrationCommon::defaultDelay 
+             << " milli-seconds) ...\n"
+             << endl;
+        
+        // Create CMS Object for Comms
+        cms::Topic* topic = session->createTopic("mytopic");
+        cms::MessageConsumer* consumer = 
+            session->createConsumer( *topic );            
+        consumer->setMessageListener( this );
+        cms::MessageProducer* producer = 
+            session->createProducer( *topic );
+
+        // Send some text messages
+        this->produceTextMessages( 
+            *producer, IntegrationCommon::defaultMsgCount );
+            
+        session->commit();
+        
+        // Send some bytes messages.
+        this->produceTextMessages( 
+            *producer, IntegrationCommon::defaultMsgCount );
+        
+        session->commit();
+
+        // Wait till we get all the messages
+        waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        
+        printf("received: %d\n", numReceived );
+        CPPUNIT_ASSERT( 
+            numReceived == IntegrationCommon::defaultMsgCount * 2 );
+
+        numReceived = 0;
+
+        // Send some text messages
+        this->produceTextMessages( 
+            *producer, IntegrationCommon::defaultMsgCount );
+            
+        session->rollback();
+
+        // Wait till we get all the messages
+        waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+
+        printf("received: %d\n", numReceived );
+        CPPUNIT_ASSERT( 
+            numReceived == IntegrationCommon::defaultMsgCount );
+
+        printf("Shutting Down\n" );
+        delete producer;                      
+        delete consumer;
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+

Propchange: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test-integration/main.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/main.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/main.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/main.cpp Wed Jul  5 15:27:34 2006
@@ -1,19 +1,19 @@
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-#include <cppunit/BriefTestProgressListener.h>
-#include <cppunit/TestResult.h>
-
-int main( int argc, char **argv)
-{
-    CppUnit::TextUi::TestRunner runner;
-    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
-    runner.addTest( registry.makeTest() );
-
-    // Shows a message as each test starts
-    CppUnit::BriefTestProgressListener listener;
-    runner.eventManager().addListener( &listener );
-    
-    bool wasSuccessful = runner.run( "", false );
-    return !wasSuccessful;
-}
-
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/BriefTestProgressListener.h>
+#include <cppunit/TestResult.h>
+
+int main( int argc, char **argv)
+{
+    CppUnit::TextUi::TestRunner runner;
+    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
+    runner.addTest( registry.makeTest() );
+
+    // Shows a message as each test starts
+    CppUnit::BriefTestProgressListener listener;
+    runner.eventManager().addListener( &listener );
+    
+    bool wasSuccessful = runner.run( "", false );
+    return !wasSuccessful;
+}
+

Propchange: incubator/activemq/trunk/activemq-cpp/src/test-integration/main.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message