You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2008/12/04 17:56:23 UTC

svn commit: r723374 [3/3] - in /activemq/activemq-cpp/trunk/src/test-integration: ./ activemq/ activemq/test/ activemq/test/openwire/ activemq/test/stomp/ activemq/util/ integration/

Added: activemq/activemq-cpp/trunk/src/test-integration/activemq/test/stomp/StompTransactionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/test/stomp/StompTransactionTest.h?rev=723374&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/test/stomp/StompTransactionTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/test/stomp/StompTransactionTest.h Thu Dec  4 08:56:21 2008
@@ -0,0 +1,48 @@
+/*
+ * 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_TEST_STOMP_STOMPTRANSACTIONTESTER_H_
+#define _ACTIVEMQ_TEST_STOMP_STOMPTRANSACTIONTESTER_H_
+
+#include <activemq/test/TransactionTest.h>
+
+namespace activemq{
+namespace test{
+namespace stomp{
+
+    class StompTransactionTest : public TransactionTest {
+
+        CPPUNIT_TEST_SUITE( StompTransactionTest );
+//        CPPUNIT_TEST( testSendReceiveTransactedBatches );
+        CPPUNIT_TEST( testSendRollback );
+//        CPPUNIT_TEST( testSendSessionClose );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        StompTransactionTest();
+        virtual ~StompTransactionTest();
+
+        virtual std::string getBrokerURL() const {
+            return activemq::util::IntegrationCommon::getInstance().getStompURL();
+        }
+
+    };
+
+}}}
+
+#endif /*_ACTIVEMQ_TEST_STOMP_STOMPTRANSACTIONTESTER_H_*/

Propchange: activemq/activemq-cpp/trunk/src/test-integration/activemq/test/stomp/StompTransactionTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSListener.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSListener.cpp?rev=723374&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSListener.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSListener.cpp Thu Dec  4 08:56:21 2008
@@ -0,0 +1,112 @@
+/*
+ * 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 "CMSListener.h"
+
+#include <activemq/exceptions/ActiveMQException.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace std;
+using namespace cms;
+using namespace activemq;
+using namespace activemq::util;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+
+////////////////////////////////////////////////////////////////////////////////
+CMSListener::CMSListener( cms::Session* session ) : session( session ) {
+    this->reset();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CMSListener::~CMSListener() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSListener::reset() {
+    this->numReceived = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSListener::asyncWaitForMessages( unsigned int count ) {
+
+    try {
+
+        synchronized( &mutex ) {
+            int stopAtZero = count + 5;
+
+            while( numReceived < count ) {
+                mutex.wait( 500 );
+
+                if( --stopAtZero == 0 ) {
+                    break;
+                }
+            }
+        }
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSListener::onMessage( const cms::Message* message ) {
+
+    if( session->getAcknowledgeMode() == cms::Session::CLIENT_ACKNOWLEDGE ) {
+        try {
+            message->acknowledge();
+        } catch( CMSException& ex ) {
+            CPPUNIT_ASSERT_MESSAGE(ex.getStackTraceString(), false );
+        }
+    }
+
+    // Got a text message.
+    const cms::TextMessage* txtMsg =
+        dynamic_cast<const cms::TextMessage*>( message );
+
+    if( txtMsg != NULL ) {
+        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 ) {
+
+        numReceived++;
+
+        // Signal that we got one
+        synchronized( &mutex ) {
+            mutex.notifyAll();
+        }
+
+        return;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSListener::onException( const cms::CMSException& error ) {
+    CPPUNIT_ASSERT_MESSAGE( error.getStackTraceString(), false );
+}

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

Added: activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSListener.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSListener.h?rev=723374&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSListener.h (added)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSListener.h Thu Dec  4 08:56:21 2008
@@ -0,0 +1,58 @@
+/*
+ * 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_CMSLISTENER_H_
+#define _ACTIVEMQ_UTIL_CMSLISTENER_H_
+
+#include <cms/Session.h>
+#include <cms/MessageListener.h>
+#include <cms/ExceptionListener.h>
+
+#include <decaf/util/concurrent/Mutex.h>
+
+namespace activemq {
+namespace util {
+
+    class CMSListener : public cms::MessageListener,
+                        public cms::ExceptionListener {
+    private:
+
+        unsigned int numReceived;
+        decaf::util::concurrent::Mutex mutex;
+        cms::Session* session;
+
+    public:
+
+        CMSListener( cms::Session* session );
+        virtual ~CMSListener();
+
+        unsigned int getNumReceived() const {
+            return this->numReceived;
+        }
+
+        virtual void reset();
+
+        virtual void asyncWaitForMessages( unsigned int count );
+
+        virtual void onException( const cms::CMSException& error );
+        virtual void onMessage( const cms::Message* message );
+
+    };
+
+}}
+
+#endif /* _ACTIVEMQ_UTIL_CMSLISTENER_H_ */

