Added: activemq/activemq-cpp/trunk/src/test/decaf/util/StringTokenizerTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/StringTokenizerTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/StringTokenizerTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/StringTokenizerTest.h Tue Apr 29 13:52:30 2008
@@ -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 _DECAF_UTIL_STRINGTOKENIZERTEST_H_
+#define _DECAF_UTIL_STRINGTOKENIZERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf{
+namespace util{
+
+ class StringTokenizerTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( StringTokenizerTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ virtual ~StringTokenizerTest() {}
+
+ void test();
+
+ };
+
+}}
+
+#endif /*_DECAF_UTIL_STRINGTOKENIZERTEST_H_*/
Added: activemq/activemq-cpp/trunk/src/test/decaf/util/UUIDTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/UUIDTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/UUIDTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/UUIDTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +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.
+ */
+
+#include "UUIDTest.h"
+
+#include <decaf/util/UUID.h>
+
+using namespace decaf;
+using namespace decaf::util;
+
+////////////////////////////////////////////////////////////////////////////////
+UUIDTest::UUIDTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void UUIDTest::test() {
+
+ std::string bytes = "ASDASFSADGSDGSDASFA";
+
+ UUID randId = UUID::randomUUID();
+ UUID bytesId = UUID::nameUUIDFromBytes( bytes.c_str(), bytes.size() );
+
+ CPPUNIT_ASSERT( !( randId == bytesId ) );
+ CPPUNIT_ASSERT( !( randId.equals( bytesId ) ) );
+ CPPUNIT_ASSERT( randId.compareTo( bytesId ) != 0 );
+
+ std::string uuidStr = randId.toString();
+ UUID strId = UUID::fromString( uuidStr );
+
+ CPPUNIT_ASSERT( randId == strId );
+ CPPUNIT_ASSERT( randId.variant() == 2 );
+
+ UUID fromBits( randId.getMostSignificantBits(),
+ randId.getLeastSignificantBits() );
+
+ CPPUNIT_ASSERT( randId.compareTo( fromBits) == 0 );
+}
Added: activemq/activemq-cpp/trunk/src/test/decaf/util/UUIDTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/UUIDTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/UUIDTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/UUIDTest.h Tue Apr 29 13:52:30 2008
@@ -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 _DECAF_UTIL_UUIDTEST_H_
+#define _DECAF_UTIL_UUIDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf{
+namespace util{
+
+ class UUIDTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( UUIDTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ UUIDTest();
+ virtual ~UUIDTest() {}
+
+ virtual void test();
+
+ };
+
+}}
+
+#endif /*_DECAF_UTIL_UUIDTEST_H_*/
Added: activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/CountDownLatchTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/CountDownLatchTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/CountDownLatchTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/CountDownLatchTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,64 @@
+/*
+ * 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 "CountDownLatchTest.h"
+
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+
+////////////////////////////////////////////////////////////////////////////////
+void CountDownLatchTest::test()
+{
+ CountDownLatch latch( 50 );
+
+ CPPUNIT_ASSERT( latch.getCount() == 50 );
+
+ MyThread thread;
+ thread.latch = &latch;
+ thread.start();
+
+ latch.await();
+
+ CPPUNIT_ASSERT( latch.getCount() == 0 );
+
+ thread.join();
+
+ CPPUNIT_ASSERT( true );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CountDownLatchTest::test2()
+{
+ CountDownLatch latch( 75 );
+
+ CPPUNIT_ASSERT( latch.getCount() == 75 );
+
+ MyThread thread;
+ thread.latch = &latch;
+ thread.start();
+
+ CPPUNIT_ASSERT( latch.await( 2 ) == false );
+
+ latch.await();
+
+ CPPUNIT_ASSERT( latch.getCount() == 0 );
+
+ thread.join();
+
+ CPPUNIT_ASSERT( true );
+}
Added: activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/CountDownLatchTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/CountDownLatchTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/CountDownLatchTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/CountDownLatchTest.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,73 @@
+/*
+ * 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 _DECAF_UTIL_CONCURRENT_COUNTDOWNLATCHTEST_H_
+#define _DECAF_UTIL_CONCURRENT_COUNTDOWNLATCHTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <decaf/lang/Thread.h>
+#include <decaf/util/concurrent/CountDownLatch.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+ class CountDownLatchTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( CountDownLatchTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST( test2 );
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+
+ class MyThread : public lang::Thread
+ {
+ public:
+
+ CountDownLatch* latch;
+
+ public:
+
+ MyThread(){}
+ virtual ~MyThread(){}
+
+ virtual void run(){
+
+ while( latch->getCount() > 0 ) {
+ latch->countDown();
+
+ lang::Thread::sleep( 20 );
+ }
+ }
+
+ };
+
+ public:
+
+ CountDownLatchTest() {}
+ virtual ~CountDownLatchTest() {}
+
+ virtual void test();
+ virtual void test2();
+ };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_COUNTDOWNLATCHTEST_H_*/
Added: activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/MutexTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/MutexTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/MutexTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/MutexTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,349 @@
+/*
+ * 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 "MutexTest.h"
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+
+///////////////////////////////////////////////////////////////////////////////
+void MutexTest::testTimedWait(){
+
+ try
+ {
+ MyTimedWaitingThread test;
+ time_t startTime = time( NULL );
+ test.start();
+ test.join();
+ time_t endTime = time( NULL );
+
+ time_t delta = endTime - startTime;
+
+ CPPUNIT_ASSERT( delta >= 1 && delta <= 3 );
+ }
+ catch(lang::Exception& ex)
+ {
+ std::cout << ex.getMessage() << std::endl;
+ }
+}
+
+void MutexTest::testWait(){
+
+ try
+ {
+ MyWaitingThread test;
+ test.start();
+
+ Thread::sleep( 1000 );
+
+ synchronized( &test )
+ {
+ for( int ix=0; ix<100; ix++ ){
+ test.value += 1;
+ }
+
+ test.notify();
+ }
+
+ test.join();
+
+ CPPUNIT_ASSERT( test.value == 2500 );
+ } catch( lang::Exception& ex ) {
+ ex.setMark( __FILE__, __LINE__ );
+ }
+}
+
+void MutexTest::test()
+{
+ MyThread test;
+
+ synchronized(&test){
+
+ test.start();
+
+ for( int ix=0; ix<100; ix++ ){
+ test.value += 1;
+ }
+ }
+
+ test.join();
+
+ CPPUNIT_ASSERT( test.value == 2500 );
+}
+
+void MutexTest::testNotify()
+{
+ try{
+ Mutex mutex;
+ Mutex started;
+ Mutex completed;
+
+ const int numThreads = 30;
+ MyNotifiedThread* threads[numThreads];
+
+ // Create and start all the threads.
+ for( int ix=0; ix<numThreads; ++ix ){
+ threads[ix] = new MyNotifiedThread( &mutex, &started, &completed );
+ threads[ix]->start();
+ }
+
+ synchronized( &started )
+ {
+ int count = 0;
+
+ while( count < ( numThreads ) )
+ {
+ started.wait( 30 );
+ count++;
+ }
+ }
+
+ synchronized(&mutex)
+ {
+ mutex.notify();
+ }
+
+ Thread::sleep( 1000 );
+
+ int counter = 0;
+ for( int ix=0; ix<numThreads; ++ix ){
+ if( threads[ix]->done ){
+ counter++;
+ }
+ }
+
+ // Make sure only 1 thread was notified.
+ CPPUNIT_ASSERT( counter == 1 );
+
+ synchronized(&mutex)
+ {
+ // Notify all threads.
+ for( int ix=0; ix<numThreads-1; ++ix ){
+ mutex.notify();
+ }
+ }
+
+ synchronized( &started )
+ {
+ int count = 0;
+
+ while( count < ( numThreads ) )
+ {
+ started.wait( 30 );
+ count++;
+ }
+ }
+
+ int numComplete = 0;
+ for( int ix=0; ix<numThreads; ++ix ){
+ if( threads[ix]->done ){
+ numComplete++;
+ }
+ }
+ CPPUNIT_ASSERT( numComplete == numThreads );
+
+ synchronized( &mutex )
+ {
+ mutex.wait( 5 );
+ }
+
+ synchronized( &mutex )
+ {
+ mutex.notifyAll();
+ }
+
+ // Delete all the threads.
+ for( int ix=0; ix<numThreads; ++ix ){
+ delete threads[ix];
+ }
+
+ }catch( lang::Exception& ex ){
+ ex.setMark( __FILE__, __LINE__ );
+ }
+}
+
+void MutexTest::testNotifyAll()
+{
+ try{
+ Mutex mutex;
+ Mutex started;
+ Mutex completed;
+
+ const int numThreads = 100;
+ MyNotifiedThread* threads[numThreads];
+
+ // Create and start all the threads.
+ for( int ix=0; ix<numThreads; ++ix ){
+ threads[ix] = new MyNotifiedThread( &mutex, &started, &completed );
+ threads[ix]->start();
+ }
+
+ synchronized( &started )
+ {
+ int count = 0;
+
+ while( count < ( numThreads ) )
+ {
+ started.wait( 30 );
+ count++;
+ }
+ }
+
+ for( int ix=0; ix<numThreads; ++ix )
+ {
+ if( threads[ix]->done == true ){
+ printf("threads[%d] is done prematurely\n", ix );
+ }
+ CPPUNIT_ASSERT( threads[ix]->done == false );
+ }
+
+ // Notify all threads.
+ synchronized( &mutex ){
+ mutex.notifyAll();
+ }
+
+ synchronized( &completed )
+ {
+ int count = 0;
+
+ while( count < ( numThreads ) )
+ {
+ completed.wait( 30 );
+ count++;
+ }
+ }
+
+ int numComplete = 0;
+ for( int ix=0; ix<numThreads; ++ix ){
+ if( threads[ix]->done ){
+ numComplete++;
+ }
+ }
+ //printf("numComplete: %d, numThreads: %d\n", numComplete, numThreads );
+ CPPUNIT_ASSERT( numComplete == numThreads );
+
+ // Delete all the threads.
+ for( int ix=0; ix<numThreads; ++ix ){
+ threads[ix]->join();
+ delete threads[ix];
+ }
+
+ }catch( lang::Exception& ex ){
+ ex.setMark( __FILE__, __LINE__ );
+ }
+}
+
+void MutexTest::testRecursiveLock()
+{
+ try{
+ Mutex mutex;
+
+ const int numThreads = 30;
+ MyRecursiveLockThread* threads[numThreads];
+
+ // Create and start all the threads.
+ for( int ix=0; ix<numThreads; ++ix ){
+ threads[ix] = new MyRecursiveLockThread( &mutex );
+ threads[ix]->start();
+ }
+
+ // Sleep so all the threads can get to the wait.
+ Thread::sleep( 1000 );
+
+ for( int ix=0; ix<numThreads; ++ix ){
+ if( threads[ix]->done == true ){
+ std::cout << "threads[" << ix
+ << "] is done prematurely\n";
+ }
+ CPPUNIT_ASSERT( threads[ix]->done == false );
+ }
+
+ // Notify all threads.
+ synchronized( &mutex )
+ {
+ synchronized( &mutex )
+ {
+ mutex.notifyAll();
+ }
+ }
+
+ // Sleep to give the threads time to wake up.
+ Thread::sleep( 1000 );
+
+ for( int ix=0; ix<numThreads; ++ix ){
+ if( threads[ix]->done != true ){
+ std::cout<< "threads[" << ix << "] is not done\n";
+ }
+ CPPUNIT_ASSERT( threads[ix]->done == true );
+ }
+
+ // Delete all the threads.
+ for( int ix=0; ix<numThreads; ++ix ){
+ delete threads[ix];
+ }
+
+ }catch( lang::Exception& ex ){
+ ex.setMark( __FILE__, __LINE__ );
+ }
+}
+
+void MutexTest::testDoubleLock()
+{
+ try{
+ Mutex mutex1;
+ Mutex mutex2;
+
+ MyDoubleLockThread thread(&mutex1, &mutex2);
+
+ thread.start();
+
+ // Let the thread get both locks
+ Thread::sleep( 200 );
+
+ // Lock mutex 2, thread is waiting on it
+ synchronized(&mutex2)
+ {
+ mutex2.notify();
+ }
+
+ // Let the thread die
+ thread.join();
+
+ CPPUNIT_ASSERT( thread.done );
+ }catch( lang::Exception& ex ){
+ ex.setMark( __FILE__, __LINE__ );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void MutexTest::testStressMutex(){
+ MyStoppableThread tester;
+
+ tester.start();
+
+ CPPUNIT_ASSERT( tester.isStarted() );
+
+ for( int i = 0; i < 100; ++i ) {
+ tester.stop();
+ tester.start();
+ }
+
+ CPPUNIT_ASSERT( true );
+}
Added: activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/MutexTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/MutexTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/MutexTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/MutexTest.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,493 @@
+/*
+ * 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 _DECAF_UTIL_CONCURRENT_MUTEXTEST_H_
+#define _DECAF_UTIL_CONCURRENT_MUTEXTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <decaf/lang/Thread.h>
+#include <decaf/lang/Runnable.h>
+#include <decaf/util/concurrent/Concurrent.h>
+#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/util/Random.h>
+#include <time.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+ class MutexTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( MutexTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST( testWait );
+ CPPUNIT_TEST( testTimedWait );
+ CPPUNIT_TEST( testNotify );
+ CPPUNIT_TEST( testNotifyAll );
+ CPPUNIT_TEST( testRecursiveLock );
+ CPPUNIT_TEST( testDoubleLock );
+ CPPUNIT_TEST( testStressMutex );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ class MyThread
+ :
+ public lang::Thread,
+ public Synchronizable{
+
+ private:
+
+ Mutex mutex;
+
+ public:
+
+ int value;
+ MyThread(){ value = 0;}
+ virtual ~MyThread(){}
+
+ virtual void lock() throw(lang::Exception){
+ mutex.lock();
+ }
+ virtual void unlock() throw(lang::Exception){
+ mutex.unlock();
+ }
+ virtual void wait() throw(lang::Exception){
+ mutex.wait();
+ }
+ virtual void wait(unsigned long millisecs) throw(lang::Exception){
+ mutex.wait( millisecs );
+ }
+ virtual void notify() throw(lang::Exception){
+ mutex.notify();
+ }
+ virtual void notifyAll() throw(lang::Exception){
+ mutex.notifyAll();
+ }
+
+ virtual void run(){
+
+ {
+ Lock lock (this);
+
+ value = value * 25;
+ }
+ }
+
+ };
+
+ class MyWaitingThread
+ :
+ public lang::Thread,
+ public Synchronizable{
+
+ private:
+
+ Mutex mutex;
+
+ public:
+
+ int value;
+ MyWaitingThread(){ value = 0;}
+ virtual ~MyWaitingThread(){}
+ virtual void lock() throw(lang::Exception){
+ mutex.lock();
+ }
+ virtual void unlock() throw(lang::Exception){
+ mutex.unlock();
+ }
+ virtual void wait() throw(lang::Exception){
+ mutex.wait();
+ }
+ virtual void wait(unsigned long millisecs) throw(lang::Exception){
+ mutex.wait( millisecs );
+ }
+ virtual void notify() throw(lang::Exception){
+ mutex.notify();
+ }
+ virtual void notifyAll() throw(lang::Exception){
+ mutex.notifyAll();
+ }
+
+ virtual void run(){
+
+ try
+ {
+ synchronized(this)
+ {
+ this->wait();
+
+ std::cout.flush();
+
+ value = value * 25;
+ }
+ }
+ catch(lang::Exception& ex)
+ {
+ ex.setMark( __FILE__, __LINE__ );
+ }
+ }
+ };
+
+ class MyTimedWaitingThread
+ :
+ public lang::Thread,
+ public Synchronizable{
+
+ private:
+
+ Mutex mutex;
+
+ public:
+
+ int value;
+ MyTimedWaitingThread(){ value = 0;}
+ virtual ~MyTimedWaitingThread(){}
+ virtual void lock() throw(lang::Exception){
+ mutex.lock();
+ }
+ virtual void unlock() throw(lang::Exception){
+ mutex.unlock();
+ }
+ virtual void wait() throw(lang::Exception){
+ mutex.wait();
+ }
+ virtual void wait(unsigned long millisecs) throw(lang::Exception){
+ mutex.wait( millisecs );
+ }
+ virtual void notify() throw(lang::Exception){
+ mutex.notify();
+ }
+ virtual void notifyAll() throw(lang::Exception){
+ mutex.notifyAll();
+ }
+
+ virtual void run(){
+
+ try
+ {
+ synchronized(this)
+ {
+ this->wait(2000);
+
+ value = 666;
+ }
+ }
+ catch(lang::Exception& ex)
+ {
+ ex.setMark( __FILE__, __LINE__ );
+ }
+ }
+ };
+
+ class MyNotifiedThread
+ :
+ public lang::Thread,
+ public Synchronizable{
+
+ public:
+
+ bool done;
+ Mutex* mutex;
+ Mutex* started;
+ Mutex* completed;
+
+ public:
+
+ int value;
+ MyNotifiedThread(Mutex* mutex, Mutex* started, Mutex* completed ){
+ this->mutex = mutex;
+ this->started = started;
+ this->completed = completed;
+ this->done = false;
+ }
+ virtual ~MyNotifiedThread(){}
+ virtual void lock() throw(lang::Exception){
+ mutex->lock();
+ }
+ virtual void unlock() throw(lang::Exception){
+ mutex->unlock();
+ }
+ virtual void wait() throw(lang::Exception){
+ mutex->wait();
+ }
+ virtual void wait(unsigned long millisecs) throw(lang::Exception){
+ mutex->wait( millisecs );
+ }
+ virtual void notify() throw(lang::Exception){
+ mutex->notify();
+ }
+ virtual void notifyAll() throw(lang::Exception){
+ mutex->notifyAll();
+ }
+
+ virtual void run(){
+
+ try
+ {
+ done = false;
+ synchronized(this)
+ {
+ synchronized( started )
+ {
+ started->notify();
+ }
+
+ this->wait();
+ done = true;
+
+ synchronized( completed )
+ {
+ completed->notify();
+ }
+ }
+ }
+ catch(lang::Exception& ex)
+ {
+ ex.setMark( __FILE__, __LINE__ );
+ }
+ }
+ };
+
+ class MyRecursiveLockThread
+ :
+ public lang::Thread,
+ public Synchronizable{
+
+ public:
+
+ bool done;
+ Mutex* mutex;
+
+ public:
+
+ int value;
+ MyRecursiveLockThread(Mutex* mutex){ this->mutex = mutex; done = false; }
+ virtual ~MyRecursiveLockThread(){}
+ virtual void lock() throw(lang::Exception){
+ mutex->lock();
+ }
+ virtual void unlock() throw(lang::Exception){
+ mutex->unlock();
+ }
+ virtual void wait() throw(lang::Exception){
+ mutex->wait();
+ }
+ virtual void wait(unsigned long millisecs) throw(lang::Exception){
+ mutex->wait( millisecs );
+ }
+ virtual void notify() throw(lang::Exception){
+ mutex->notify();
+ }
+ virtual void notifyAll() throw(lang::Exception){
+ mutex->notifyAll();
+ }
+
+ virtual void run(){
+
+ try
+ {
+ done = false;
+ synchronized(this)
+ {
+ synchronized(this)
+ {
+ this->wait();
+ done = true;
+ }
+ }
+ }
+ catch(lang::Exception& ex)
+ {
+ ex.setMark( __FILE__, __LINE__ );
+ }
+ }
+ };
+
+ class MyDoubleLockThread
+ :
+ public lang::Thread
+ {
+
+ public:
+
+ bool done;
+ Mutex* mutex1;
+ Mutex* mutex2;
+
+ public:
+
+ int value;
+ MyDoubleLockThread(Mutex* mutex1, Mutex* mutex2)
+ {
+ this->mutex1 = mutex1;
+ this->mutex2 = mutex2;
+ done = false;
+ }
+
+ virtual ~MyDoubleLockThread(){}
+
+ virtual void run(){
+
+ try
+ {
+ done = false;
+ synchronized(mutex1)
+ {
+ synchronized(mutex2)
+ {
+ mutex2->wait();
+ done = true;
+ }
+ }
+ }
+ catch(lang::Exception& ex)
+ {
+ ex.setMark( __FILE__, __LINE__ );
+ }
+ }
+ };
+
+ class MyStoppableThread : public lang::Runnable
+ {
+ public:
+
+ bool started;
+ bool closed;
+ Mutex mutex;
+ lang::Thread* thread;
+ util::Random rand;
+
+ public:
+
+ MyStoppableThread() {
+ this->started = false;
+ this->closed = false;
+ this->thread = NULL;
+ }
+
+ virtual ~MyStoppableThread(){ close(); }
+
+ virtual void start(){
+ synchronized( &mutex ) {
+
+ if( closed || started ) {
+ return;
+ }
+
+ started = true;
+
+ // Don't create the thread unless we need to.
+ if( thread == NULL ) {
+ thread = new lang::Thread( this );
+ thread->start();
+ }
+
+ mutex.notifyAll();
+ }
+ }
+
+ virtual void stop() {
+ synchronized( &mutex ) {
+
+ if( closed || !started ) {
+ return;
+ }
+
+ // Set the state to stopped.
+ started = false;
+
+ // Wakeup the thread so that it can acknowledge the stop request.
+ mutex.notifyAll();
+
+ // Wait for the thread to notify us that it has acknowledged
+ // the stop request.
+ mutex.wait();
+ }
+ }
+
+ virtual void close() {
+ synchronized( &mutex ) {
+
+ closed = true;
+ mutex.notifyAll();
+ }
+
+ if( thread != NULL ) {
+ thread->join();
+ delete thread;
+ thread = NULL;
+ }
+ }
+
+ virtual bool isStarted() const {
+ return started;
+ }
+
+ virtual void run(){
+ try {
+
+ while( true ) {
+
+ lang::Thread::sleep( rand.nextInt( 100 ) );
+
+ synchronized( &mutex ) {
+
+ // If we're closing down, exit the thread.
+ if( closed ) {
+ return;
+ }
+
+ // When told to stop, the calling thread will wait for a
+ // responding notification, indicating that we have acknowledged
+ // the stop command.
+ if( !isStarted() ) {
+ mutex.notifyAll();
+
+ // Wait for more data or to be woken up.
+ mutex.wait();
+ }
+ }
+ }
+ } catch(...) {
+ CPPUNIT_ASSERT( false );
+ }
+ }
+ };
+
+ public:
+
+ virtual ~MutexTest(){}
+ virtual void setUp(){}
+ virtual void tearDown(){}
+
+ void testTimedWait();
+ void testWait();
+ void test();
+ void testNotify();
+ void testNotifyAll();
+ void testRecursiveLock();
+ void testDoubleLock();
+ void testStressMutex();
+
+ };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_MUTEXTEST_H_*/
Added: activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ThreadPoolTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ThreadPoolTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ThreadPoolTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ThreadPoolTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,149 @@
+/*
+ * 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 "ThreadPoolTest.h"
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+
+///////////////////////////////////////////////////////////////////////////////
+void ThreadPoolTest::test1()
+{
+ CountDownLatch myLatch( 3 );
+ this->latch = &myLatch;
+
+ MyTask task1( 1 );
+ MyTask task2( 2 );
+ MyTask task3( 3 );
+
+ this->complete = 0;
+ this->tasksToComplete = 3;
+
+ ThreadPool* pool = ThreadPool::getInstance();
+
+ pool->queueTask( ThreadPool::Task( &task1, this ) );
+ pool->queueTask( ThreadPool::Task( &task2, this ) );
+ pool->queueTask( ThreadPool::Task( &task3, this ) );
+
+ // Wait for them to finish, if we can't do this in 30 seconds then
+ // there's probably something really wrong.
+ myLatch.await( 30000 );
+
+ CPPUNIT_ASSERT( this->complete == this->tasksToComplete );
+
+ CPPUNIT_ASSERT( task1.value == 101 );
+ CPPUNIT_ASSERT( task2.value == 102 );
+ CPPUNIT_ASSERT( task3.value == 103 );
+
+ CPPUNIT_ASSERT( pool->getPoolSize() > 0 );
+ CPPUNIT_ASSERT( pool->getBacklog() == 0 );
+
+ CPPUNIT_ASSERT( pool->getMaxThreads() == ThreadPool::DEFAULT_MAX_POOL_SIZE );
+ CPPUNIT_ASSERT( pool->getBlockSize() == ThreadPool::DEFAULT_MAX_BLOCK_SIZE );
+
+ pool->setMaxThreads(50);
+ pool->setBlockSize(50);
+
+ CPPUNIT_ASSERT( pool->getMaxThreads() == 50 );
+ CPPUNIT_ASSERT( pool->getBlockSize() == 50 );
+
+ // Give it a little time to create all those threads.
+ for( int i = 0; i < 1000; ++i ) {
+ if( pool->getFreeThreadCount() == pool->getPoolSize() ) {
+ break;
+ }
+
+ Thread::sleep( 100 );
+ }
+
+ CPPUNIT_ASSERT( pool->getFreeThreadCount() == pool->getPoolSize() );
+ CPPUNIT_ASSERT( this->caughtEx == false );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ThreadPoolTest::test2() {
+
+ try
+ {
+ ThreadPool pool;
+ Mutex myMutex;
+
+ CPPUNIT_ASSERT( pool.getMaxThreads() == ThreadPool::DEFAULT_MAX_POOL_SIZE );
+ CPPUNIT_ASSERT( pool.getBlockSize() == ThreadPool::DEFAULT_MAX_BLOCK_SIZE );
+ pool.setMaxThreads(3);
+ pool.setBlockSize(1);
+ CPPUNIT_ASSERT( pool.getMaxThreads() == 3 );
+ CPPUNIT_ASSERT( pool.getBlockSize() == 1 );
+ CPPUNIT_ASSERT( pool.getPoolSize() == 0 );
+ pool.reserve( 4 );
+ CPPUNIT_ASSERT( pool.getPoolSize() == 3 );
+ CPPUNIT_ASSERT( pool.getFreeThreadCount() == 3 );
+
+ CountDownLatch startedLatch1(3); // First three should go right away
+ CountDownLatch startedLatch2(1); // The fourth one goes after others finish
+ CountDownLatch doneLatch(4); // All should be done when we are at the end.
+
+ this->latch = &doneLatch;
+
+ MyWaitingTask task1( &myMutex, &startedLatch1 );
+ MyWaitingTask task2( &myMutex, &startedLatch1 );
+ MyWaitingTask task3( &myMutex, &startedLatch1 );
+ MyWaitingTask task4( &myMutex, &startedLatch2 );
+
+ this->complete = 0;
+ this->tasksToComplete = 4;
+
+ pool.queueTask( ThreadPool::Task( &task1, this ) );
+ pool.queueTask( ThreadPool::Task( &task2, this ) );
+ pool.queueTask( ThreadPool::Task( &task3, this ) );
+ pool.queueTask( ThreadPool::Task( &task4, this ) );
+
+ // Wait 30 seconds, then we let it fail because something is
+ // probably very wrong.
+ startedLatch1.await( 30000 );
+
+ CPPUNIT_ASSERT( pool.getFreeThreadCount() == 0 );
+ CPPUNIT_ASSERT( pool.getBacklog() == 1 );
+
+ // Wake up the tasks.
+ synchronized(&myMutex) {
+ myMutex.notifyAll();
+ }
+
+ // Wait 30 seconds, then we let it fail because something is
+ // probably very wrong.
+ startedLatch2.await( 30000 );
+
+ // Wake up the last task.
+ synchronized(&myMutex) {
+ myMutex.notifyAll();
+ }
+
+ // Wait for them to finish, if it takes longer than 30 seconds
+ // something is not right.
+ doneLatch.await( 30000 );
+
+ CPPUNIT_ASSERT( this->complete == this->tasksToComplete );
+ CPPUNIT_ASSERT( this->caughtEx == false );
+ }
+ catch( lang::Exception& ex ) {
+ ex.setMark( __FILE__, __LINE__ );
+ }
+}
Added: activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ThreadPoolTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ThreadPoolTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ThreadPoolTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ThreadPoolTest.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,138 @@
+/*
+ * 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 _DECAF_UTIL_CONCURRENT_THREADPOOLTEST_H_
+#define _DECAF_UTIL_CONCURRENT_THREADPOOLTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <decaf/util/concurrent/CountDownLatch.h>
+#include <decaf/util/concurrent/Concurrent.h>
+#include <decaf/lang/Thread.h>
+#include <decaf/util/concurrent/ThreadPool.h>
+#include <decaf/util/concurrent/TaskListener.h>
+#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+ class ThreadPoolTest :
+ public CppUnit::TestFixture,
+ public TaskListener
+ {
+ CPPUNIT_TEST_SUITE( ThreadPoolTest );
+ CPPUNIT_TEST( test1 );
+ CPPUNIT_TEST( test2 );
+ CPPUNIT_TEST_SUITE_END();
+
+ int tasksToComplete;
+ int complete;
+ Mutex mutex;
+ bool caughtEx;
+ CountDownLatch* latch;
+
+ public:
+
+ ThreadPoolTest() {
+ complete = 0;
+ tasksToComplete = 0;
+ caughtEx = false;
+ latch = NULL;
+ }
+
+ virtual ~ThreadPoolTest() {}
+
+ virtual void onTaskComplete( lang::Runnable* task DECAF_UNUSED)
+ {
+ try{
+
+ complete++;
+
+ if( latch != NULL ) {
+ latch->countDown();
+ }
+ }catch( lang::Exception& ex ){
+ ex.setMark( __FILE__, __LINE__ );
+ }
+ }
+
+ virtual void onTaskException(
+ lang::Runnable* task DECAF_UNUSED,
+ lang::Exception& ex DECAF_UNUSED) {
+ caughtEx = true;
+ }
+
+ public:
+
+ class MyTask : public lang::Runnable
+ {
+ public:
+
+ int value;
+
+ MyTask( int x ) {
+ value = x;
+ }
+
+ virtual ~MyTask() {};
+
+ virtual void run(void) {
+ value += 100;
+ }
+ };
+
+ class MyWaitingTask : public lang::Runnable
+ {
+ public:
+
+ Mutex* mutex;
+ CountDownLatch* startedLatch;
+
+ MyWaitingTask( Mutex* mutex, CountDownLatch* startedLatch ) {
+ this->mutex = mutex;
+ this->startedLatch = startedLatch;
+ }
+
+ virtual ~MyWaitingTask() {};
+
+ virtual void run(void) {
+ try
+ {
+ synchronized(mutex) {
+ startedLatch->countDown();
+ mutex->wait();
+ }
+ }
+ catch( lang::Exception& ex ) {
+ ex.setMark( __FILE__, __LINE__ );
+ }
+ }
+ };
+
+ public:
+
+ virtual void test1();
+ virtual void test2();
+
+ };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_THREADPOOLTEST_H_*/
Added: activemq/activemq-cpp/trunk/src/test/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/testRegistry.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/testRegistry.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/testRegistry.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+// All CPP Unit tests are registered in here so we can disable them and
+// enable them easily in one place.
+
+#include <decaf/internal/util/ByteArrayAdapterTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::util::ByteArrayAdapterTest );
+#include <decaf/internal/nio/ByteArrayPerspectiveTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::ByteArrayPerspectiveTest );
+#include <decaf/internal/nio/ByteArrayBufferTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::ByteArrayBufferTest );
+#include <decaf/internal/nio/BufferFactoryTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::BufferFactoryTest );
+#include <decaf/internal/nio/CharArrayBufferTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::CharArrayBufferTest );
+#include <decaf/internal/nio/DoubleArrayBufferTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::DoubleArrayBufferTest );
+#include <decaf/internal/nio/FloatArrayBufferTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::FloatArrayBufferTest );
+#include <decaf/internal/nio/LongArrayBufferTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::LongArrayBufferTest );
+#include <decaf/internal/nio/IntArrayBufferTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::IntArrayBufferTest );
+#include <decaf/internal/nio/ShortArrayBufferTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::ShortArrayBufferTest );
+
+#include <decaf/nio/BufferTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::nio::BufferTest );
+
+#include <decaf/io/FilterInputStreamTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::FilterInputStreamTest );
+#include <decaf/io/FilterOutputStreamTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::FilterOutputStreamTest );
+#include <decaf/io/BufferedInputStreamTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::BufferedInputStreamTest );
+#include <decaf/io/BufferedOutputStreamTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::BufferedOutputStreamTest );
+#include <decaf/io/ByteArrayInputStreamTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::ByteArrayInputStreamTest );
+#include <decaf/io/ByteArrayOutputStreamTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::ByteArrayOutputStreamTest );
+#include <decaf/io/DataInputStreamTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::DataInputStreamTest );
+#include <decaf/io/DataOutputStreamTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::DataOutputStreamTest );
+
+#include <decaf/lang/MathTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::MathTest );
+#include <decaf/lang/ByteTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ByteTest );
+#include <decaf/lang/CharacterTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::CharacterTest );
+#include <decaf/lang/BooleanTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::BooleanTest );
+#include <decaf/lang/ShortTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ShortTest );
+#include <decaf/lang/IntegerTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::IntegerTest );
+#include <decaf/lang/LongTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::LongTest );
+#include <decaf/lang/FloatTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::FloatTest );
+#include <decaf/lang/DoubleTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::DoubleTest );
+#include <decaf/lang/ExceptionTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ExceptionTest );
+#include <decaf/lang/ThreadTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ThreadTest );
+#include <decaf/lang/SystemTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::SystemTest );
+
+#include <decaf/net/SocketFactoryTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::SocketFactoryTest );
+#include <decaf/net/SocketTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::SocketTest );
+#include <decaf/net/URITest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::URITest );
+#include <decaf/net/URISyntaxExceptionTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::URISyntaxExceptionTest );
+
+#include <decaf/util/concurrent/CountDownLatchTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::concurrent::CountDownLatchTest );
+#include <decaf/util/concurrent/MutexTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::concurrent::MutexTest );
+#include <decaf/util/concurrent/ThreadPoolTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::concurrent::ThreadPoolTest );
+
+#include <decaf/util/DateTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::DateTest );
+#include <decaf/util/UUIDTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::UUIDTest );
+#include <decaf/util/MapTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::MapTest );
+#include <decaf/util/QueueTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::QueueTest );
+#include <decaf/util/RandomTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::RandomTest );
+#include <decaf/util/SetTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::SetTest );
+#include <decaf/util/StringTokenizerTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::StringTokenizerTest );
|