You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/10/09 23:02:29 UTC
svn commit: r454509 [3/5] - in
/incubator/activemq/activemq-cpp/trunk/activemq-cpp:
activemq-cpp.xcodeproj/ src/examples/ src/main/activemq/core/
src/main/activemq/util/ src/main/cms/
src/test-integration/integration/various/ src/test/activemq/core/ te...
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp?view=diff&rev=454509&r1=454508&r2=454509
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp Mon Oct 9 14:02:28 2006
@@ -1,260 +1,260 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-// START SNIPPET: demo
-
-#include <activemq/concurrent/Thread.h>
-#include <activemq/concurrent/Runnable.h>
-#include <activemq/core/ActiveMQConnectionFactory.h>
-#include <activemq/util/Integer.h>
-#include <cms/Connection.h>
-#include <cms/Session.h>
-#include <cms/TextMessage.h>
-#include <cms/ExceptionListener.h>
-#include <cms/MessageListener.h>
-#include <stdlib.h>
-
-using namespace activemq::core;
-using namespace activemq::util;
-using namespace activemq::concurrent;
-using namespace cms;
-using namespace std;
-
-class HelloWorldProducer : public Runnable {
-private:
-
- Connection* connection;
- Session* session;
- Destination* destination;
- MessageProducer* producer;
- int numMessages;
-
-public:
-
- HelloWorldProducer( int numMessages ){
- connection = NULL;
- session = NULL;
- destination = NULL;
- producer = NULL;
- this->numMessages = numMessages;
- }
-
- virtual ~HelloWorldProducer(){
- cleanup();
- }
-
- virtual void run() {
- try {
- // Create a ConnectionFactory
- ActiveMQConnectionFactory* connectionFactory = new ActiveMQConnectionFactory("tcp://127.0.0.1:61613");
-
- // Create a Connection
- connection = connectionFactory->createConnection();
- connection->start();
-
- // Create a Session
- session = connection->createSession( Session::AUTO_ACKNOWLEDGE );
-
- // Create the destination (Topic or Queue)
- destination = session->createQueue( "TEST.FOO" );
-
- // Create a MessageProducer from the Session to the Topic or Queue
- producer = session->createProducer( destination );
- producer->setDeliveryMode( DeliveryMode::NON_PERSISTANT );
-
- // Create the Thread Id String
- string threadIdStr = Integer::toString( Thread::getId() );
-
- // Create a messages
- string text = (string)"Hello world! from thread " + threadIdStr;
-
- for( int ix=0; ix<numMessages; ++ix ){
- TextMessage* message = session->createTextMessage( text );
-
- // Tell the producer to send the message
- printf( "Sent message from thread %s\n", threadIdStr.c_str() );
- producer->send( message );
-
- delete message;
- }
-
- }catch ( CMSException& e ) {
- e.printStackTrace();
- }
- }
-
-private:
-
- void cleanup(){
-
- // Destroy resources.
- try{
- if( destination != NULL ) delete destination;
- }catch ( CMSException& e ) {}
- destination = NULL;
-
- try{
- if( producer != NULL ) delete producer;
- }catch ( CMSException& e ) {}
- producer = NULL;
-
- // Close open resources.
- try{
- if( session != NULL ) session->close();
- if( connection != NULL ) connection->close();
- }catch ( CMSException& e ) {}
-
- try{
- if( session != NULL ) delete session;
- }catch ( CMSException& e ) {}
- session = NULL;
-
- try{
- if( connection != NULL ) delete connection;
- }catch ( CMSException& e ) {}
- connection = NULL;
- }
-};
-
-class HelloWorldConsumer : public ExceptionListener,
- public MessageListener,
- public Runnable {
-
-private:
-
- Connection* connection;
- Session* session;
- Destination* destination;
- MessageConsumer* consumer;
- long waitMillis;
-
-public:
-
- HelloWorldConsumer( long waitMillis ){
- connection = NULL;
- session = NULL;
- destination = NULL;
- consumer = NULL;
- this->waitMillis = waitMillis;
- }
- virtual ~HelloWorldConsumer(){
- cleanup();
- }
-
- virtual void run() {
-
- try {
-
- // Create a ConnectionFactory
- ActiveMQConnectionFactory* connectionFactory =
- new ActiveMQConnectionFactory( "tcp://127.0.0.1:61613" );
-
- // Create a Connection
- connection = connectionFactory->createConnection();
- delete connectionFactory;
- connection->start();
-
- connection->setExceptionListener(this);
-
- // Create a Session
- session = connection->createSession( Session::AUTO_ACKNOWLEDGE );
-
- // Create the destination (Topic or Queue)
- destination = session->createQueue( "TEST.FOO" );
-
- // Create a MessageConsumer from the Session to the Topic or Queue
- consumer = session->createConsumer( destination );
-
- consumer->setMessageListener( this );
-
- // Sleep while asynchronous messages come in.
- Thread::sleep( waitMillis );
-
- } catch (CMSException& e) {
- e.printStackTrace();
- }
- }
-
- virtual void onMessage( const Message* message ){
-
- try
- {
- const TextMessage* textMessage =
- dynamic_cast< const TextMessage* >( message );
- string text = textMessage->getText();
- printf( "Received: %s\n", text.c_str() );
- } catch (CMSException& e) {
- e.printStackTrace();
- }
- }
-
- virtual void onException( const CMSException& ex ) {
- printf("JMS Exception occured. Shutting down client.\n");
- }
-
-private:
-
- void cleanup(){
-
- // Destroy resources.
- try{
- if( destination != NULL ) delete destination;
- }catch (CMSException& e) {}
- destination = NULL;
-
- try{
- if( consumer != NULL ) delete consumer;
- }catch (CMSException& e) {}
- consumer = NULL;
-
- // Close open resources.
- try{
- if( session != NULL ) session->close();
- if( connection != NULL ) connection->close();
- }catch (CMSException& e) {}
-
- try{
- if( session != NULL ) delete session;
- }catch (CMSException& e) {}
- session = NULL;
-
- try{
- if( connection != NULL ) delete connection;
- }catch (CMSException& e) {}
- connection = NULL;
- }
-};
-
-int main(int argc, char* argv[]) {
-
- HelloWorldProducer producer( 1000 );
- HelloWorldConsumer consumer( 5000 );
-
- // Start the consumer thread.
- Thread consumerThread( &consumer );
- consumerThread.start();
-
- // Start the producer thread.
- Thread producerThread( &producer );
- producerThread.start();
-
- // Wait for the threads to complete.
- producerThread.join();
- consumerThread.join();
-}
-
-// END SNIPPET: demo
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+// START SNIPPET: demo
+
+#include <activemq/concurrent/Thread.h>
+#include <activemq/concurrent/Runnable.h>
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/util/Integer.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/TextMessage.h>
+#include <cms/ExceptionListener.h>
+#include <cms/MessageListener.h>
+#include <stdlib.h>
+
+using namespace activemq::core;
+using namespace activemq::util;
+using namespace activemq::concurrent;
+using namespace cms;
+using namespace std;
+
+class HelloWorldProducer : public Runnable {
+private:
+
+ Connection* connection;
+ Session* session;
+ Destination* destination;
+ MessageProducer* producer;
+ int numMessages;
+
+public:
+
+ HelloWorldProducer( int numMessages ){
+ connection = NULL;
+ session = NULL;
+ destination = NULL;
+ producer = NULL;
+ this->numMessages = numMessages;
+ }
+
+ virtual ~HelloWorldProducer(){
+ cleanup();
+ }
+
+ virtual void run() {
+ try {
+ // Create a ConnectionFactory
+ ActiveMQConnectionFactory* connectionFactory = new ActiveMQConnectionFactory("tcp://127.0.0.1:61613");
+
+ // Create a Connection
+ connection = connectionFactory->createConnection();
+ connection->start();
+
+ // Create a Session
+ session = connection->createSession( Session::AUTO_ACKNOWLEDGE );
+
+ // Create the destination (Topic or Queue)
+ destination = session->createQueue( "TEST.FOO" );
+
+ // Create a MessageProducer from the Session to the Topic or Queue
+ producer = session->createProducer( destination );
+ producer->setDeliveryMode( DeliveryMode::NON_PERSISTANT );
+
+ // Create the Thread Id String
+ string threadIdStr = Integer::toString( Thread::getId() );
+
+ // Create a messages
+ string text = (string)"Hello world! from thread " + threadIdStr;
+
+ for( int ix=0; ix<numMessages; ++ix ){
+ TextMessage* message = session->createTextMessage( text );
+
+ // Tell the producer to send the message
+ printf( "Sent message from thread %s\n", threadIdStr.c_str() );
+ producer->send( message );
+
+ delete message;
+ }
+
+ }catch ( CMSException& e ) {
+ e.printStackTrace();
+ }
+ }
+
+private:
+
+ void cleanup(){
+
+ // Destroy resources.
+ try{
+ if( destination != NULL ) delete destination;
+ }catch ( CMSException& e ) {}
+ destination = NULL;
+
+ try{
+ if( producer != NULL ) delete producer;
+ }catch ( CMSException& e ) {}
+ producer = NULL;
+
+ // Close open resources.
+ try{
+ if( session != NULL ) session->close();
+ if( connection != NULL ) connection->close();
+ }catch ( CMSException& e ) {}
+
+ try{
+ if( session != NULL ) delete session;
+ }catch ( CMSException& e ) {}
+ session = NULL;
+
+ try{
+ if( connection != NULL ) delete connection;
+ }catch ( CMSException& e ) {}
+ connection = NULL;
+ }
+};
+
+class HelloWorldConsumer : public ExceptionListener,
+ public MessageListener,
+ public Runnable {
+
+private:
+
+ Connection* connection;
+ Session* session;
+ Destination* destination;
+ MessageConsumer* consumer;
+ long waitMillis;
+
+public:
+
+ HelloWorldConsumer( long waitMillis ){
+ connection = NULL;
+ session = NULL;
+ destination = NULL;
+ consumer = NULL;
+ this->waitMillis = waitMillis;
+ }
+ virtual ~HelloWorldConsumer(){
+ cleanup();
+ }
+
+ virtual void run() {
+
+ try {
+
+ // Create a ConnectionFactory
+ ActiveMQConnectionFactory* connectionFactory =
+ new ActiveMQConnectionFactory( "tcp://127.0.0.1:61613" );
+
+ // Create a Connection
+ connection = connectionFactory->createConnection();
+ delete connectionFactory;
+ connection->start();
+
+ connection->setExceptionListener(this);
+
+ // Create a Session
+ session = connection->createSession( Session::AUTO_ACKNOWLEDGE );
+
+ // Create the destination (Topic or Queue)
+ destination = session->createQueue( "TEST.FOO" );
+
+ // Create a MessageConsumer from the Session to the Topic or Queue
+ consumer = session->createConsumer( destination );
+
+ consumer->setMessageListener( this );
+
+ // Sleep while asynchronous messages come in.
+ Thread::sleep( waitMillis );
+
+ } catch (CMSException& e) {
+ e.printStackTrace();
+ }
+ }
+
+ virtual void onMessage( const Message* message ){
+
+ try
+ {
+ const TextMessage* textMessage =
+ dynamic_cast< const TextMessage* >( message );
+ string text = textMessage->getText();
+ printf( "Received: %s\n", text.c_str() );
+ } catch (CMSException& e) {
+ e.printStackTrace();
+ }
+ }
+
+ virtual void onException( const CMSException& ex ) {
+ printf("JMS Exception occured. Shutting down client.\n");
+ }
+
+private:
+
+ void cleanup(){
+
+ // Destroy resources.
+ try{
+ if( destination != NULL ) delete destination;
+ }catch (CMSException& e) {}
+ destination = NULL;
+
+ try{
+ if( consumer != NULL ) delete consumer;
+ }catch (CMSException& e) {}
+ consumer = NULL;
+
+ // Close open resources.
+ try{
+ if( session != NULL ) session->close();
+ if( connection != NULL ) connection->close();
+ }catch (CMSException& e) {}
+
+ try{
+ if( session != NULL ) delete session;
+ }catch (CMSException& e) {}
+ session = NULL;
+
+ try{
+ if( connection != NULL ) delete connection;
+ }catch (CMSException& e) {}
+ connection = NULL;
+ }
+};
+
+int main(int argc, char* argv[]) {
+
+ HelloWorldProducer producer( 1000 );
+ HelloWorldConsumer consumer( 5000 );
+
+ // Start the consumer thread.
+ Thread consumerThread( &consumer );
+ consumerThread.start();
+
+ // Start the producer thread.
+ Thread producerThread( &producer );
+ producerThread.start();
+
+ // Wait for the threads to complete.
+ producerThread.join();
+ consumerThread.join();
+}
+
+// END SNIPPET: demo
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQDestination.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQDestination.h?view=diff&rev=454509&r1=454508&r2=454509
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQDestination.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQDestination.h Mon Oct 9 14:02:28 2006
@@ -1,192 +1,192 @@
-/*
- * 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_CORE_ACTIVEMQDESTINATION_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQDESTINATION_H_
-
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/util/StringTokenizer.h>
-#include <activemq/exceptions/IllegalArgumentException.h>
-
-#include <cms/Destination.h>
-
-namespace activemq{
-namespace core{
-
- template< typename T >
- class ActiveMQDestination : public T
- {
- private:
-
- // Params that are optional on the destination
- util::SimpleProperties properties;
-
- // Destination type
- cms::Destination::DestinationType destType;
-
- // Name of the Destination
- std::string name;
-
- public:
-
- /**
- * Copy Consturctor
- * @param source CMS Dest to Copy, must be a compatible type
- */
- ActiveMQDestination( const cms::Destination* source ){
- this->copy( *source );
- }
-
- /**
- * Custom Constructor
- * @param dest string destination name plus any params
- * @param destType type of destination this represents.
- */
- ActiveMQDestination( const std::string& dest,
- cms::Destination::DestinationType destType )
- {
- try
- {
- util::StringTokenizer tokenizer(dest, "?&");
- std::vector<std::string> tokens;
-
- // Set the type, we know that much anyway
- this->destType = destType;
-
- // Require that there at least one token, the dest
- if( tokenizer.countTokens() < 1 )
- {
- throw exceptions::IllegalArgumentException(
- __FILE__, __LINE__,
- ( std::string(
- "ActiveMQDestination::ActiveMQDestination - "
- "Marlformed Dest: " ) + dest ).c_str() );
- }
-
- // Grab the name, that's always first.
- this->name = tokenizer.nextToken();
-
- // Now get all the optional parameters and store them as properties
- int count = tokenizer.toArray( tokens );
-
- for( int i = 0; i < count; ++i )
- {
- tokenizer.reset( tokens[i], "=" );
-
- if( tokenizer.countTokens() != 2 )
- {
- throw exceptions::IllegalArgumentException(
- __FILE__, __LINE__,
- ( std::string(
- "ActiveMQDestination::ActiveMQDestination - "
- "Marlformed Parameter = ") + tokens[i] ).c_str() );
- }
-
- // Get the out in the right order
- std::string key = tokenizer.nextToken();
- std::string value = tokenizer.nextToken();
-
- // Store this param as a property
- properties.setProperty( key, value );
- }
- }
- AMQ_CATCH_RETHROW( exceptions::IllegalArgumentException )
- AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, exceptions::IllegalArgumentException )
- AMQ_CATCHALL_THROW( exceptions::IllegalArgumentException )
- }
-
- virtual ~ActiveMQDestination() {}
-
- /**
- * Get the properties of this Destination, these are the optional
- * params that can be specified on a destination name i.e/
- * TEST.QUEUE?consumer.dispatchAsync=false&consumer.prefetchSize=10
- * @returns const reference to a properties object
- */
- virtual const util::Properties& getProperties() const {
- return properties;
- }
-
- /**
- * Copy the contents of the given properties object to this
- * objects Properties object. Existing values are erased.
- * @param properties the Properties to copy to this object.
- */
- virtual void setProperties( const util::Properties& properties ){
- this->properties.copy( &properties );
- }
-
- /**
- * Gets the Destination Name minus any optional params that can
- * be appended to the destination with an ?
- * @returns destination name minus params
- */
- virtual const std::string& getName() const {
- return name;
- }
-
- /**
- * Sets the Destination Name minus any optional params that can
- * be appended to the destination with an ?
- * @param name destination name minus params
- */
- virtual void setName( const std::string& name ) {
- this->name = name;
- }
-
- /**
- * Retrieve the Destination Type for this Destination
- * @return The Destination Type
- */
- virtual cms::Destination::DestinationType getDestinationType() const {
- return destType;
- }
-
- /**
- * Set the Destination Type for this Destination
- * @param destType The Destination Type
- */
- virtual void setDestinationType( cms::Destination::DestinationType destType ) {
- this->destType = destType;
- }
-
- /**
- * Copies the contents of the given Destinastion object to this one.
- * @param source The source Destination object.
- */
- virtual void copy( const cms::Destination& source ) {
-
- try
- {
- // This will throw an Bad Cast Exception if the destination
- // isn't a compatible type
- const ActiveMQDestination<T>& destination =
- dynamic_cast< const ActiveMQDestination<T>& >( source );
-
- this->name = destination.getName();
- this->destType = destination.getDestinationType();
-
- this->properties.copy( &destination.getProperties() );
- }
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
- }
-
- };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQDESTINATION_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_CORE_ACTIVEMQDESTINATION_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQDESTINATION_H_
+
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/exceptions/IllegalArgumentException.h>
+
+#include <cms/Destination.h>
+
+namespace activemq{
+namespace core{
+
+ template< typename T >
+ class ActiveMQDestination : public T
+ {
+ private:
+
+ // Params that are optional on the destination
+ util::SimpleProperties properties;
+
+ // Destination type
+ cms::Destination::DestinationType destType;
+
+ // Name of the Destination
+ std::string name;
+
+ public:
+
+ /**
+ * Copy Consturctor
+ * @param source CMS Dest to Copy, must be a compatible type
+ */
+ ActiveMQDestination( const cms::Destination* source ){
+ this->copy( *source );
+ }
+
+ /**
+ * Custom Constructor
+ * @param dest string destination name plus any params
+ * @param destType type of destination this represents.
+ */
+ ActiveMQDestination( const std::string& dest,
+ cms::Destination::DestinationType destType )
+ {
+ try
+ {
+ util::StringTokenizer tokenizer(dest, "?&");
+ std::vector<std::string> tokens;
+
+ // Set the type, we know that much anyway
+ this->destType = destType;
+
+ // Require that there at least one token, the dest
+ if( tokenizer.countTokens() < 1 )
+ {
+ throw exceptions::IllegalArgumentException(
+ __FILE__, __LINE__,
+ ( std::string(
+ "ActiveMQDestination::ActiveMQDestination - "
+ "Marlformed Dest: " ) + dest ).c_str() );
+ }
+
+ // Grab the name, that's always first.
+ this->name = tokenizer.nextToken();
+
+ // Now get all the optional parameters and store them as properties
+ int count = tokenizer.toArray( tokens );
+
+ for( int i = 0; i < count; ++i )
+ {
+ tokenizer.reset( tokens[i], "=" );
+
+ if( tokenizer.countTokens() != 2 )
+ {
+ throw exceptions::IllegalArgumentException(
+ __FILE__, __LINE__,
+ ( std::string(
+ "ActiveMQDestination::ActiveMQDestination - "
+ "Marlformed Parameter = ") + tokens[i] ).c_str() );
+ }
+
+ // Get the out in the right order
+ std::string key = tokenizer.nextToken();
+ std::string value = tokenizer.nextToken();
+
+ // Store this param as a property
+ properties.setProperty( key, value );
+ }
+ }
+ AMQ_CATCH_RETHROW( exceptions::IllegalArgumentException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, exceptions::IllegalArgumentException )
+ AMQ_CATCHALL_THROW( exceptions::IllegalArgumentException )
+ }
+
+ virtual ~ActiveMQDestination() {}
+
+ /**
+ * Get the properties of this Destination, these are the optional
+ * params that can be specified on a destination name i.e/
+ * TEST.QUEUE?consumer.dispatchAsync=false&consumer.prefetchSize=10
+ * @returns const reference to a properties object
+ */
+ virtual const util::Properties& getProperties() const {
+ return properties;
+ }
+
+ /**
+ * Copy the contents of the given properties object to this
+ * objects Properties object. Existing values are erased.
+ * @param properties the Properties to copy to this object.
+ */
+ virtual void setProperties( const util::Properties& properties ){
+ this->properties.copy( &properties );
+ }
+
+ /**
+ * Gets the Destination Name minus any optional params that can
+ * be appended to the destination with an ?
+ * @returns destination name minus params
+ */
+ virtual const std::string& getName() const {
+ return name;
+ }
+
+ /**
+ * Sets the Destination Name minus any optional params that can
+ * be appended to the destination with an ?
+ * @param name destination name minus params
+ */
+ virtual void setName( const std::string& name ) {
+ this->name = name;
+ }
+
+ /**
+ * Retrieve the Destination Type for this Destination
+ * @return The Destination Type
+ */
+ virtual cms::Destination::DestinationType getDestinationType() const {
+ return destType;
+ }
+
+ /**
+ * Set the Destination Type for this Destination
+ * @param destType The Destination Type
+ */
+ virtual void setDestinationType( cms::Destination::DestinationType destType ) {
+ this->destType = destType;
+ }
+
+ /**
+ * Copies the contents of the given Destinastion object to this one.
+ * @param source The source Destination object.
+ */
+ virtual void copy( const cms::Destination& source ) {
+
+ try
+ {
+ // This will throw an Bad Cast Exception if the destination
+ // isn't a compatible type
+ const ActiveMQDestination<T>& destination =
+ dynamic_cast< const ActiveMQDestination<T>& >( source );
+
+ this->name = destination.getName();
+ this->destType = destination.getDestinationType();
+
+ this->properties.copy( &destination.getProperties() );
+ }
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQDESTINATION_H_*/
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQDestination.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Config.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Config.h?view=diff&rev=454509&r1=454508&r2=454509
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Config.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Config.h Mon Oct 9 14:02:28 2006
@@ -1,51 +1,51 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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_CONFIG_H_
-#define ACTIVEMQ_UTIL_CONFIG_H_
-
-//
-// The purpose of this header is to try to detect the supported headers
-// of the platform when the ./configure script is not being used to generate
-// the config.h file.
-//
-#if defined(HAVE_CONFIG_H)
-
- // config.h is generated by the ./configure script and it only
- // used by unix like systems (includeing cygwin)
- #include <config.h>
-
-
-#else /* !defined(HAVE_CONFIG_H) */
-
- // Not using ./configure script and make system.. chances are your using the native build tools
- // of Windows or OS X to do this build
- #if defined(__APPLE__)
- #define HAVE_UUID_H
- #elif defined(_WIN32) || defined( __CYGWIN__ )
- #define HAVE_OBJBASE_H
- #define HAVE_RPCDCE_H
- #define HAVE_WINSOCK2_H
- #elif defined( unix )
- #define HAVE_UUID_UUID_H
- #else
- #error "Unknown Platform"
- #endif
-
-#endif /* !defined(HAVE_CONFIG_H) */
-
-
-#endif /*ACTIVEMQ_UTIL_CONFIG_H_*/
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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_CONFIG_H_
+#define ACTIVEMQ_UTIL_CONFIG_H_
+
+//
+// The purpose of this header is to try to detect the supported headers
+// of the platform when the ./configure script is not being used to generate
+// the config.h file.
+//
+#if defined(HAVE_CONFIG_H)
+
+ // config.h is generated by the ./configure script and it only
+ // used by unix like systems (includeing cygwin)
+ #include <config.h>
+
+
+#else /* !defined(HAVE_CONFIG_H) */
+
+ // Not using ./configure script and make system.. chances are your using the native build tools
+ // of Windows or OS X to do this build
+ #if defined(__APPLE__)
+ #define HAVE_UUID_H
+ #elif defined(_WIN32) || defined( __CYGWIN__ )
+ #define HAVE_OBJBASE_H
+ #define HAVE_RPCDCE_H
+ #define HAVE_WINSOCK2_H
+ #elif defined( unix )
+ #define HAVE_UUID_UUID_H
+ #else
+ #error "Unknown Platform"
+ #endif
+
+#endif /* !defined(HAVE_CONFIG_H) */
+
+
+#endif /*ACTIVEMQ_UTIL_CONFIG_H_*/
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Config.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/DeliveryMode.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/DeliveryMode.h?view=diff&rev=454509&r1=454508&r2=454509
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/DeliveryMode.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/DeliveryMode.h Mon Oct 9 14:02:28 2006
@@ -1,44 +1,44 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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_*/
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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_*/
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/DeliveryMode.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp?view=diff&rev=454509&r1=454508&r2=454509
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp Mon Oct 9 14:02:28 2006
@@ -1,258 +1,258 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 "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 );
-
- textMsg = session->createTextMessage();
- textMsg->setText( "SimpleTest - Message after Rollback" );
- producer->send( textMsg );
- delete textMsg;
-
- 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( )
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 "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 );
+
+ textMsg = session->createTextMessage();
+ textMsg->setText( "SimpleTest - Message after Rollback" );
+ producer->send( textMsg );
+ delete textMsg;
+
+ 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( )
+}
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.h?view=diff&rev=454509&r1=454508&r2=454509
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.h Mon Oct 9 14:02:28 2006
@@ -1,68 +1,68 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 _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_*/
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _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_*/
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.cpp?view=diff&rev=454509&r1=454508&r2=454509
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.cpp Mon Oct 9 14:02:28 2006
@@ -1,20 +1,20 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 "ActiveMQDestinationTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQDestinationTest );
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 "ActiveMQDestinationTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQDestinationTest );
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.h?view=diff&rev=454509&r1=454508&r2=454509
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.h Mon Oct 9 14:02:28 2006
@@ -1,147 +1,147 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 ACTIVEMQDESTINATIONTEST_H_
-#define ACTIVEMQDESTINATIONTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/core/ActiveMQDestination.h>
-#include <cms/Topic.h>
-
-namespace activemq{
-namespace core{
-
- class ActiveMQDestinationTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( ActiveMQDestinationTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- class MyDestination : public ActiveMQDestination< cms::Topic >
- {
- public:
-
- MyDestination( const cms::Destination* dest ) :
- ActiveMQDestination< cms::Topic >( dest ) {}
-
- MyDestination( const std::string& name )
- : ActiveMQDestination< cms::Topic >( name, cms::Destination::TOPIC )
- {}
-
- virtual ~MyDestination() {}
-
- /**
- * Converts the Destination Name into a String
- * @return string name
- */
- virtual std::string toString(void) const {
- return getName();
- }
-
- /**
- * Converts the Destination to a String value representing the
- * Provider specific name fot this destination, which is not
- * necessarily equal to the User Supplied name of the Destination
- * @return Provider specific Name
- */
- virtual std::string toProviderString(void) const {
- return getName();
- }
-
- /**
- * Creates a new instance of this destination type that is a
- * copy of this one, and returns it.
- * @returns cloned copy of this object
- */
- virtual cms::Destination* clone(void) const {
- return new MyDestination( this );
- }
-
- /**
- * Gets the name of this topic.
- * @return The topic name.
- */
- virtual std::string getTopicName(void)
- const throw( cms::CMSException ) { return getName(); }
-
- };
-
- ActiveMQDestinationTest() {}
- virtual ~ActiveMQDestinationTest() {}
-
- virtual void test()
- {
- MyDestination dest( "test" );
-
- CPPUNIT_ASSERT( dest.getTopicName() == "test" );
-
- MyDestination dest1( "test1?value1=1&value2=2" );
-
- CPPUNIT_ASSERT( dest1.getTopicName() == "test1" );
- CPPUNIT_ASSERT( dest1.getProperties().hasProperty( "value1" ) == true );
- CPPUNIT_ASSERT( dest1.getProperties().hasProperty( "value2" ) == true );
- CPPUNIT_ASSERT( dest1.getProperties().hasProperty( "value3" ) != true );
-
- std::string value1 = dest1.getProperties().getProperty( "value1" );
- std::string value2 = dest1.getProperties().getProperty( "value2" );
-
- CPPUNIT_ASSERT( value1 == "1" );
- CPPUNIT_ASSERT( value2 == "2" );
-
- MyDestination* dest2 =
- dynamic_cast< MyDestination* >( dest1.clone() );
-
- CPPUNIT_ASSERT( dest2 != NULL );
-
- CPPUNIT_ASSERT( dest2->getTopicName() == "test1" );
- CPPUNIT_ASSERT( dest2->getProperties().hasProperty( "value1" ) == true );
- CPPUNIT_ASSERT( dest2->getProperties().hasProperty( "value2" ) == true );
- CPPUNIT_ASSERT( dest2->getProperties().hasProperty( "value3" ) != true );
-
- value1 = dest2->getProperties().getProperty( "value1" );
- value2 = dest2->getProperties().getProperty( "value2" );
-
- CPPUNIT_ASSERT( value1 == "1" );
- CPPUNIT_ASSERT( value2 == "2" );
-
- delete dest2;
-
- MyDestination dest3("dummy");
- dest3.copy( dest1 );
-
- CPPUNIT_ASSERT( dest3.getTopicName() == "test1" );
- CPPUNIT_ASSERT( dest3.getProperties().hasProperty( "value1" ) == true );
- CPPUNIT_ASSERT( dest3.getProperties().hasProperty( "value2" ) == true );
- CPPUNIT_ASSERT( dest3.getProperties().hasProperty( "value3" ) != true );
-
- value1 = dest3.getProperties().getProperty( "value1" );
- value2 = dest3.getProperties().getProperty( "value2" );
-
- CPPUNIT_ASSERT( value1 == "1" );
- CPPUNIT_ASSERT( value2 == "2" );
-
- }
-
- };
-
-}}
-
-#endif /*ACTIVEMQDESTINATIONTEST_H_*/
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 ACTIVEMQDESTINATIONTEST_H_
+#define ACTIVEMQDESTINATIONTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/core/ActiveMQDestination.h>
+#include <cms/Topic.h>
+
+namespace activemq{
+namespace core{
+
+ class ActiveMQDestinationTest : public CppUnit::TestFixture
+ {
+ CPPUNIT_TEST_SUITE( ActiveMQDestinationTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ class MyDestination : public ActiveMQDestination< cms::Topic >
+ {
+ public:
+
+ MyDestination( const cms::Destination* dest ) :
+ ActiveMQDestination< cms::Topic >( dest ) {}
+
+ MyDestination( const std::string& name )
+ : ActiveMQDestination< cms::Topic >( name, cms::Destination::TOPIC )
+ {}
+
+ virtual ~MyDestination() {}
+
+ /**
+ * Converts the Destination Name into a String
+ * @return string name
+ */
+ virtual std::string toString(void) const {
+ return getName();
+ }
+
+ /**
+ * Converts the Destination to a String value representing the
+ * Provider specific name fot this destination, which is not
+ * necessarily equal to the User Supplied name of the Destination
+ * @return Provider specific Name
+ */
+ virtual std::string toProviderString(void) const {
+ return getName();
+ }
+
+ /**
+ * Creates a new instance of this destination type that is a
+ * copy of this one, and returns it.
+ * @returns cloned copy of this object
+ */
+ virtual cms::Destination* clone(void) const {
+ return new MyDestination( this );
+ }
+
+ /**
+ * Gets the name of this topic.
+ * @return The topic name.
+ */
+ virtual std::string getTopicName(void)
+ const throw( cms::CMSException ) { return getName(); }
+
+ };
+
+ ActiveMQDestinationTest() {}
+ virtual ~ActiveMQDestinationTest() {}
+
+ virtual void test()
+ {
+ MyDestination dest( "test" );
+
+ CPPUNIT_ASSERT( dest.getTopicName() == "test" );
+
+ MyDestination dest1( "test1?value1=1&value2=2" );
+
+ CPPUNIT_ASSERT( dest1.getTopicName() == "test1" );
+ CPPUNIT_ASSERT( dest1.getProperties().hasProperty( "value1" ) == true );
+ CPPUNIT_ASSERT( dest1.getProperties().hasProperty( "value2" ) == true );
+ CPPUNIT_ASSERT( dest1.getProperties().hasProperty( "value3" ) != true );
+
+ std::string value1 = dest1.getProperties().getProperty( "value1" );
+ std::string value2 = dest1.getProperties().getProperty( "value2" );
+
+ CPPUNIT_ASSERT( value1 == "1" );
+ CPPUNIT_ASSERT( value2 == "2" );
+
+ MyDestination* dest2 =
+ dynamic_cast< MyDestination* >( dest1.clone() );
+
+ CPPUNIT_ASSERT( dest2 != NULL );
+
+ CPPUNIT_ASSERT( dest2->getTopicName() == "test1" );
+ CPPUNIT_ASSERT( dest2->getProperties().hasProperty( "value1" ) == true );
+ CPPUNIT_ASSERT( dest2->getProperties().hasProperty( "value2" ) == true );
+ CPPUNIT_ASSERT( dest2->getProperties().hasProperty( "value3" ) != true );
+
+ value1 = dest2->getProperties().getProperty( "value1" );
+ value2 = dest2->getProperties().getProperty( "value2" );
+
+ CPPUNIT_ASSERT( value1 == "1" );
+ CPPUNIT_ASSERT( value2 == "2" );
+
+ delete dest2;
+
+ MyDestination dest3("dummy");
+ dest3.copy( dest1 );
+
+ CPPUNIT_ASSERT( dest3.getTopicName() == "test1" );
+ CPPUNIT_ASSERT( dest3.getProperties().hasProperty( "value1" ) == true );
+ CPPUNIT_ASSERT( dest3.getProperties().hasProperty( "value2" ) == true );
+ CPPUNIT_ASSERT( dest3.getProperties().hasProperty( "value3" ) != true );
+
+ value1 = dest3.getProperties().getProperty( "value1" );
+ value2 = dest3.getProperties().getProperty( "value2" );
+
+ CPPUNIT_ASSERT( value1 == "1" );
+ CPPUNIT_ASSERT( value2 == "2" );
+
+ }
+
+ };
+
+}}
+
+#endif /*ACTIVEMQDESTINATIONTEST_H_*/
Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQDestinationTest.h
------------------------------------------------------------------------------
svn:eol-style = native