Propchange: activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSListener.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSProvider.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSProvider.cpp?rev=723374&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSProvider.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSProvider.cpp Thu Dec  4 08:56:21 2008
@@ -0,0 +1,341 @@
+/*
+ * 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 "CMSProvider.h"
+
+#include <cms/ConnectionFactory.h>
+
+#include <activemq/exceptions/ActiveMQException.h>
+
+#include <decaf/util/UUID.h>
+#include <decaf/lang/exceptions/IllegalStateException.h>
+
+using namespace std;
+using namespace cms;
+using namespace activemq;
+using namespace activemq::util;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+CMSProvider::CMSProvider( const std::string& brokerURL,
+                          cms::Session::AcknowledgeMode ackMode )
+: brokerURL( brokerURL ), ackMode( ackMode ) {
+
+    this->topic = true;
+    this->destinationName = UUID::randomUUID().toString();
+    this->durable = false;
+    this->subscription = UUID::randomUUID().toString();
+
+    this->initialize( brokerURL );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CMSProvider::~CMSProvider() {
+    try{
+        close();
+    }
+    DECAF_CATCH_NOTHROW( decaf::lang::Exception )
+    DECAF_CATCHALL_NOTHROW()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSProvider::close() throw( decaf::lang::Exception ) {
+
+    this->consumer.reset( NULL );
+    this->producer.reset( NULL );
+    this->noDestProducer.reset( NULL );
+    this->destination.reset( NULL );
+    this->tempDestination.reset( NULL );
+    this->session.reset( NULL );
+    this->connection.reset( NULL );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSProvider::initialize( const std::string& username,
+                              const std::string& password,
+                              const std::string& clientId ) {
+
+    try {
+
+        this->username = username;
+        this->password = password;
+        this->clientId = clientId;
+
+        if( this->clientId == "" ) {
+            this->clientId = UUID::randomUUID().toString();
+        }
+
+        this->connectionFactory.reset(
+            cms::ConnectionFactory::createCMSConnectionFactory( this->brokerURL ) );
+
+        // Force a connect
+        reconnect();
+
+        // Force a new session to be created.
+        reconnectSession();
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSProvider::reconnect() {
+
+    try{
+
+        // Close everything first
+        this->close();
+
+        // Now create the connection
+        this->connection.reset( getConnectionFactory()->createConnection(
+            username, password, this->clientId ) );
+        this->connection->start();
+
+        if( this->session.get() != NULL ) {
+            reconnectSession();
+        }
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSProvider::reconnectSession() {
+
+    try{
+
+        if( this->connection.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        // Free any previously held resources.
+        this->destination.reset( NULL );
+        this->tempDestination.reset( NULL );
+        this->consumer.reset( NULL );
+        this->producer.reset( NULL );
+        this->noDestProducer.reset( NULL );
+
+        // Create a new session, if there was one here before it will be
+        // destroyed.
+        this->session.reset( this->connection->createSession( this->ackMode ) );
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSProvider::unsubscribe() {
+
+    try {
+        if( this->connection.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        if( this->consumer.get() && this->durable && this->topic ) {
+
+            if( this->brokerURL.find_first_of( "stomp", 0 ) == string::npos ) {
+                this->consumer->close();
+                this->session->unsubscribe( this->subscription );
+            }
+        }
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::ConnectionFactory* CMSProvider::getConnectionFactory() {
+    try {
+
+        if( this->connectionFactory.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        return this->connectionFactory.get();
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::Connection* CMSProvider::getConnection() {
+
+    try {
+
+        if( this->connection.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        return this->connection.get();
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::Session* CMSProvider::getSession() {
+
+    try {
+
+        if( this->connection.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        return this->session.get();
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::MessageProducer* CMSProvider::getProducer() {
+
+    try {
+
+        if( this->connection.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        if( this->producer.get() == NULL ) {
+            this->producer.reset(
+                this->getSession()->createProducer( this->getDestination() ) );
+        }
+
+        return this->producer.get();
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::MessageProducer* CMSProvider::getNoDestProducer() {
+
+    try {
+
+        if( this->connection.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        if( this->noDestProducer.get() == NULL ) {
+            this->noDestProducer.reset(
+                this->getSession()->createProducer( NULL ) );
+        }
+
+        return this->noDestProducer.get();
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::MessageConsumer* CMSProvider::getConsumer() {
+
+    try {
+
+        if( this->connection.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        if( this->consumer.get() == NULL ) {
+            if( this->durable && this->topic ) {
+               this->consumer.reset(
+                   this->getSession()->createDurableConsumer(
+                      dynamic_cast<cms::Topic*>( this->getDestination() ),
+                      this->subscription, "" ) );
+            } else {
+                this->consumer.reset(
+                    this->getSession()->createConsumer( this->getDestination() ) );
+            }
+        }
+
+        return this->consumer.get();
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::Destination* CMSProvider::getDestination() {
+
+    try {
+
+        if( this->connection.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        if( this->destination.get() == NULL ) {
+            if( this->topic == true ) {
+                this->destination.reset(
+                    this->getSession()->createTopic( this->getDestinationName() ) );
+            } else {
+                this->destination.reset(
+                    this->getSession()->createQueue( this->getDestinationName() ) );
+            }
+        }
+
+        return this->destination.get();
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::Destination* CMSProvider::getTempDestination() {
+
+    try {
+
+        if( this->connection.get() == NULL ) {
+            throw decaf::lang::exceptions::IllegalStateException(
+                __FILE__, __LINE__,
+                "CMSProvider has not been Initialized or is closed." );
+        }
+
+        if( this->tempDestination.get() == NULL ) {
+            if( this->topic == true ) {
+                this->tempDestination.reset(
+                    this->getSession()->createTemporaryTopic() );
+            } else {
+                this->tempDestination.reset(
+                    this->getSession()->createTemporaryQueue() );
+            }
+        }
+
+        return this->tempDestination.get();
+    }
+    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+}

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

Added: activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSProvider.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSProvider.h?rev=723374&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSProvider.h (added)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSProvider.h Thu Dec  4 08:56:21 2008
@@ -0,0 +1,192 @@
+/*
+ * 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_CMSPROVIDER_H_
+#define _ACTIVEMQ_UTIL_CMSPROVIDER_H_
+
+#include <string>
+#include <memory>
+
+#include <cms/ConnectionFactory.h>
+#include <cms/Connection.h>
+#include <cms/MessageConsumer.h>
+#include <cms/MessageProducer.h>
+#include <cms/MessageListener.h>
+#include <cms/Session.h>
+#include <cms/Destination.h>
+
+#include <decaf/io/Closeable.h>
+
+namespace activemq {
+namespace util {
+
+    class CMSProvider : decaf::io::Closeable {
+    private:
+
+        std::string brokerURL;
+        cms::Session::AcknowledgeMode ackMode;
+        std::string username;
+        std::string password;
+        std::string clientId;
+
+        std::string destinationName;
+        bool topic;
+        bool durable;
+        std::string subscription;
+
+        std::auto_ptr<cms::ConnectionFactory> connectionFactory;
+        std::auto_ptr<cms::Connection> connection;
+        std::auto_ptr<cms::Session> session;
+        std::auto_ptr<cms::MessageConsumer> consumer;
+        std::auto_ptr<cms::MessageProducer> producer;
+        std::auto_ptr<cms::MessageProducer> noDestProducer;
+        std::auto_ptr<cms::Destination> destination;
+        std::auto_ptr<cms::Destination> tempDestination;
+
+    public:
+
+        CMSProvider( const std::string& brokerURL,
+                     cms::Session::AcknowledgeMode ackMode = cms::Session::AUTO_ACKNOWLEDGE );
+
+        virtual ~CMSProvider();
+
+        virtual void close() throw( decaf::lang::Exception );
+
+        std::string getBrokerURL() const {
+            return this->brokerURL;
+        }
+
+        void setBrokerURL( const std::string& brokerURL ) {
+            this->brokerURL = brokerURL;
+        }
+
+        void setDestinationName( const std::string name ) {
+            this->destinationName = name;
+        }
+
+        std::string getDestinationName() const {
+            return this->destinationName;
+        }
+
+        void setSubscription( const std::string name ) {
+            this->subscription = name;
+        }
+
+        std::string getSubscription() const {
+            return this->subscription;
+        }
+
+        void setTopic( bool value ) {
+            this->topic = value;
+        }
+
+        bool isTopic() const {
+            return this->topic;
+        }
+
+        void setDurable( bool value ) {
+            this->durable = value;
+        }
+
+        bool isDurable() const {
+            return this->durable;
+        }
+
+        void setAckMode( cms::Session::AcknowledgeMode ackMode ) {
+            this->ackMode = ackMode;
+        }
+
+        cms::Session::AcknowledgeMode getAckMode() const {
+            return this->ackMode;
+        }
+
+    public:
+
+        /**
+         * Initializes a CMSProvider with the Login data for the session that
+         * this provider is managing.  Once called a new Connection to the broker
+         * is made and will remain open until a reconnect is requested or until
+         * the CMSProvider instance is closed.
+         */
+        virtual void initialize( const std::string& username = "",
+                                 const std::string& password = "",
+                                 const std::string& clientId = "" );
+
+        /**
+         * Forces a reconnect of the Connection and then of the Session and its
+         * associated resources.
+         */
+        virtual void reconnect();
+
+        /**
+         * Forces a Recreation of a Session and any of its Resources.
+         */
+        virtual void reconnectSession();
+
+        /**
+         * Unsubscribes a durable consumer if one has been created and the chosen
+         * wireformat supports it.  The consumer is closed as a result any calls to
+         * it after calling this method will result in an error.
+         */
+        virtual void unsubscribe();
+
+        /**
+         * Returns the ConnectionFactory object that this Provider has allocated.
+         */
+        virtual cms::ConnectionFactory* getConnectionFactory();
+
+        /**
+         * Returns the Connection object that this Provider has allocated.
+         */
+        virtual cms::Connection* getConnection();
+
+        /**
+         * Returns the Session object that this Provider has allocated.
+         */
+        virtual cms::Session* getSession();
+
+        /**
+         * Returns the MessageConsumer object that this Provider has allocated.
+         */
+        virtual cms::MessageConsumer* getConsumer();
+
+        /**
+         * Returns the MessageProducer object that this Provider has allocated.
+         */
+        virtual cms::MessageProducer* getProducer();
+
+        /**
+         * Returns the MessageProducer object that this Provider has allocated that has
+         * no assigned Destination, message sent must be assigned one at send time.
+         */
+        virtual cms::MessageProducer* getNoDestProducer();
+
+        /**
+         * Returns the Destination object that this Provider has allocated.
+         */
+        virtual cms::Destination* getDestination();
+
+        /**
+         * Returns the Temporary Destination object that this Provider has allocated.
+         */
+        virtual cms::Destination* getTempDestination();
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_CMSPROVIDER_H_*/

