You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2006/07/21 13:36:16 UTC
svn commit: r424272 [9/10] - in /incubator/activemq/trunk/activemq-cpp: ./
src/examples/ src/main/activemq/concurrent/ src/main/activemq/connector/
src/main/activemq/connector/stomp/
src/main/activemq/connector/stomp/commands/ src/main/activemq/connect...
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/ConnectionFactory.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/ConnectionFactory.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/ConnectionFactory.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/ConnectionFactory.h Fri Jul 21 04:36:09 2006
@@ -25,36 +25,38 @@
namespace cms
{
- class ConnectionFactory
- {
- public:
+ /**
+ * Defines the interface for a factory that creates connection objects
+ */
+ class ConnectionFactory
+ {
+ public:
- /**
- * Destructor
- */
- virtual ~ConnectionFactory(void) {}
+ virtual ~ConnectionFactory(void) {}
- /**
- * Creates a connection with the default user identity. The
- * connection is created in stopped mode. No messages will be
- * delivered until the Connection.start method is explicitly
- * called.
- * @throws CMSException
- */
- virtual Connection* createConnection(void) throw ( CMSException ) = 0;
+ /**
+ * Creates a connection with the default user identity. The
+ * connection is created in stopped mode. No messages will be
+ * delivered until the Connection.start method is explicitly
+ * called.
+ * @return Pointer to a connection object, caller owns the pointer
+ * @throws CMSException
+ */
+ virtual Connection* createConnection(void) throw ( CMSException ) = 0;
- /**
- * Creates a connection with the specified user identity. The
- * connection is created in stopped mode. No messages will be
- * delivered until the Connection.start method is explicitly called.
- * @throw CMSException.
- */
- virtual Connection* createConnection(const std::string& username,
- const std::string& password,
- const std::string& clientId)
- throw ( CMSException ) = 0;
+ /**
+ * Creates a connection with the specified user identity. The
+ * connection is created in stopped mode. No messages will be
+ * delivered until the Connection.start method is explicitly called.
+ * @return Pointer to a connection object, caller owns the pointer
+ * @throw CMSException.
+ */
+ virtual Connection* createConnection( const std::string& username,
+ const std::string& password,
+ const std::string& clientId)
+ throw ( CMSException ) = 0;
- };
+ };
}
Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/DeliveryMode.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/DeliveryMode.h?rev=424272&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/DeliveryMode.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/DeliveryMode.h Fri Jul 21 04:36:09 2006
@@ -0,0 +1,44 @@
+/*
+ * 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_DELIVERYMODE_H_
+#define _CMS_DELIVERYMODE_H_
+
+namespace cms
+{
+
+ /**
+ * This is an Abstract class whose purpose is to provide a container
+ * for the delivery mode enumeration for CMS messages.
+ */
+ class DeliveryMode
+ {
+ public:
+
+ virtual ~DeliveryMode() {}
+
+ /**
+ * Enumeration values for Message Delivery Mode
+ */
+ static const int PERSISTANT = 0;
+ static const int NON_PERSISTANT = 1;
+
+ };
+
+}
+
+#endif /*DELIVERYMODE_H_*/
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/Destination.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Destination.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Destination.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Destination.h Fri Jul 21 04:36:09 2006
@@ -18,6 +18,8 @@
#ifndef _CMS_DESTINATION_H_
#define _CMS_DESTINATION_H_
+#include <activemq/util/Properties.h>
+
#include <string>
namespace cms{
@@ -76,6 +78,14 @@
*/
virtual void copy( const cms::Destination& source ) = 0;
+ /**
+ * Retrieve any properties that might be part of the destination
+ * that was specified. This is a deviation from the JMS spec
+ * but necessary due to C++ restrictions.
+ * @return const reference to a properties object.
+ */
+ virtual const activemq::util::Properties& getProperties(void) const = 0;
+
};
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/ExceptionListener.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/ExceptionListener.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/ExceptionListener.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/ExceptionListener.h Fri Jul 21 04:36:09 2006
@@ -22,22 +22,19 @@
namespace cms{
- class ExceptionListener
- {
- public:
+ class ExceptionListener
+ {
+ public:
- /**
- * Destructor
- */
- virtual ~ExceptionListener(void) {}
+ virtual ~ExceptionListener(void) {}
- /**
- * Called when an exception occurs.
- * @param Exception Object that occurred.
- */
- virtual void onException(const cms::CMSException& ex) = 0;
+ /**
+ * Called when an exception occurs.
+ * @param Exception Object that occurred.
+ */
+ virtual void onException(const cms::CMSException& ex) = 0;
- };
+ };
}
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=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h Fri Jul 21 04:36:09 2006
@@ -22,16 +22,197 @@
namespace cms
{
- class MapMessage : public Message
- {
- public:
-
- /**
- * Destructor
- */
- virtual ~MapMessage(void) {}
+ /**
+ * A MapMessage object is used to send a set of name-value pairs. The
+ * names are String objects, and the values are primitive data types in
+ * the Java programming language. The names must have a value that is
+ * not null, and not an empty string. The entries can be accessed
+ * sequentially or randomly by name. The order of the entries is
+ * undefined. MapMessage inherits from the Message interface and adds
+ * a message body that contains a Map.
+ *
+ * When a client receives a MapMessage, it is in read-only mode. If a
+ * client attempts to write to the message at this point, a
+ * CMSException is thrown.
+ */
+ class MapMessage : public Message
+ {
+ public:
- };
+ virtual ~MapMessage(void) {}
+
+ /**
+ * Returns an Enumeration of all the names in the MapMessage
+ * object.
+ * @return STL Vector of String values, each of which is the
+ * name of an item in the MapMessage
+ * @throws CMSException
+ */
+ virtual std::vector< std::string > getMapNames(void) const = 0;
+
+ /**
+ * Indicates whether an item exists in this MapMessage object.
+ * @param name - String name of the Object in question
+ * @return boolean value indicating if the name is in the map
+ */
+ virtual bool itemExists( const std::string& name ) const = 0;
+
+ /**
+ * Returns the Boolean value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual bool getBoolean( const std::string& name ) = 0;
+
+ /**
+ * Sets a boolean value with the specified name into the Map.
+ * @param name - the name of the boolean
+ * @param value - the boolean value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setBoolean( const std::string& name,
+ bool value ) = 0;
+
+ /**
+ * Returns the Byte value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual unsigned char getByte( const std::string& name ) = 0;
+
+ /**
+ * Sets a Byte value with the specified name into the Map.
+ * @param name - the name of the Byte
+ * @param value - the Byte value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setByte( const std::string& name,
+ unsigned char value ) = 0;
+
+ /**
+ * Returns the Bytes value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual unsigned char* getBytes( const std::string& name ) = 0;
+
+ /**
+ * Sets a Bytes value with the specified name into the Map.
+ * @param name - the name of the Bytes
+ * @param value - the Bytes value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setBytes( const std::string& name,
+ unsigned char* value ) = 0;
+
+ /**
+ * Returns the Char value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual char getChar( const std::string& name ) = 0;
+
+ /**
+ * Sets a Char value with the specified name into the Map.
+ * @param name - the name of the Char
+ * @param value - the Char value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setChar( const std::string& name, char value ) = 0;
+
+ /**
+ * Returns the Double value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual double getDouble( const std::string& name ) = 0;
+
+ /**
+ * Sets a Double value with the specified name into the Map.
+ * @param name - the name of the Double
+ * @param value - the Double value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setDouble( const std::string& name,
+ double value ) = 0;
+
+ /**
+ * Returns the Float value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual float getFloat( const std::string& name ) = 0;
+
+ /**
+ * Sets a Float value with the specified name into the Map.
+ * @param name - the name of the Float
+ * @param value - the Float value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setFloat( const std::string& name, float value ) = 0;
+
+ /**
+ * Returns the Int value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual int getInt( const std::string& name ) = 0;
+
+ /**
+ * Sets a Int value with the specified name into the Map.
+ * @param name - the name of the Int
+ * @param value - the Int value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setInt( const std::string& name, int value ) = 0;
+
+ /**
+ * Returns the Long value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual long getLong( const std::string& name ) = 0;
+
+ /**
+ * Sets a Long value with the specified name into the Map.
+ * @param name - the name of the Long
+ * @param value - the Long value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setLong( const std::string& name, long value ) = 0;
+
+ /**
+ * Returns the Short value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual short getShort( const std::string& name ) = 0;
+
+ /**
+ * Sets a Short value with the specified name into the Map.
+ * @param name - the name of the Short
+ * @param value - the Short value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setShort( const std::string& name, short value ) = 0;
+
+ /**
+ * Returns the String value of the Specified name
+ * @param name of the value to fetch from the map
+ * @throws CMSException
+ */
+ virtual std::string getString( const std::string& name ) = 0;
+
+ /**
+ * Sets a String value with the specified name into the Map.
+ * @param name - the name of the String
+ * @param value - the String value to set in the Map
+ * @throws CMSException
+ */
+ virtual void setString( const std::string& name,
+ const std::string& value ) = 0;
+
+ };
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/Message.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Message.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Message.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Message.h Fri Jul 21 04:36:09 2006
@@ -22,24 +22,15 @@
#include <cms/Destination.h>
#include <cms/CMSException.h>
+#include <cms/DeliveryMode.h>
namespace cms{
/**
* Root of all messages.
*/
- class Message{
- public:
-
- /**
- * Enumeration value for Message Delivery Mode
- */
- enum DeliveryMode
- {
- PERSISTANT,
- NONPERSISTANT
- };
-
+ class Message
+ {
public:
virtual ~Message(void){}
@@ -75,31 +66,31 @@
* Sets the Correlation Id used by this message
* @param String representing the correlation id.
*/
- virtual void setCMSCorrelationId(const std::string& correlationId) = 0;
+ virtual void setCMSCorrelationId( const std::string& correlationId ) = 0;
/**
* Sets the DeliveryMode for this message
* @return DeliveryMode enumerated value.
*/
- virtual DeliveryMode getCMSDeliveryMode(void) const = 0;
+ virtual int getCMSDeliveryMode(void) const = 0;
/**
* Sets the DeliveryMode for this message
* @param DeliveryMode enumerated value.
*/
- virtual void setCMSDeliveryMode(DeliveryMode mode) = 0;
+ virtual void setCMSDeliveryMode( int mode ) = 0;
/**
* Gets the Destination for this Message, returns a
* @return Destination object
*/
- virtual const Destination& getCMSDestination(void) const = 0;
+ virtual const Destination* getCMSDestination(void) const = 0;
/**
* Sets the Destination for this message
* @param Destination Object
*/
- virtual void setCMSDestination(const Destination& destination) = 0;
+ virtual void setCMSDestination( const Destination* destination ) = 0;
/**
* Gets the Expiration Time for this Message
@@ -111,7 +102,7 @@
* Sets the Expiration Time for this message
* @param time value
*/
- virtual void setCMSExpiration(long expireTime) = 0;
+ virtual void setCMSExpiration( long expireTime ) = 0;
/**
* Gets the CMS Message Id for this Message
@@ -123,7 +114,7 @@
* Sets the CMS Message Id for this message
* @param time value
*/
- virtual void setCMSMessageId(const std::string& id) = 0;
+ virtual void setCMSMessageId( const std::string& id ) = 0;
/**
* Gets the Priority Value for this Message
@@ -135,7 +126,7 @@
* Sets the Priority Value for this message
* @param priority value
*/
- virtual void setCMSPriority(int priority) = 0;
+ virtual void setCMSPriority( int priority ) = 0;
/**
* Gets the Redelivered Flag for this Message
@@ -147,7 +138,7 @@
* Sets the Redelivered Flag for this message
* @param redelivered value
*/
- virtual void setCMSRedelivered(bool redelivered) = 0;
+ virtual void setCMSRedelivered( bool redelivered ) = 0;
/**
* Gets the CMS Reply To Address for this Message
@@ -159,7 +150,7 @@
* Sets the CMS Reply To Address for this message
* @param Reply To value
*/
- virtual void setCMSReplyTo(const std::string& id) = 0;
+ virtual void setCMSReplyTo( const std::string& id ) = 0;
/**
* Gets the Time Stamp for this Message
@@ -171,7 +162,7 @@
* Sets the Time Stamp for this message
* @param time stamp value
*/
- virtual void setCMSTimeStamp(long timeStamp) = 0;
+ virtual void setCMSTimeStamp( long timeStamp ) = 0;
/**
* Gets the CMS Message Type for this Message
@@ -183,7 +174,7 @@
* Sets the CMS Message Type for this message
* @param type value
*/
- virtual void setCMSMessageType(const std::string& type) = 0;
+ virtual void setCMSMessageType( const std::string& type ) = 0;
};
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageConsumer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageConsumer.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageConsumer.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageConsumer.h Fri Jul 21 04:36:09 2006
@@ -24,59 +24,56 @@
namespace cms
{
- class MessageConsumer
- {
- public:
+ class MessageConsumer
+ {
+ public:
- /**
- * Destructor
- */
- virtual ~MessageConsumer(void) {}
+ virtual ~MessageConsumer(void) {}
- /**
- * Synchronously Receive a Message
- * @return new message
- * @throws CMSException
- */
- virtual Message* receive(void) throw ( CMSException ) = 0;
+ /**
+ * Synchronously Receive a Message
+ * @return new message
+ * @throws CMSException
+ */
+ virtual Message* receive(void) throw ( CMSException ) = 0;
- /**
- * Synchronously Receive a Message, time out after defined interval.
- * Returns null if nothing read.
- * @return new message
- * @throws CMSException
- */
- virtual Message* receive(int millisecs) throw ( CMSException ) = 0;
+ /**
+ * Synchronously Receive a Message, time out after defined interval.
+ * Returns null if nothing read.
+ * @return new message
+ * @throws CMSException
+ */
+ virtual Message* receive( int millisecs ) throw ( CMSException ) = 0;
- /**
- * Receive a Message, does not wait if there isn't a new message
- * to read, returns NULL if nothing read.
- * @return new message
- * @throws CMSException
- */
- virtual Message* receiveNoWait(void) throw ( CMSException ) = 0;
+ /**
+ * Receive a Message, does not wait if there isn't a new message
+ * to read, returns NULL if nothing read.
+ * @return new message
+ * @throws CMSException
+ */
+ virtual Message* receiveNoWait(void) throw ( CMSException ) = 0;
- /**
- * Sets the MessageListener that this class will send notifs on
- * @param MessageListener interface pointer
- */
- virtual void setMessageListener(MessageListener* listener) = 0;
+ /**
+ * Sets the MessageListener that this class will send notifs on
+ * @param MessageListener interface pointer
+ */
+ virtual void setMessageListener( MessageListener* listener ) = 0;
- /**
- * Gets the MessageListener that this class will send notifs on
- * @param MessageListener interface pointer
- */
- virtual MessageListener* getMessageListener(void) const = 0;
+ /**
+ * Gets the MessageListener that this class will send notifs on
+ * @param MessageListener interface pointer
+ */
+ virtual MessageListener* getMessageListener(void) const = 0;
- /**
- * Gets this message consumer's message selector expression.
- * @return This Consumer's selector expression or "".
- * @throws cms::CMSException
- */
- virtual std::string getMessageSelector(void) const
- throw ( cms::CMSException ) = 0;
+ /**
+ * Gets this message consumer's message selector expression.
+ * @return This Consumer's selector expression or "".
+ * @throws cms::CMSException
+ */
+ virtual std::string getMessageSelector(void) const
+ throw ( cms::CMSException ) = 0;
- };
+ };
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageListener.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageListener.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageListener.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageListener.h Fri Jul 21 04:36:09 2006
@@ -41,9 +41,9 @@
* It is considered a programming error for this method to throw and
* exception.
*
- * @param Message object reference
+ * @param Message object const pointer recipient does not own.
*/
- virtual void onMessage( const Message& message ) = 0;
+ virtual void onMessage( const Message* message ) = 0;
};
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageProducer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageProducer.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageProducer.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageProducer.h Fri Jul 21 04:36:09 2006
@@ -21,99 +21,102 @@
#include <cms/Message.h>
#include <cms/Destination.h>
#include <cms/CMSException.h>
+#include <cms/DeliveryMode.h>
namespace cms
{
- /**
- * defines the <code>MEssageProducer</code> interface that is used
- * by all MessageProducer derivations. This class defines the JMS
- * spec'd interface for a MessageProducer.
- */
- class MessageProducer
- {
- public:
+ /**
+ * defines the <code>MessageProducer</code> interface that is used
+ * by all MessageProducer derivations. This class defines the JMS
+ * spec'd interface for a MessageProducer.
+ */
+ class MessageProducer
+ {
+ public:
- /**
- * Destructor
- */
- virtual ~MessageProducer(void) {}
-
- /**
- * Sends the message to the default producer destination.
- * @param a Message Object Pointer
- * @throws CMSException
- */
- virtual void send(Message& message) throw ( CMSException ) = 0;
-
- /**
- * Sends the message to the designated destination.
- * @param a Message Object Pointer
- * @throws CMSException
- */
- virtual void send(const Destination& destination,
- Message& message) throw ( CMSException ) = 0;
+ /**
+ * Destructor
+ */
+ virtual ~MessageProducer(void) {}
+
+ /**
+ * Sends the message to the default producer destination, but does
+ * not take ownership of the message, caller must still destroy it.
+ * @param a Message Object Pointer
+ * @throws CMSException
+ */
+ virtual void send( Message* message ) throw ( CMSException ) = 0;
+
+ /**
+ * Sends the message to the designated destination, but does
+ * not take ownership of the message, caller must still destroy it.
+ * @param a Message Object Pointer
+ * @throws CMSException
+ */
+ virtual void send( const Destination* destination,
+ Message* message ) throw ( CMSException ) = 0;
- /**
- * Sets the delivery mode for this Producer
- * @param The DeliveryMode
- */
- virtual void setDeliveryMode(Message::DeliveryMode mode) = 0;
-
- /**
- * Gets the delivery mode for this Producer
- * @return The DeliveryMode
- */
- virtual Message::DeliveryMode getDeliveryMode(void) const = 0;
-
- /**
- * Sets if Message Ids are disbled for this Producer
- * @param boolean indicating enable / disable (true / false)
- */
- virtual void setDisableMessageId(bool value) = 0;
-
- /**
- * Sets if Message Ids are disbled for this Producer
- * @param boolean indicating enable / disable (true / false)
- */
- virtual bool getDisableMessageId(void) const = 0;
+ /**
+ * Sets the delivery mode for this Producer
+ * @param The DeliveryMode
+ */
+ virtual void setDeliveryMode( int mode ) = 0;
+
+ /**
+ * Gets the delivery mode for this Producer
+ * @return The DeliveryMode
+ */
+ virtual int getDeliveryMode(void) const = 0;
+
+ /**
+ * Sets if Message Ids are disbled for this Producer
+ * @param boolean indicating enable / disable (true / false)
+ */
+ virtual void setDisableMessageId( bool value ) = 0;
+
+ /**
+ * Sets if Message Ids are disbled for this Producer
+ * @param boolean indicating enable / disable (true / false)
+ */
+ virtual bool getDisableMessageId(void) const = 0;
- /**
- * Sets if Message Time Stamps are disbled for this Producer
- * @param boolean indicating enable / disable (true / false)
- */
- virtual void setDisableMessageTimeStamp(bool value) = 0;
-
- /**
- * Sets if Message Time Stamps are disbled for this Producer
- * @param boolean indicating enable / disable (true / false)
- */
- virtual bool getDisableMessageTimeStamp(void) const = 0;
-
- /**
- * Sets the Priority that this Producers sends messages at
- * @param int value for Priority level
- */
- virtual void setPriority(int priority) = 0;
-
- /**
- * Gets the Priority level that this producer sends messages at
- * @return int based priority level
- */
- virtual int getPriority(void) const = 0;
-
- /**
- * Sets the Time to Live that this Producers sends messages with
- * @param int value for time to live
- */
- virtual void setTimeToLive(int time) = 0;
-
- /**
- * Gets the Time to Live that this producer sends messages with
- * @return int based Time to Live
- */
- virtual int getTimeToLive(void) const = 0;
+ /**
+ * Sets if Message Time Stamps are disbled for this Producer
+ * @param boolean indicating enable / disable (true / false)
+ */
+ virtual void setDisableMessageTimeStamp( bool value ) = 0;
+
+ /**
+ * Sets if Message Time Stamps are disbled for this Producer
+ * @param boolean indicating enable / disable (true / false)
+ */
+ virtual bool getDisableMessageTimeStamp(void) const = 0;
+
+ /**
+ * Sets the Priority that this Producers sends messages at
+ * @param int value for Priority level
+ */
+ virtual void setPriority( int priority ) = 0;
+
+ /**
+ * Gets the Priority level that this producer sends messages at
+ * @return int based priority level
+ */
+ virtual int getPriority(void) const = 0;
+
+ /**
+ * Sets the Time to Live that this Producers sends messages with
+ * @param int value for time to live
+ */
+ virtual void setTimeToLive( int time ) = 0;
+
+ /**
+ * Gets the Time to Live that this producer sends messages with
+ * @return int based Time to Live
+ */
+ virtual int getTimeToLive(void) const = 0;
- };
+ };
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/Queue.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Queue.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Queue.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Queue.h Fri Jul 21 04:36:09 2006
@@ -22,24 +22,24 @@
#include <cms/CMSException.h>
namespace cms{
-
- /**
- * An interface encapsulating a provider-specific queue name.
- */
- class Queue : public Destination{
-
- public:
-
- virtual ~Queue(void){}
-
- /**
- * Gets the name of this queue.
- * @return The queue name.
- */
- virtual std::string getQueueName() const
+
+ /**
+ * An interface encapsulating a provider-specific queue name.
+ */
+ class Queue : public Destination{
+
+ public:
+
+ virtual ~Queue(void){}
+
+ /**
+ * Gets the name of this queue.
+ * @return The queue name.
+ */
+ virtual std::string getQueueName() const
throw( CMSException ) = 0;
- };
+ };
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/Session.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Session.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Session.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Session.h Fri Jul 21 04:36:09 2006
@@ -40,189 +40,197 @@
enum AcknowledgeMode
{
/**
- * With this acknowledgment mode, the session automatically
- * acknowledges a client's receipt of a message either when
- * the session has successfully returned from a call to receive
- * or when the message listener the session has called to
- * process the message successfully returns.
- */
- AutoAcknowledge,
+ * With this acknowledgment mode, the session automatically
+ * acknowledges a client's receipt of a message either when
+ * the session has successfully returned from a call to receive
+ * or when the message listener the session has called to
+ * process the message successfully returns.
+ */
+ AUTO_ACKNOWLEDGE,
/**
- * With this acknowledgment mode, the session automatically
- * acknowledges a client's receipt of a message either when
- * the session has successfully returned from a call to receive
- * or when the message listener the session has called to
- * process the message successfully returns. Acknowlegements
- * may be delayed in this mode to increase performance at
- * the cost of the message being redelivered this client fails.
- */
- DupsOkAcknowledge,
+ * With this acknowledgment mode, the session automatically
+ * acknowledges a client's receipt of a message either when
+ * the session has successfully returned from a call to receive
+ * or when the message listener the session has called to
+ * process the message successfully returns. Acknowlegements
+ * may be delayed in this mode to increase performance at
+ * the cost of the message being redelivered this client fails.
+ */
+ DUPS_OK_ACKNOWLEDGE,
/**
- * With this acknowledgment mode, the client acknowledges a
- * consumed message by calling the message's acknowledge method.
- */
- ClientAcknowledge,
+ * With this acknowledgment mode, the client acknowledges a
+ * consumed message by calling the message's acknowledge method.
+ */
+ CLIENT_ACKNOWLEDGE,
/**
- * Messages will be consumed when the transaction commits.
- */
- Transactional
+ * Messages will be consumed when the transaction commits.
+ */
+ SESSION_TRANSACTED
+
};
public:
- /**
- * Destructor
- */
virtual ~Session(void) {}
/**
- * Commits all messages done in this transaction and releases any
- * locks currently held.
- * @throws CMSException
- */
+ * Commits all messages done in this transaction and releases any
+ * locks currently held.
+ * @throws CMSException
+ */
virtual void commit(void) throw ( CMSException ) = 0;
/**
- * Rollsback all messages done in this transaction and releases any
- * locks currently held.
- * @throws CMSException
- */
+ * Rollsback all messages done in this transaction and releases any
+ * locks currently held.
+ * @throws CMSException
+ */
virtual void rollback(void) throw ( CMSException ) = 0;
/**
- * Creates a MessageConsumer for the specified destination.
- * @param the Destination that this consumer receiving messages for.
- * @throws CMSException
- */
+ * Creates a MessageConsumer for the specified destination.
+ * @param the Destination that this consumer receiving messages for.
+ * @return pointer to a new MessageConsumer that is owned by the
+ * caller ( caller deletes )
+ * @throws CMSException
+ */
virtual MessageConsumer* createConsumer(
- Destination& destination )
+ const Destination* destination )
throw ( CMSException ) = 0;
/**
- * Creates a MessageConsumer for the specified destination, using a
- * message selector.
- * @param the Destination that this consumer receiving messages for.
- * @throws CMSException
- */
+ * Creates a MessageConsumer for the specified destination, using a
+ * message selector.
+ * @param the Destination that this consumer receiving messages for.
+ * @return pointer to a new MessageConsumer that is owned by the
+ * caller ( caller deletes )
+ * @throws CMSException
+ */
virtual MessageConsumer* createConsumer(
- Destination& destination,
+ const Destination* destination,
const std::string& selector )
throw ( CMSException ) = 0;
/**
- * Creates a durable subscriber to the specified topic, using a
- * message selector
- * @param the topic to subscribe to
- * @param name used to identify the subscription
- * @param only messages matching the selector are received
- * @throws CMSException
- */
+ * Creates a durable subscriber to the specified topic, using a
+ * message selector
+ * @param the topic to subscribe to
+ * @param name used to identify the subscription
+ * @param only messages matching the selector are received
+ * @return pointer to a new durable MessageConsumer that is owned by
+ * the caller ( caller deletes )
+ * @throws CMSException
+ */
virtual MessageConsumer* createDurableConsumer(
- Topic& destination,
+ const Topic* destination,
const std::string& name,
const std::string& selector,
bool noLocal = false )
throw ( CMSException ) = 0;
/**
- * Creates a MessageProducer to send messages to the specified
- * destination.
- * @param the Destination to publish on
- * @throws CMSException
- */
- virtual MessageProducer* createProducer( Destination& destination )
+ * Creates a MessageProducer to send messages to the specified
+ * destination.
+ * @param the Destination to publish on
+ * @return New MessageProducer that is owned by the caller.
+ * @throws CMSException
+ */
+ virtual MessageProducer* createProducer( const Destination* destination )
throw ( CMSException ) = 0;
/**
- * Creates a queue identity given a Queue name.
- * @param the name of the new Queue
- * @throws CMSException
- */
+ * Creates a queue identity given a Queue name.
+ * @param the name of the new Queue
+ * @return new Queue pointer that is owned by the caller.
+ * @throws CMSException
+ */
virtual Queue* createQueue( const std::string& queueName )
throw ( CMSException ) = 0;
/**
- * Creates a topic identity given a Queue name.
- * @param the name of the new Topic
- * @throws CMSException
- */
+ * Creates a topic identity given a Queue name.
+ * @param the name of the new Topic
+ * @return new Topic pointer that is owned by the caller.
+ * @throws CMSException
+ */
virtual Topic* createTopic( const std::string& topicName )
throw ( CMSException ) = 0;
/**
- * Creates a TemporaryQueue object.
- * @throws CMSException
- */
+ * Creates a TemporaryQueue object.
+ * @return new TemporaryQueue pointer that is owned by the caller.
+ * @throws CMSException
+ */
virtual TemporaryQueue* createTemporaryQueue(void)
throw ( CMSException ) = 0;
/**
- * Creates a TemporaryTopic object.
- * @throws CMSException
- */
+ * Creates a TemporaryTopic object.
+ * @throws CMSException
+ */
virtual TemporaryTopic* createTemporaryTopic(void)
throw ( CMSException ) = 0;
/**
- * Creates a new Message
- * @throws CMSException
- */
+ * Creates a new Message
+ * @throws CMSException
+ */
virtual Message* createMessage(void)
throw ( CMSException ) = 0;
/**
- * Creates a BytesMessage
- * @throws CMSException
- */
+ * Creates a BytesMessage
+ * @throws CMSException
+ */
virtual BytesMessage* createBytesMessage(void)
throw ( CMSException) = 0;
/**
- * Creates a BytesMessage and sets the paylod to the passed value
- * @param an array of bytes to set in the message
- * @param the size of the bytes array, or number of bytes to use
- * @throws CMSException
- */
+ * Creates a BytesMessage and sets the paylod to the passed value
+ * @param an array of bytes to set in the message
+ * @param the size of the bytes array, or number of bytes to use
+ * @throws CMSException
+ */
virtual BytesMessage* createBytesMessage(
const unsigned char* bytes,
unsigned long bytesSize )
throw ( CMSException) = 0;
/**
- * Creates a new TextMessage
- * @throws CMSException
- */
+ * Creates a new TextMessage
+ * @throws CMSException
+ */
virtual TextMessage* createTextMessage(void)
throw ( CMSException ) = 0;
/**
- * Creates a new TextMessage and set the text to the value given
- * @param the initial text for the message
- * @throws CMSException
- */
+ * Creates a new TextMessage and set the text to the value given
+ * @param the initial text for the message
+ * @throws CMSException
+ */
virtual TextMessage* createTextMessage( const std::string& text )
throw ( CMSException ) = 0;
/**
- * Creates a new MapMessage
- * @throws CMSException
- */
+ * Creates a new MapMessage
+ * @throws CMSException
+ */
virtual MapMessage* createMapMessage(void)
throw ( CMSException ) = 0;
/**
- * Returns the acknowledgement mode of the session.
- * @return the Sessions Acknowledge Mode
- */
+ * Returns the acknowledgement mode of the session.
+ * @return the Sessions Acknowledge Mode
+ */
virtual AcknowledgeMode getAcknowledgeMode(void) const = 0;
/**
- * Gets if the Sessions is a Transacted Session
- * @return transacted true - false.
- */
+ * Gets if the Sessions is a Transacted Session
+ * @return transacted true - false.
+ */
virtual bool isTransacted(void) const = 0;
};
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/Startable.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Startable.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Startable.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Startable.h Fri Jul 21 04:36:09 2006
@@ -21,21 +21,22 @@
#include <cms/CMSException.h>
namespace cms{
-
- /**
- * Interface for a class that implements the start method.
- */
- class Startable{
-
- public:
-
- virtual ~Startable(){}
-
- /**
- * Starts the service.
- */
- virtual void start() throw( CMSException ) = 0;
- };
+
+ /**
+ * Interface for a class that implements the start method.
+ */
+ class Startable{
+
+ public:
+
+ virtual ~Startable(){}
+
+ /**
+ * Starts the service.
+ */
+ virtual void start() throw( CMSException ) = 0;
+
+ };
}
#endif /*CMS_STARTABLE_H*/
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/Stoppable.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Stoppable.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Stoppable.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Stoppable.h Fri Jul 21 04:36:09 2006
@@ -35,6 +35,7 @@
* Stops this service.
*/
virtual void stop() throw( CMSException ) = 0;
+
};
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/TextMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/TextMessage.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/TextMessage.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/TextMessage.h Fri Jul 21 04:36:09 2006
@@ -22,28 +22,36 @@
#include <cms/CMSException.h>
namespace cms{
-
- /**
- * Interface for a text message.
- */
- class TextMessage : public Message{
-
- public:
-
- virtual ~TextMessage(){}
-
- /**
- * Gets the message character buffer.
- * @return The message character buffer.
- */
- virtual const char* getText() const throw( CMSException ) = 0;
-
- /**
- * Sets the message contents.
- * @param msg The message buffer.
- */
- virtual void setText( const char* msg ) throw( CMSException ) = 0;
- };
+
+ /**
+ * Interface for a text message.
+ */
+ class TextMessage : public Message{
+
+ public:
+
+ virtual ~TextMessage(){}
+
+ /**
+ * Gets the message character buffer.
+ * @return The message character buffer.
+ */
+ virtual const char* getText() const throw( CMSException ) = 0;
+
+ /**
+ * Sets the message contents, does not take ownership of the passed
+ * char*, but copies it instead.
+ * @param msg The message buffer.
+ */
+ virtual void setText( const char* msg ) throw( CMSException ) = 0;
+
+ /**
+ * Sets the message contents
+ * @param msg The message buffer.
+ */
+ virtual void setText( const std::string& msg ) throw( CMSException ) = 0;
+
+ };
}
#endif /*_CMS_TEXTMESSAGE_H_*/
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=424272&r1=424271&r2=424272&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 Fri Jul 21 04:36:09 2006
@@ -89,7 +89,7 @@
stream << text << ix << ends;
textMsg->setText( stream.str().c_str() );
stream.str("");
- producer.send( *textMsg );
+ producer.send( textMsg );
doSleep();
++realCount;
}
@@ -125,7 +125,7 @@
unsigned int realCount = 0;
for( unsigned int ix=0; ix<count; ++ix ){
- producer.send( *bytesMsg );
+ producer.send( bytesMsg );
doSleep();
++realCount;
}
@@ -167,15 +167,15 @@
CPPUNIT_ASSERT( AbstractTester );
}
-void AbstractTester::onMessage( const cms::Message& message )
+void AbstractTester::onMessage( const cms::Message* message )
{
- try
+ // Got a text message.
+ const cms::TextMessage* txtMsg =
+ dynamic_cast<const cms::TextMessage*>(message);
+
+ if( txtMsg != NULL )
{
- // Got a text message.
- const cms::TextMessage& txtMsg =
- dynamic_cast<const cms::TextMessage&>(message);
-
- std::string text = txtMsg.getText();
+ std::string text = txtMsg->getText();
// printf("received text msg: %s\n", txtMsg.getText() );
@@ -189,18 +189,16 @@
return;
}
- catch( std::bad_cast& ex )
- {}
- try
- {
- // Got a bytes msg.
- const cms::BytesMessage& bytesMsg =
- dynamic_cast<const cms::BytesMessage&>(message);
+ // Got a bytes msg.
+ const cms::BytesMessage* bytesMsg =
+ dynamic_cast<const cms::BytesMessage*>(message);
- const unsigned char* bytes = bytesMsg.getBodyBytes();
+ if( bytesMsg != NULL )
+ {
+ const unsigned char* bytes = bytesMsg->getBodyBytes();
- string transcode( (const char*)bytes, bytesMsg.getBodyLength() );
+ string transcode( (const char*)bytes, bytesMsg->getBodyLength() );
//printf("received bytes msg: " );
//int numBytes = bytesMsg.getBodyLength();
@@ -218,10 +216,5 @@
}
return;
- }
- catch( std::bad_cast& ex )
- {
- bool AbstractTester = false;
- CPPUNIT_ASSERT( AbstractTester );
}
}
Modified: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.h Fri Jul 21 04:36:09 2006
@@ -18,7 +18,7 @@
public:
AbstractTester( cms::Session::AcknowledgeMode ackMode =
- cms::Session::AutoAcknowledge );
+ cms::Session::AUTO_ACKNOWLEDGE );
virtual ~AbstractTester();
virtual void doSleep(void);
@@ -33,7 +33,7 @@
virtual void waitForMessages( unsigned int count );
virtual void onException( const cms::CMSException& error );
- virtual void onMessage( const cms::Message& message );
+ virtual void onMessage( const cms::Message* message );
public:
Modified: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/Tester.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/Tester.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/Tester.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/common/Tester.h Fri Jul 21 04:36:09 2006
@@ -4,7 +4,6 @@
#include <cms/MessageListener.h>
#include <cms/ExceptionListener.h>
-
namespace integration{
namespace common{
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=424272&r1=424271&r2=424272&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 Fri Jul 21 04:36:09 2006
@@ -78,10 +78,10 @@
// Create CMS Object for Comms
cms::Topic* topic = session->createTopic("mytopic");
cms::MessageConsumer* consumer =
- session->createDurableConsumer( *topic, subName, "" );
+ session->createDurableConsumer( topic, subName, "" );
consumer->setMessageListener( this );
cms::MessageProducer* producer =
- session->createProducer( *topic );
+ session->createProducer( topic );
unsigned int sent;
@@ -100,7 +100,7 @@
// Send some text messages
sent += this->produceTextMessages( *producer, 3 );
- consumer = session->createDurableConsumer( *topic, subName, "" );
+ consumer = session->createDurableConsumer( topic, subName, "" );
// Send some text messages
sent += this->produceTextMessages( *producer, 3 );
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=424272&r1=424271&r2=424272&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 Fri Jul 21 04:36:09 2006
@@ -79,10 +79,10 @@
// Create CMS Object for Comms
cms::Topic* topic = session->createTopic("mytopic");
cms::MessageConsumer* consumer =
- session->createConsumer( *topic );
+ session->createConsumer( topic );
consumer->setMessageListener( this );
cms::MessageProducer* producer =
- session->createProducer( *topic );
+ session->createProducer( topic );
// Send some text messages
this->produceTextMessages(
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=424272&r1=424271&r2=424272&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 Fri Jul 21 04:36:09 2006
@@ -56,7 +56,7 @@
using namespace integration::transactional;
using namespace integration::common;
-TransactionTester::TransactionTester() : AbstractTester( cms::Session::Transactional )
+TransactionTester::TransactionTester() : AbstractTester( cms::Session::SESSION_TRANSACTED )
{}
TransactionTester::~TransactionTester()
@@ -76,10 +76,10 @@
// Create CMS Object for Comms
cms::Topic* topic = session->createTopic("mytopic");
cms::MessageConsumer* consumer =
- session->createConsumer( *topic );
+ session->createConsumer( topic );
consumer->setMessageListener( this );
cms::MessageProducer* producer =
- session->createProducer( *topic );
+ session->createProducer( topic );
// Send some text messages
this->produceTextMessages(
@@ -105,11 +105,11 @@
// Send some text messages
this->produceTextMessages(
*producer, IntegrationCommon::defaultMsgCount );
-
+
session->rollback();
// Wait till we get all the messages
- waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+ waitForMessages( IntegrationCommon::defaultMsgCount );
printf("received: %d\n", numReceived );
CPPUNIT_ASSERT(
Added: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp?rev=424272&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp Fri Jul 21 04:36:09 2006
@@ -0,0 +1,236 @@
+#include "SimpleRollbackTest.h"
+
+#include <integration/common/IntegrationCommon.h>
+
+CPPUNIT_TEST_SUITE_REGISTRATION( integration::various::SimpleRollbackTest );
+
+#include <sstream>
+
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/exceptions/ActiveMQException.h>
+#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>
+#include <cms/Session.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 std;
+using namespace integration;
+using namespace integration::various;
+using namespace integration::common;
+
+SimpleRollbackTest::SimpleRollbackTest()
+{
+ try
+ {
+ string url = IntegrationCommon::defaultURL;
+ numReceived = 0;
+
+ // Default amount to send and receive
+ msgCount = 1;
+
+ // 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(
+ cms::Session::SESSION_TRANSACTED );
+ }
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+SimpleRollbackTest::~SimpleRollbackTest()
+{
+ try
+ {
+ session->close();
+ connection->close();
+
+ delete session;
+ delete connection;
+ delete connectionFactory;
+ }
+ AMQ_CATCH_NOTHROW( ActiveMQException )
+ AMQ_CATCHALL_NOTHROW( )
+}
+
+void SimpleRollbackTest::test()
+{
+ try
+ {
+ // 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 );
+
+ cms::TextMessage* textMsg =
+ session->createTextMessage();
+
+ for( size_t ix = 0; ix < msgCount; ++ix )
+ {
+ ostringstream lcStream;
+ lcStream << "SimpleTest - Message #" << ix << ends;
+ textMsg->setText( lcStream.str() );
+ producer->send( textMsg );
+ }
+
+ delete textMsg;
+
+ Thread::sleep( 100 );
+
+ session->commit();
+
+ textMsg = session->createTextMessage();
+
+ for( size_t ix = 0; ix < msgCount; ++ix )
+ {
+ ostringstream lcStream;
+ lcStream << "SimpleTest - Message #" << ix << ends;
+ textMsg->setText( lcStream.str() );
+ producer->send( textMsg );
+ }
+
+ delete textMsg;
+
+ Thread::sleep( 500 );
+
+ session->rollback();
+
+ Thread::sleep( 500 );
+
+ textMsg = session->createTextMessage();
+ textMsg->setText( "SimpleTest - Message after Rollback" );
+ producer->send( textMsg );
+ delete textMsg;
+
+ Thread::sleep( 15000 );
+
+ CPPUNIT_ASSERT( true );
+
+ printf( "Shutting Down\n" );
+
+ delete producer;
+ delete consumer;
+ }
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+void SimpleRollbackTest::onException( const cms::CMSException& error )
+{
+ bool AbstractTester = false;
+ CPPUNIT_ASSERT( AbstractTester );
+}
+
+void SimpleRollbackTest::onMessage( const cms::Message* message )
+{
+ try
+ {
+ // Got a text message.
+ const cms::TextMessage* txtMsg =
+ dynamic_cast<const cms::TextMessage*>(message);
+
+ if( txtMsg != NULL )
+ {
+ std::string text = txtMsg->getText();
+
+ // printf("received text msg: %s\n", txtMsg.getText() );
+
+ numReceived++;
+
+ // Signal that we got one
+ synchronized( &mutex )
+ {
+ mutex.notifyAll();
+ }
+
+ return;
+ }
+
+ // Got a bytes msg.
+ const cms::BytesMessage* bytesMsg =
+ dynamic_cast<const cms::BytesMessage*>(message);
+
+ if( bytesMsg != NULL )
+ {
+ 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;
+ }
+ }
+ AMQ_CATCH_NOTHROW( ActiveMQException )
+ AMQ_CATCHALL_NOTHROW( )
+}
Added: incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.h?rev=424272&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.h Fri Jul 21 04:36:09 2006
@@ -0,0 +1,51 @@
+#ifndef _INTEGRATION_VARIOUS_SIMPLEROLLBACKTEST_H_
+#define _INTEGRATION_VARIOUS_SIMPLEROLLBACKTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/concurrent/Mutex.h>
+
+#include <cms/MessageListener.h>
+#include <cms/ExceptionListener.h>
+#include <cms/ConnectionFactory.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/MessageProducer.h>
+
+namespace integration{
+namespace various{
+
+ class SimpleRollbackTest : public CppUnit::TestFixture,
+ public cms::ExceptionListener,
+ public cms::MessageListener
+ {
+ CPPUNIT_TEST_SUITE( SimpleRollbackTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ SimpleRollbackTest();
+ virtual ~SimpleRollbackTest();
+
+ virtual void test(void);
+
+ virtual void onException( const cms::CMSException& error );
+ virtual void onMessage( const cms::Message* message );
+
+ private:
+
+ cms::ConnectionFactory* connectionFactory;
+ cms::Connection* connection;
+ cms::Session* session;
+
+ unsigned int numReceived;
+ unsigned int msgCount;
+ activemq::concurrent::Mutex mutex;
+
+ };
+
+}}
+
+#endif /*_INTEGRATION_VARIOUS_SIMPLEROLLBACKTEST_H_*/
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h Fri Jul 21 04:36:09 2006
@@ -184,11 +184,18 @@
bool done;
Mutex* mutex;
+ Mutex* started;
+ Mutex* completed;
public:
int value;
- MyNotifiedThread(Mutex* mutex){ this->mutex = mutex; done = false; }
+ MyNotifiedThread(Mutex* mutex, Mutex* started, Mutex* completed ){
+ this->mutex = mutex;
+ this->started = started;
+ this->completed = completed;
+ this->done = false;
+ }
virtual ~MyNotifiedThread(){}
virtual void lock() throw(exceptions::ActiveMQException){
mutex->lock();
@@ -215,9 +222,19 @@
{
done = false;
synchronized(this)
- {
+ {
+ synchronized( started )
+ {
+ started->notify();
+ }
+
this->wait();
done = true;
+
+ synchronized( completed )
+ {
+ completed->notify();
+ }
}
}
catch(exceptions::ActiveMQException& ex)
@@ -401,17 +418,28 @@
{
try{
Mutex mutex;
+ Mutex started;
+ Mutex completed;
+
const int numThreads = 30;
MyNotifiedThread* threads[numThreads];
// Create and start all the threads.
for( int ix=0; ix<numThreads; ++ix ){
- threads[ix] = new MyNotifiedThread( &mutex );
+ threads[ix] = new MyNotifiedThread( &mutex, &started, &completed );
threads[ix]->start();
}
- // Sleep so all the threads can get to the wait.
- Thread::sleep( 1000 );
+ synchronized( &started )
+ {
+ int count = 0;
+
+ while( count < ( numThreads ) )
+ {
+ started.wait( 30 );
+ count++;
+ }
+ }
synchronized(&mutex)
{
@@ -438,8 +466,16 @@
}
}
- // Sleep to give the threads time to wake up.
- Thread::sleep( 1000 );
+ synchronized( &started )
+ {
+ int count = 0;
+
+ while( count < ( numThreads ) )
+ {
+ started.wait( 30 );
+ count++;
+ }
+ }
int numComplete = 0;
for( int ix=0; ix<numThreads; ++ix ){
@@ -458,6 +494,11 @@
{
mutex.notifyAll();
}
+
+ // Delete all the threads.
+ for( int ix=0; ix<numThreads; ++ix ){
+ delete threads[ix];
+ }
}catch( exceptions::ActiveMQException& ex ){
ex.setMark( __FILE__, __LINE__ );
@@ -468,18 +509,28 @@
{
try{
Mutex mutex;
+ Mutex started;
+ Mutex completed;
const int numThreads = 100;
MyNotifiedThread* threads[numThreads];
// Create and start all the threads.
for( int ix=0; ix<numThreads; ++ix ){
- threads[ix] = new MyNotifiedThread( &mutex );
+ threads[ix] = new MyNotifiedThread( &mutex, &started, &completed );
threads[ix]->start();
}
- // Sleep so all the threads can get to the wait.
- Thread::sleep( 1000 );
+ synchronized( &started )
+ {
+ int count = 0;
+
+ while( count < ( numThreads ) )
+ {
+ started.wait( 30 );
+ count++;
+ }
+ }
for( int ix=0; ix<numThreads; ++ix )
{
@@ -494,8 +545,16 @@
mutex.notifyAll();
}
- // Sleep to give the threads time to wake up.
- Thread::sleep( 1000 );
+ synchronized( &completed )
+ {
+ int count = 0;
+
+ while( count < ( numThreads ) )
+ {
+ completed.wait( 30 );
+ count++;
+ }
+ }
int numComplete = 0;
for( int ix=0; ix<numThreads; ++ix ){
@@ -506,6 +565,12 @@
printf("numComplete: %d, numThreads: %d\n", numComplete, numThreads );
CPPUNIT_ASSERT( numComplete == numThreads );
+ // Delete all the threads.
+ for( int ix=0; ix<numThreads; ++ix ){
+ threads[ix]->join();
+ delete threads[ix];
+ }
+
}catch( exceptions::ActiveMQException& ex ){
ex.setMark( __FILE__, __LINE__ );
}
@@ -554,6 +619,12 @@
}
CPPUNIT_ASSERT( threads[ix]->done == true );
}
+
+ // Delete all the threads.
+ for( int ix=0; ix<numThreads; ++ix ){
+ delete threads[ix];
+ }
+
}catch( exceptions::ActiveMQException& ex ){
ex.setMark( __FILE__, __LINE__ );
}
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompCommandReaderTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompCommandReaderTest.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompCommandReaderTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompCommandReaderTest.h Fri Jul 21 04:36:09 2006
@@ -68,6 +68,8 @@
biStream.setByteArray(
(const unsigned char*)textStr, 83 );
+ delete command;
+
command = reader.readCommand();
CPPUNIT_ASSERT( command != NULL );
@@ -84,6 +86,8 @@
biStream.setByteArray(
(const unsigned char*)bytesStr, 98 );
+ delete command;
+
command = reader.readCommand();
CPPUNIT_ASSERT( command != NULL );
@@ -99,6 +103,7 @@
(int)bytesMessage->getBodyLength() );
CPPUNIT_ASSERT( bytesText == "123456789" );
+ delete command;
}
};
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompCommandWriterTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompCommandWriterTest.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompCommandWriterTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompCommandWriterTest.h Fri Jul 21 04:36:09 2006
@@ -57,14 +57,16 @@
connectedCommand.setSessionId( "test" );
// Sync to expected output
- textCommand.setCMSDestination( StompTopic("a") );
+ StompTopic topic1("a");
+ textCommand.setCMSDestination( &topic1 );
textCommand.setCMSMessageId( "123" );
textCommand.getProperties().setProperty(
"sampleProperty", "testvalue" );
textCommand.setText( "testMessage" );
// Sync to expected output
- bytesCommand.setCMSDestination( StompTopic("a") );
+ StompTopic topic2("a");
+ bytesCommand.setCMSDestination( &topic2 );
bytesCommand.setCMSMessageId( "123" );
bytesCommand.getProperties().setProperty(
"sampleProperty", "testvalue" );
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompConnectorTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompConnectorTest.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompConnectorTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompConnectorTest.h Fri Jul 21 04:36:09 2006
@@ -65,6 +65,8 @@
core::ActiveMQMessage* msg )
{
consumers.push_back( consumer );
+
+ delete msg;
}
};
@@ -77,20 +79,20 @@
StompConnector connector( &transport, properties );
connector.start();
- SessionInfo* info1 = connector.createSession( cms::Session::AutoAcknowledge );
- CPPUNIT_ASSERT( info1->getAckMode() == cms::Session::AutoAcknowledge );
+ SessionInfo* info1 = connector.createSession( cms::Session::AUTO_ACKNOWLEDGE );
+ CPPUNIT_ASSERT( info1->getAckMode() == cms::Session::AUTO_ACKNOWLEDGE );
CPPUNIT_ASSERT( info1->getConnectionId() == connectionId );
- SessionInfo* info2 = connector.createSession( cms::Session::DupsOkAcknowledge );
- CPPUNIT_ASSERT( info2->getAckMode() == cms::Session::DupsOkAcknowledge );
+ SessionInfo* info2 = connector.createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
+ CPPUNIT_ASSERT( info2->getAckMode() == cms::Session::DUPS_OK_ACKNOWLEDGE );
CPPUNIT_ASSERT( info2->getConnectionId() == connectionId );
- SessionInfo* info3 = connector.createSession( cms::Session::ClientAcknowledge );
- CPPUNIT_ASSERT( info3->getAckMode() == cms::Session::ClientAcknowledge );
+ SessionInfo* info3 = connector.createSession( cms::Session::CLIENT_ACKNOWLEDGE );
+ CPPUNIT_ASSERT( info3->getAckMode() == cms::Session::CLIENT_ACKNOWLEDGE );
CPPUNIT_ASSERT( info3->getConnectionId() == connectionId );
- SessionInfo* info4 = connector.createSession( cms::Session::Transactional );
- CPPUNIT_ASSERT( info4->getAckMode() == cms::Session::Transactional );
+ SessionInfo* info4 = connector.createSession( cms::Session::SESSION_TRANSACTED );
+ CPPUNIT_ASSERT( info4->getAckMode() == cms::Session::SESSION_TRANSACTED );
CPPUNIT_ASSERT( info4->getConnectionId() == connectionId );
connector.destroyResource( info1 );
@@ -109,7 +111,7 @@
StompConnector connector( &transport, properties );
connector.start();
- SessionInfo* info1 = connector.createSession( cms::Session::AutoAcknowledge );
+ SessionInfo* info1 = connector.createSession( cms::Session::AUTO_ACKNOWLEDGE );
std::string sel1 = "";
StompTopic dest1( "dummy.topic.1" );
ConsumerInfo* cinfo1 = connector.createConsumer( &dest1, info1, sel1 );
@@ -117,7 +119,7 @@
CPPUNIT_ASSERT( cinfo1->getDestination().toString() == dest1.toString() );
CPPUNIT_ASSERT( cinfo1->getMessageSelector() == sel1 );
- SessionInfo* info2 = connector.createSession( cms::Session::DupsOkAcknowledge );
+ SessionInfo* info2 = connector.createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
std::string sel2 = "mysel2";
StompTopic dest2( "dummy.topic.2" );
ConsumerInfo* cinfo2 = connector.createConsumer( &dest2, info2, sel2 );
@@ -125,7 +127,7 @@
CPPUNIT_ASSERT( cinfo2->getDestination().toString() == dest2.toString() );
CPPUNIT_ASSERT( cinfo2->getMessageSelector() == sel2 );
- SessionInfo* info3 = connector.createSession( cms::Session::ClientAcknowledge );
+ SessionInfo* info3 = connector.createSession( cms::Session::CLIENT_ACKNOWLEDGE );
std::string sel3 = "mysel3";
StompQueue dest3( "dummy.queue.1" );
ConsumerInfo* cinfo3 = connector.createConsumer( &dest3, info3, sel3 );
@@ -133,7 +135,7 @@
CPPUNIT_ASSERT( cinfo3->getDestination().toString() == dest3.toString() );
CPPUNIT_ASSERT( cinfo3->getMessageSelector() == sel3 );
- SessionInfo* info4 = connector.createSession( cms::Session::Transactional );
+ SessionInfo* info4 = connector.createSession( cms::Session::SESSION_TRANSACTED );
std::string sel4 = "";
StompTopic dest4( "dummy.queue.2" );
ConsumerInfo* cinfo4 = connector.createConsumer( &dest4, info4, sel4 );
@@ -161,25 +163,25 @@
StompConnector connector( &transport, properties );
connector.start();
- SessionInfo* info1 = connector.createSession( cms::Session::AutoAcknowledge );
+ SessionInfo* info1 = connector.createSession( cms::Session::AUTO_ACKNOWLEDGE );
StompTopic dest1( "dummy.topic.1" );
ProducerInfo* pinfo1 = connector.createProducer( &dest1, info1 );
CPPUNIT_ASSERT( pinfo1->getSessionInfo() == info1 );
CPPUNIT_ASSERT( pinfo1->getDestination().toString() == dest1.toString() );
- SessionInfo* info2 = connector.createSession( cms::Session::DupsOkAcknowledge );
+ SessionInfo* info2 = connector.createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
StompTopic dest2( "dummy.topic.2" );
ProducerInfo* pinfo2 = connector.createProducer( &dest2, info2 );
CPPUNIT_ASSERT( pinfo2->getSessionInfo() == info2 );
CPPUNIT_ASSERT( pinfo2->getDestination().toString() == dest2.toString() );
- SessionInfo* info3 = connector.createSession( cms::Session::ClientAcknowledge );
+ SessionInfo* info3 = connector.createSession( cms::Session::CLIENT_ACKNOWLEDGE );
StompQueue dest3( "dummy.queue.1" );
ProducerInfo* pinfo3 = connector.createProducer( &dest3, info3 );
CPPUNIT_ASSERT( pinfo3->getSessionInfo() == info3 );
CPPUNIT_ASSERT( pinfo3->getDestination().toString() == dest3.toString() );
- SessionInfo* info4 = connector.createSession( cms::Session::Transactional );
+ SessionInfo* info4 = connector.createSession( cms::Session::SESSION_TRANSACTED );
StompTopic dest4( "dummy.queue.2" );
ProducerInfo* pinfo4 = connector.createProducer( &dest4, info4 );
CPPUNIT_ASSERT( pinfo4->getSessionInfo() == info4 );
@@ -208,16 +210,16 @@
StompTopic dest1( "dummy.topic" );
StompTopic dest2( "dummy.topic2" );
- SessionInfo* info1 = connector.createSession( cms::Session::AutoAcknowledge );
+ SessionInfo* info1 = connector.createSession( cms::Session::AUTO_ACKNOWLEDGE );
ConsumerInfo* cinfo1 = connector.createConsumer( &dest1, info1, "" );
- SessionInfo* info2 = connector.createSession( cms::Session::DupsOkAcknowledge );
+ SessionInfo* info2 = connector.createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
ConsumerInfo* cinfo2 = connector.createConsumer( &dest1, info2, "" );
- SessionInfo* info3 = connector.createSession( cms::Session::ClientAcknowledge );
+ SessionInfo* info3 = connector.createSession( cms::Session::CLIENT_ACKNOWLEDGE );
ConsumerInfo* cinfo3 = connector.createConsumer( &dest2, info3, "" );
- SessionInfo* info4 = connector.createSession( cms::Session::Transactional );
+ SessionInfo* info4 = connector.createSession( cms::Session::SESSION_TRANSACTED );
ConsumerInfo* cinfo4 = connector.createConsumer( &dest2, info4, "" );
MyMessageListener listener;
@@ -285,13 +287,13 @@
MyCommandListener cmdListener;
transport.setOutgoingCommandListener( &cmdListener );
- SessionInfo* info1 = connector->createSession( cms::Session::AutoAcknowledge );
+ SessionInfo* info1 = connector->createSession( cms::Session::AUTO_ACKNOWLEDGE );
ConsumerInfo* cinfo1 = connector->createConsumer( &dest1, info1, "" );
CPPUNIT_ASSERT( cmdListener.cmd != NULL );
cmdListener.cmd = NULL;
- SessionInfo* info2 = connector->createSession( cms::Session::DupsOkAcknowledge );
+ SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
ConsumerInfo* cinfo2 = connector->createConsumer( &dest1, info2, "" );
CPPUNIT_ASSERT( cmdListener.cmd == NULL );
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompResponseBuilder.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompResponseBuilder.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompResponseBuilder.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompResponseBuilder.h Fri Jul 21 04:36:09 2006
@@ -31,7 +31,16 @@
if( connectCommand != NULL ){
commands::ConnectedCommand* resp = new commands::ConnectedCommand();
resp->setCorrelationId( connectCommand->getCommandId() );
- resp->setSessionId( sessionId );
+
+ if( connectCommand->getClientId() == NULL )
+ {
+ resp->setSessionId( sessionId );
+ }
+ else
+ {
+ resp->setSessionId( connectCommand->getClientId() );
+ }
+
return resp;
}