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 2009/03/16 19:44:12 UTC
svn commit: r754975 - in /activemq/activemq-cpp/trunk/src/test: ./
activemq/state/
Author: tabish
Date: Mon Mar 16 18:44:12 2009
New Revision: 754975
URL: http://svn.apache.org/viewvc?rev=754975&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-100
Adding in unit tests for the State Tracker to try and help find some bugs and make platform testing easier.
Added:
activemq/activemq-cpp/trunk/src/test/activemq/state/
activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.cpp (with props)
activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.h (with props)
activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.cpp (with props)
activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.h (with props)
activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.cpp (with props)
activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.h (with props)
Modified:
activemq/activemq-cpp/trunk/src/test/Makefile.am
activemq/activemq-cpp/trunk/src/test/testRegistry.cpp
Modified: activemq/activemq-cpp/trunk/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/Makefile.am?rev=754975&r1=754974&r2=754975&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/test/Makefile.am Mon Mar 16 18:44:12 2009
@@ -36,6 +36,9 @@
activemq/cmsutil/SessionPoolTest.cpp \
activemq/cmsutil/CmsTemplateTest.cpp \
activemq/exceptions/ActiveMQExceptionTest.cpp \
+ activemq/state/ConsumerStateTest.cpp \
+ activemq/state/TransactionStateTest.cpp \
+ activemq/state/ProducerStateTest.cpp \
activemq/transport/TransportRegistryTest.cpp \
activemq/transport/IOTransportTest.cpp \
activemq/transport/correlator/ResponseCorrelatorTest.cpp \
@@ -137,6 +140,9 @@
activemq/cmsutil/SessionPoolTest.h \
activemq/cmsutil/CmsTemplateTest.h \
activemq/exceptions/ActiveMQExceptionTest.h \
+ activemq/state/ConsumerStateTest.h \
+ activemq/state/ProducerStateTest.h \
+ activemq/state/TransactionStateTest.h \
activemq/transport/TransportRegistryTest.h \
activemq/transport/IOTransportTest.h \
activemq/transport/correlator/ResponseCorrelatorTest.h \
Added: activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.cpp?rev=754975&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.cpp Mon Mar 16 18:44:12 2009
@@ -0,0 +1,38 @@
+/*
+ * 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 "ConsumerStateTest.h"
+
+#include <activemq/state/ConsumerState.h>
+#include <activemq/commands/ConsumerInfo.h>
+#include <decaf/lang/Pointer.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::state;
+using namespace activemq::commands;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+void ConsumerStateTest::test() {
+
+ Pointer<ConsumerInfo> info( new ConsumerInfo() );
+ ConsumerState state( info );
+
+ CPPUNIT_ASSERT( state.toString() != "NULL" );
+ CPPUNIT_ASSERT( info == state.getInfo() );
+}
Propchange: activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.h?rev=754975&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.h Mon Mar 16 18:44:12 2009
@@ -0,0 +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 _ACTIVEMQ_STATE_CONSUMERSTATETEST_H_
+#define _ACTIVEMQ_STATE_CONSUMERSTATETEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace activemq {
+namespace state {
+
+ class ConsumerStateTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( ConsumerStateTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ ConsumerStateTest() {}
+ virtual ~ConsumerStateTest() {}
+
+ void test();
+
+ };
+
+}}
+
+#endif /* _ACTIVEMQ_STATE_CONSUMERSTATETEST_H_ */
Propchange: activemq/activemq-cpp/trunk/src/test/activemq/state/ConsumerStateTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.cpp?rev=754975&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.cpp Mon Mar 16 18:44:12 2009
@@ -0,0 +1,38 @@
+/*
+ * 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 "ProducerStateTest.h"
+
+#include <activemq/state/ProducerState.h>
+#include <activemq/commands/ProducerInfo.h>
+#include <decaf/lang/Pointer.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::state;
+using namespace activemq::commands;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+void ProducerStateTest::test() {
+ Pointer<ProducerInfo> info( new ProducerInfo() );
+ ProducerState state( info );
+
+ CPPUNIT_ASSERT( state.toString() != "NULL" );
+ CPPUNIT_ASSERT( info == state.getInfo() );
+}
+
Propchange: activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.h?rev=754975&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.h Mon Mar 16 18:44:12 2009
@@ -0,0 +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 _ACTIVEMQ_STATE_PRODUCERSTATETEST_H_
+#define _ACTIVEMQ_STATE_PRODUCERSTATETEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace activemq {
+namespace state {
+
+ class ProducerStateTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( ProducerStateTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ ProducerStateTest() {}
+ virtual ~ProducerStateTest() {}
+
+ void test();
+
+ };
+
+}}
+
+#endif /* _ACTIVEMQ_STATE_PRODUCERSTATETEST_H_ */
Propchange: activemq/activemq-cpp/trunk/src/test/activemq/state/ProducerStateTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.cpp?rev=754975&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.cpp Mon Mar 16 18:44:12 2009
@@ -0,0 +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.
+ */
+
+#include "TransactionStateTest.h"
+
+#include <activemq/state/TransactionState.h>
+#include <activemq/commands/TransactionInfo.h>
+#include <activemq/commands/LocalTransactionId.h>
+#include <decaf/lang/Pointer.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::state;
+using namespace activemq::commands;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+void TransactionStateTest::test() {
+
+ Pointer<LocalTransactionId> id( new LocalTransactionId() );
+ id->setValue( 42 );
+ TransactionState state( id );
+
+ CPPUNIT_ASSERT( state.toString() != "NULL" );
+ CPPUNIT_ASSERT( state.getId() != NULL );
+
+ Pointer<LocalTransactionId> temp;
+ CPPUNIT_ASSERT_NO_THROW( temp = state.getId().dynamicCast<LocalTransactionId>() );
+ CPPUNIT_ASSERT( temp->getValue() == id->getValue() );
+}
Propchange: activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.h?rev=754975&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.h Mon Mar 16 18:44:12 2009
@@ -0,0 +1,43 @@
+/*
+ * 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_STATE_TRANSACTIONSTATETEST_H_
+#define _ACTIVEMQ_STATE_TRANSACTIONSTATETEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace activemq {
+namespace state {
+
+ class TransactionStateTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( TransactionStateTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ TransactionStateTest() {}
+ virtual ~TransactionStateTest() {}
+
+ void test();
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_TRANSACTIONSTATETEST_H_*/
Propchange: activemq/activemq-cpp/trunk/src/test/activemq/state/TransactionStateTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/src/test/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/testRegistry.cpp?rev=754975&r1=754974&r2=754975&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/testRegistry.cpp Mon Mar 16 18:44:12 2009
@@ -76,6 +76,13 @@
//#include <activemq/core/ActiveMQSessionTest.h>
//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQSessionTest );
//
+#include <activemq/state/ConsumerStateTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::state::ConsumerStateTest );
+#include <activemq/state/ProducerStateTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::state::ProducerStateTest );
+#include <activemq/state/TransactionStateTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::state::TransactionStateTest );
+
#include <activemq/transport/failover/FailoverTransportTest.h>
CPPUNIT_TEST_SUITE_REGISTRATION( activemq::transport::failover::FailoverTransportTest );
//