Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 3084 invoked from network); 16 Mar 2009 18:44:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Mar 2009 18:44:34 -0000 Received: (qmail 79043 invoked by uid 500); 16 Mar 2009 18:44:34 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 79015 invoked by uid 500); 16 Mar 2009 18:44:34 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 79006 invoked by uid 99); 16 Mar 2009 18:44:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Mar 2009 11:44:34 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Mar 2009 18:44:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 405A6238899B; Mon, 16 Mar 2009 18:44:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r754975 - in /activemq/activemq-cpp/trunk/src/test: ./ activemq/state/ Date: Mon, 16 Mar 2009 18:44:12 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090316184413.405A6238899B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 +#include +#include + +using namespace std; +using namespace activemq; +using namespace activemq::state; +using namespace activemq::commands; +using namespace decaf::lang; + +//////////////////////////////////////////////////////////////////////////////// +void ConsumerStateTest::test() { + + Pointer 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 +#include + +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 +#include +#include + +using namespace std; +using namespace activemq; +using namespace activemq::state; +using namespace activemq::commands; +using namespace decaf::lang; + +//////////////////////////////////////////////////////////////////////////////// +void ProducerStateTest::test() { + Pointer 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 +#include + +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 +#include +#include +#include + +using namespace std; +using namespace activemq; +using namespace activemq::state; +using namespace activemq::commands; +using namespace decaf::lang; + +//////////////////////////////////////////////////////////////////////////////// +void TransactionStateTest::test() { + + Pointer id( new LocalTransactionId() ); + id->setValue( 42 ); + TransactionState state( id ); + + CPPUNIT_ASSERT( state.toString() != "NULL" ); + CPPUNIT_ASSERT( state.getId() != NULL ); + + Pointer temp; + CPPUNIT_ASSERT_NO_THROW( temp = state.getId().dynamicCast() ); + 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 +#include + +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 //CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQSessionTest ); // +#include +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::state::ConsumerStateTest ); +#include +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::state::ProducerStateTest ); +#include +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::state::TransactionStateTest ); + #include CPPUNIT_TEST_SUITE_REGISTRATION( activemq::transport::failover::FailoverTransportTest ); //