Propchange: activemq/activemq-cpp/trunk/src/test-integration/activemq/util/CMSProvider.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/test-integration/activemq/util/IntegrationCommon.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/util/IntegrationCommon.cpp?rev=723374&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/util/IntegrationCommon.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/util/IntegrationCommon.cpp Thu Dec  4 08:56:21 2008
@@ -0,0 +1,41 @@
+/*
+ * 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 "IntegrationCommon.h"
+
+using namespace activemq;
+using namespace util;
+
+////////////////////////////////////////////////////////////////////////////////
+const int IntegrationCommon::defaultDelay = 5;
+const unsigned int IntegrationCommon::defaultMsgCount = 1000;
+bool IntegrationCommon::debug = false;
+
+////////////////////////////////////////////////////////////////////////////////
+IntegrationCommon::IntegrationCommon() {
+
+    this->urlCommon = "tcp://localhost:";
+    this->stompURL = this->urlCommon + "61613?wireFormat=stomp";
+    this->openwireURL = this->urlCommon + "61616?wireFormat=openwire";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+IntegrationCommon& IntegrationCommon::getInstance() {
+    static IntegrationCommon instance;
+
+    return instance;
+}

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

Added: activemq/activemq-cpp/trunk/src/test-integration/activemq/util/IntegrationCommon.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/util/IntegrationCommon.h?rev=723374&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/util/IntegrationCommon.h (added)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/util/IntegrationCommon.h Thu Dec  4 08:56:21 2008
@@ -0,0 +1,61 @@
+/*
+ * 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_INTEGRATIONCOMMON_H_
+#define _ACTIVEMQ_UTIL_INTEGRATIONCOMMON_H_
+
+#include <string>
+
+namespace activemq{
+namespace util{
+
+    class IntegrationCommon {
+    public:
+
+        virtual ~IntegrationCommon() {}
+
+        virtual std::string getStompURL() const {
+            return this->stompURL;
+        }
+
+        virtual std::string getOpenwireURL() const {
+            return this->openwireURL;
+        }
+
+    public:  // Statics
+
+        static const int defaultDelay;
+        static const unsigned int defaultMsgCount;
+        static bool debug;
+
+        static IntegrationCommon& getInstance();
+
+    protected:
+
+        IntegrationCommon();
+
+    private:
+
+        std::string urlCommon;
+        std::string stompURL;
+        std::string openwireURL;
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_INTEGRATIONCOMMON_H_*/

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