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 2010/12/17 00:18:06 UTC
svn commit: r1050221 [5/8] - in
/activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/cmsutil/
main/activemq/core/ main/activemq/state/ main/activemq/threads/
main/activemq/transport/ main/activemq/transport/failover/
main/activemq/util/ m...
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Future.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Future.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Future.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Future.h Thu Dec 16 23:18:02 2010
@@ -18,6 +18,8 @@
#ifndef _DECAF_UTIL_CONCURRENT_FUTURE_H_
#define _DECAF_UTIL_CONCURRENT_FUTURE_H_
+#include <decaf/util/concurrent/TimeUnit.h>
+
namespace decaf {
namespace util {
namespace concurrent {
@@ -59,13 +61,13 @@ namespace concurrent {
* @returns false if the task could not be canceled, typically because it has
* already completed normally; true otherwise
*/
- bool cancel( bool mayInterruptIfRunning ) = 0;
+ virtual bool cancel( bool mayInterruptIfRunning ) = 0;
/**
* Returns true if this task was canceled before it completed normally.
* @returns true if this task was canceled before it completed
*/
- bool isCancelled() const = 0;
+ virtual bool isCancelled() const = 0;
/**
* Returns true if this task completed. Completion may be due to normal termination,
@@ -73,7 +75,7 @@ namespace concurrent {
* true.
* @returns true if this task completed
*/
- bool isDone() const = 0;
+ virtual bool isDone() const = 0;
/**
* Waits if necessary for the computation to complete, and then retrieves its result.
@@ -82,7 +84,7 @@ namespace concurrent {
* @throws ExecutionException - if the computation threw an exception
* @throws InterruptedException - if the current thread was interrupted while waiting
*/
- V get() = 0;
+ virtual V get() = 0;
/**
* Waits if necessary for at most the given time for the computation to complete, and
@@ -95,7 +97,7 @@ namespace concurrent {
* @throws InterruptedException - if the current thread was interrupted while waiting
* @throws TimeoutException - if the wait timed out
*/
- V get( long long timeout, TimeUnit unit ) = 0;
+ virtual V get( long long timeout, const TimeUnit& unit ) = 0;
};
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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 "SynchronousQueue.h"
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h Thu Dec 16 23:18:02 2010
@@ -69,7 +69,7 @@ namespace concurrent {
virtual E next() {
- throw lang::exceptions::NoSuchElementException(
+ throw NoSuchElementException(
__FILE__, __LINE__,
"Cannot traverse a Synchronous Queue." );
}
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/TaskListener.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/TaskListener.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/TaskListener.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/TaskListener.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,29 @@
+/*
+ * 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 "TaskListener.h"
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+
+////////////////////////////////////////////////////////////////////////////////
+TaskListener::~TaskListener() {
+
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/TaskListener.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/TaskListener.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/TaskListener.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/TaskListener.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/TaskListener.h Thu Dec 16 23:18:02 2010
@@ -29,24 +29,29 @@ namespace concurrent{
{
public:
- virtual ~TaskListener() {}
+ virtual ~TaskListener();
/**
* Called when a queued task has completed, the task that
- * finished is passed along for user consumption
- * @param task Runnable Pointer to the task that finished
+ * finished is passed along for user consumption.
+ *
+ * @param task
+ * A Runnable Pointer to the task that finished.
*/
- virtual void onTaskComplete( lang::Runnable* task ) = 0;
+ virtual void onTaskComplete( decaf::lang::Runnable* task ) = 0;
/**
* Called when a queued task has thrown an exception while
* being run. The Callee should assume that this was an
- * unrecoverable exeption and that this task is now defunct.
- * @param task Runnable Pointer to the task
- * @param ex The ActiveMQException that was thrown.
+ * unrecoverable exception and that this task is now defunct.
+ *
+ * @param task
+ * A Runnable Pointer to the task.
+ * @param ex
+ * The ActiveMQException that was thrown.
*/
- virtual void onTaskException( lang::Runnable* task,
- lang::Exception& ex ) = 0;
+ virtual void onTaskException( decaf::lang::Runnable* task,
+ decaf::lang::Exception& ex ) = 0;
};
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadFactory.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadFactory.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadFactory.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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 "ThreadFactory.h"
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadFactory.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicRefCounter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicRefCounter.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicRefCounter.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicRefCounter.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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 "AtomicRefCounter.h"
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicRefCounter.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicReference.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicReference.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicReference.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicReference.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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 "AtomicReference.h"
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/atomic/AtomicReference.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DataFormatException.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DataFormatException.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DataFormatException.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DataFormatException.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,33 @@
+/*
+ * 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 "DataFormatException.h"
+
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::zip;
+
+////////////////////////////////////////////////////////////////////////////////
+DataFormatException::DataFormatException() throw() {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+DataFormatException::~DataFormatException() throw() {
+
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DataFormatException.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DataFormatException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DataFormatException.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DataFormatException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DataFormatException.h Thu Dec 16 23:18:02 2010
@@ -32,7 +32,7 @@ namespace zip{
/**
* Default Constructor
*/
- DataFormatException() throw() {}
+ DataFormatException() throw();
/**
* Copy Constructor
@@ -110,7 +110,7 @@ namespace zip{
return new DataFormatException( *this );
}
- virtual ~DataFormatException() throw() {}
+ virtual ~DataFormatException() throw();
};
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/ZipException.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/ZipException.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/ZipException.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/ZipException.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,33 @@
+/*
+ * 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 "ZipException.h"
+
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::zip;
+
+////////////////////////////////////////////////////////////////////////////////
+ZipException::ZipException() throw() {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ZipException::~ZipException() throw() {
+
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/ZipException.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/ZipException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/ZipException.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/ZipException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/ZipException.h Thu Dec 16 23:18:02 2010
@@ -35,7 +35,7 @@ namespace zip{
/**
* Default Constructor
*/
- ZipException() throw(){}
+ ZipException() throw();
/**
* Copy Constructor
@@ -115,7 +115,7 @@ namespace zip{
return new ZipException( *this );
}
- virtual ~ZipException() throw(){}
+ virtual ~ZipException() throw();
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am Thu Dec 16 23:18:02 2010
@@ -25,10 +25,12 @@ cc_sources = \
decaf/io/DataOutputStreamBenchmark.cpp \
decaf/lang/BooleanBenchmark.cpp \
decaf/lang/ThreadBenchmark.cpp \
+ decaf/util/LinkedListBenchmark.cpp \
decaf/util/MapBenchmark.cpp \
decaf/util/PropertiesBenchmark.cpp \
decaf/util/QueueBenchmark.cpp \
decaf/util/SetBenchmark.cpp \
+ decaf/util/StlListBenchmark.cpp \
main.cpp \
testRegistry.cpp
@@ -44,10 +46,12 @@ h_sources = \
decaf/io/DataOutputStreamBenchmark.h \
decaf/lang/BooleanBenchmark.h \
decaf/lang/ThreadBenchmark.h \
+ decaf/util/LinkedListBenchmark.h \
decaf/util/MapBenchmark.h \
decaf/util/PropertiesBenchmark.h \
decaf/util/QueueBenchmark.h \
- decaf/util/SetBenchmark.h
+ decaf/util/SetBenchmark.h \
+ decaf/util/StlListBenchmark.h
## Compile this as part of make check
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,100 @@
+/*
+ * 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 "LinkedListBenchmark.h"
+
+#include <decaf/lang/Integer.h>
+#include <decaf/util/Iterator.h>
+
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+LinkedListBenchmark::LinkedListBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+LinkedListBenchmark::~LinkedListBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListBenchmark::run(){
+
+ int numRuns = 500;
+ std::string test = "test";
+ std::string resultStr = "";
+ LinkedList<std::string> stringCopy;
+ LinkedList<int> intCopy;
+
+ for( int i = 0; i < numRuns; ++i ) {
+ stringList.add( test + Integer::toString(i) );
+ intList.add( 100 + i );
+ stringList.contains( test + Integer::toString(i) );
+ intList.contains( 100 + i );
+ }
+
+ for( int i = 0; i < numRuns; ++i ) {
+ stringList.remove( test + Integer::toString(i) );
+ intList.remove( 100 + i );
+ stringList.contains( test + Integer::toString(i) );
+ intList.contains( 100 + i );
+ }
+
+ for( int i = 0; i < numRuns; ++i ) {
+ stringList.add( test + Integer::toString(i) );
+ intList.add( 100 + i );
+ }
+
+ std::vector<std::string> stringVec;
+ std::vector<int> intVec;
+
+ for( int i = 0; i < numRuns / 2; ++i ) {
+ stringVec = stringList.toArray();
+ intVec = intList.toArray();
+ }
+
+ std::string tempStr = "";
+ int tempInt = 0;
+
+ for( int i = 0; i < numRuns / 2; ++i ) {
+
+ Iterator<std::string>* strIter = stringList.iterator();
+ Iterator<int>* intIter = intList.iterator();
+
+ while( strIter->hasNext() ){
+ tempStr = strIter->next();
+ }
+
+ while( intIter->hasNext() ){
+ tempInt = intIter->next();
+ }
+
+ delete strIter;
+ delete intIter;
+ }
+
+ for( int i = 0; i < numRuns / 2; ++i ) {
+ stringCopy.copy( stringList );
+ stringCopy.clear();
+ intCopy.copy( intList );
+ intCopy.clear();
+ }
+
+ stringList.clear();
+ intList.clear();
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.h Thu Dec 16 23:18:02 2010
@@ -0,0 +1,46 @@
+/*
+ * 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_UTI_LINKEDLISTBENCHMARK_H_
+#define _DECAF_UTI_LINKEDLISTBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <decaf/util/LinkedList.h>
+
+namespace decaf {
+namespace util {
+
+ class LinkedListBenchmark :
+ public benchmark::BenchmarkBase<
+ decaf::util::LinkedListBenchmark, LinkedList<int> > {
+ private:
+
+ LinkedList<int> intList;
+ LinkedList<std::string> stringList;
+
+ public:
+
+ LinkedListBenchmark();
+ virtual ~LinkedListBenchmark();
+
+ virtual void run();
+
+ };
+
+}}
+
+#endif /* _DECAF_UTI_LINKEDLISTBENCHMARK_H_ */
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/LinkedListBenchmark.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,100 @@
+/*
+ * 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 "StlListBenchmark.h"
+
+#include <decaf/lang/Integer.h>
+#include <decaf/util/Iterator.h>
+
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+StlListBenchmark::StlListBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+StlListBenchmark::~StlListBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void StlListBenchmark::run(){
+
+ int numRuns = 500;
+ std::string test = "test";
+ std::string resultStr = "";
+ StlList<std::string> stringCopy;
+ StlList<int> intCopy;
+
+ for( int i = 0; i < numRuns; ++i ) {
+ stringList.add( test + Integer::toString(i) );
+ intList.add( 100 + i );
+ stringList.contains( test + Integer::toString(i) );
+ intList.contains( 100 + i );
+ }
+
+ for( int i = 0; i < numRuns; ++i ) {
+ stringList.remove( test + Integer::toString(i) );
+ intList.remove( 100 + i );
+ stringList.contains( test + Integer::toString(i) );
+ intList.contains( 100 + i );
+ }
+
+ for( int i = 0; i < numRuns; ++i ) {
+ stringList.add( test + Integer::toString(i) );
+ intList.add( 100 + i );
+ }
+
+ std::vector<std::string> stringVec;
+ std::vector<int> intVec;
+
+ for( int i = 0; i < numRuns / 2; ++i ) {
+ stringVec = stringList.toArray();
+ intVec = intList.toArray();
+ }
+
+ std::string tempStr = "";
+ int tempInt = 0;
+
+ for( int i = 0; i < numRuns / 2; ++i ) {
+
+ Iterator<std::string>* strIter = stringList.iterator();
+ Iterator<int>* intIter = intList.iterator();
+
+ while( strIter->hasNext() ){
+ tempStr = strIter->next();
+ }
+
+ while( intIter->hasNext() ){
+ tempInt = intIter->next();
+ }
+
+ delete strIter;
+ delete intIter;
+ }
+
+ for( int i = 0; i < numRuns / 2; ++i ) {
+ stringCopy.copy( stringList );
+ stringCopy.clear();
+ intCopy.copy( intList );
+ intCopy.clear();
+ }
+
+ stringList.clear();
+ intList.clear();
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.h Thu Dec 16 23:18:02 2010
@@ -0,0 +1,46 @@
+/*
+ * 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_STLLISTBENCHMARK_H_
+#define _DECAF_UTIL_STLLISTBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <decaf/util/StlList.h>
+
+namespace decaf {
+namespace util {
+
+ class StlListBenchmark :
+ public benchmark::BenchmarkBase<
+ decaf::util::StlListBenchmark, StlList<int> > {
+ private:
+
+ StlList<int> intList;
+ StlList<std::string> stringList;
+
+ public:
+
+ StlListBenchmark();
+ virtual ~StlListBenchmark();
+
+ virtual void run();
+
+ };
+
+}}
+
+#endif /* _DECAF_UTIL_STLLISTBENCHMARK_H_ */
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlListBenchmark.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp Thu Dec 16 23:18:02 2010
@@ -31,6 +31,10 @@ CPPUNIT_TEST_SUITE_REGISTRATION( decaf::
CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::SetBenchmark );
#include <decaf/util/MapBenchmark.h>
CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::MapBenchmark );
+#include <decaf/util/StlListBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::StlListBenchmark );
+#include <decaf/util/LinkedListBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::LinkedListBenchmark );
#include <decaf/io/ByteArrayOutputStreamBenchmark.h>
CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::ByteArrayOutputStreamBenchmark );
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am Thu Dec 16 23:18:02 2010
@@ -184,8 +184,14 @@ cc_sources = \
decaf/net/ssl/SSLSocketFactoryTest.cpp \
decaf/nio/BufferTest.cpp \
decaf/security/SecureRandomTest.cpp \
+ decaf/util/AbstractCollectionTest.cpp \
+ decaf/util/AbstractListTest.cpp \
+ decaf/util/AbstractSequentialListTest.cpp \
+ decaf/util/ArrayListTest.cpp \
+ decaf/util/ArraysTest.cpp \
decaf/util/DateTest.cpp \
decaf/util/Endian.cpp \
+ decaf/util/LinkedListTest.cpp \
decaf/util/ListTest.cpp \
decaf/util/PriorityQueueTest.cpp \
decaf/util/PropertiesTest.cpp \
@@ -197,6 +203,8 @@ cc_sources = \
decaf/util/TimerTest.cpp \
decaf/util/UUIDTest.cpp \
decaf/util/concurrent/ConcurrentStlMapTest.cpp \
+ decaf/util/concurrent/CopyOnWriteArrayListTest.cpp \
+ decaf/util/concurrent/CopyOnWriteArraySetTest.cpp \
decaf/util/concurrent/CountDownLatchTest.cpp \
decaf/util/concurrent/MutexTest.cpp \
decaf/util/concurrent/SynchronousQueueTest.cpp \
@@ -396,8 +404,14 @@ h_sources = \
decaf/net/ssl/SSLSocketFactoryTest.h \
decaf/nio/BufferTest.h \
decaf/security/SecureRandomTest.h \
+ decaf/util/AbstractCollectionTest.h \
+ decaf/util/AbstractListTest.h \
+ decaf/util/AbstractSequentialListTest.h \
+ decaf/util/ArrayListTest.h \
+ decaf/util/ArraysTest.h \
decaf/util/DateTest.h \
decaf/util/Endian.h \
+ decaf/util/LinkedListTest.h \
decaf/util/ListTest.h \
decaf/util/PriorityQueueTest.h \
decaf/util/PropertiesTest.h \
@@ -409,6 +423,8 @@ h_sources = \
decaf/util/TimerTest.h \
decaf/util/UUIDTest.h \
decaf/util/concurrent/ConcurrentStlMapTest.h \
+ decaf/util/concurrent/CopyOnWriteArrayListTest.h \
+ decaf/util/concurrent/CopyOnWriteArraySetTest.h \
decaf/util/concurrent/CountDownLatchTest.h \
decaf/util/concurrent/MutexTest.h \
decaf/util/concurrent/SynchronousQueueTest.h \
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/TransportRegistryTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/TransportRegistryTest.cpp?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/TransportRegistryTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/TransportRegistryTest.cpp Thu Dec 16 23:18:02 2010
@@ -23,6 +23,7 @@
using namespace activemq;
using namespace activemq::transport;
using namespace decaf;
+using namespace decaf::util;
using namespace decaf::lang;
using namespace decaf::lang::exceptions;
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/failover/FailoverTransportTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/failover/FailoverTransportTest.cpp?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/failover/FailoverTransportTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/failover/FailoverTransportTest.cpp Thu Dec 16 23:18:02 2010
@@ -573,7 +573,7 @@ void FailoverTransportTest::testTranspor
mock = dynamic_cast<MockTransport*>( transport->narrow( typeid( MockTransport ) ) );
}
- StlList<URI> removals;
+ LinkedList<URI> removals;
removals.add( URI("mock://localhost:61616") );
mock->fireCommand( control );
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveListTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveListTest.cpp?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveListTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveListTest.cpp Thu Dec 16 23:18:02 2010
@@ -180,15 +180,15 @@ void PrimitiveListTest::testRemove(){
plist.add( 5 );
plist.add( 5.5f );
plist.add( 6 );
- plist.remove( 0 );
+ plist.removeAt( 0 );
CPPUNIT_ASSERT_THROW_MESSAGE(
"Should Throw UnsupportedOperationException",
plist.getInt( 0 ),
decaf::lang::exceptions::UnsupportedOperationException );
- plist.remove( 0 );
- plist.remove( 0 );
+ plist.removeAt( 0 );
+ plist.removeAt( 0 );
CPPUNIT_ASSERT( plist.isEmpty() );
}
@@ -204,7 +204,7 @@ void PrimitiveListTest::testCount(){
CPPUNIT_ASSERT( plist.size() == 2 );
plist.add( 6 );
CPPUNIT_ASSERT( plist.size() == 3 );
- plist.remove( 0 );
+ plist.removeAt( 0 );
CPPUNIT_ASSERT( plist.size() == 2 );
CPPUNIT_ASSERT( plist.toString() != "" );
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveMapTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveMapTest.cpp?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveMapTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveMapTest.cpp Thu Dec 16 23:18:02 2010
@@ -79,7 +79,7 @@ void PrimitiveMapTest::testValueNode(){
try{
node.getFloat();
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){
+ } catch( decaf::util::NoSuchElementException& e ){
}
node.clear();
@@ -94,7 +94,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getBool( "bool" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setBool( "bool", true );
CPPUNIT_ASSERT( pmap.getBool("bool") == true );
pmap.setBool( "bool", false );
@@ -103,7 +103,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getByte( "byte" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setByte( "byte", 1 );
CPPUNIT_ASSERT( pmap.getByte("byte") == 1 );
CPPUNIT_ASSERT( pmap.getString("byte") == "1" );
@@ -111,7 +111,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getChar( "char" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setChar( "char", 'a' );
CPPUNIT_ASSERT( pmap.getChar("char") == 'a' );
CPPUNIT_ASSERT( pmap.getString("char") == "a" );
@@ -119,7 +119,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getShort( "short" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setShort( "short", 2 );
CPPUNIT_ASSERT( pmap.getShort("short") == 2 );
CPPUNIT_ASSERT( pmap.getString("short") == "2" );
@@ -127,7 +127,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getInt( "int" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setInt( "int", 3 );
CPPUNIT_ASSERT( pmap.getInt("int") == 3 );
CPPUNIT_ASSERT( pmap.getString("int") == "3" );
@@ -135,7 +135,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getLong( "long" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setLong( "long", 4L );
CPPUNIT_ASSERT( pmap.getLong("long") == 4L );
CPPUNIT_ASSERT( pmap.getString("long") == "4" );
@@ -143,7 +143,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getDouble( "double" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setDouble( "double", 2.3 );
CPPUNIT_ASSERT( pmap.getDouble("double") == 2.3 );
CPPUNIT_ASSERT( pmap.getString("double") == "2.3" );
@@ -151,7 +151,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getFloat( "float" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setFloat( "float", 3.2f );
CPPUNIT_ASSERT( pmap.getFloat("float") == 3.2f );
CPPUNIT_ASSERT( pmap.getString("float") == "3.2" );
@@ -159,7 +159,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getString( "string" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setString( "string", "hello" );
CPPUNIT_ASSERT( pmap.getString("string") == "hello" );
@@ -172,7 +172,7 @@ void PrimitiveMapTest::testSetGet(){
try{
pmap.getByteArray( "byteArray" );
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
pmap.setByteArray( "byteArray", byteArray );
CPPUNIT_ASSERT( pmap.getByteArray("byteArray") == byteArray );
@@ -189,7 +189,7 @@ void PrimitiveMapTest::testRemove(){
try{
pmap.getInt("int");
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
}
////////////////////////////////////////////////////////////////////////////////
@@ -239,17 +239,17 @@ void PrimitiveMapTest::testClear(){
try{
pmap.getInt("int");
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
try{
pmap.getFloat("float");
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
try{
pmap.getInt("int2");
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){}
+ } catch( decaf::util::NoSuchElementException& e ){}
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveValueNodeTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveValueNodeTest.cpp?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveValueNodeTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/PrimitiveValueNodeTest.cpp Thu Dec 16 23:18:02 2010
@@ -79,7 +79,7 @@ void PrimitiveValueNodeTest::testValueNo
try{
node.getFloat();
CPPUNIT_ASSERT( false );
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){
+ } catch( decaf::util::NoSuchElementException& e ){
}
node.clear();
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/WireFormatRegistryTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/WireFormatRegistryTest.cpp?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/WireFormatRegistryTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/WireFormatRegistryTest.cpp Thu Dec 16 23:18:02 2010
@@ -24,6 +24,7 @@
using namespace activemq;
using namespace activemq::wireformat;
using namespace decaf;
+using namespace decaf::util;
using namespace decaf::lang;
using namespace decaf::lang::exceptions;
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,34 @@
+/*
+ * 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 "AbstractCollectionTest.h"
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+
+////////////////////////////////////////////////////////////////////////////////
+AbstractCollectionTest::AbstractCollectionTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+AbstractCollectionTest::~AbstractCollectionTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractCollectionTest::testIterator() {
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.h Thu Dec 16 23:18:02 2010
@@ -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_ABSTRACTCOLLECTIONTEST_H_
+#define _DECAF_UTIL_ABSTRACTCOLLECTIONTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf {
+namespace util {
+
+ class AbstractCollectionTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( AbstractCollectionTest );
+ CPPUNIT_TEST( testIterator );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ AbstractCollectionTest();
+ virtual ~AbstractCollectionTest();
+
+ void testIterator();
+
+ };
+
+}}
+
+#endif /* _DECAF_UTIL_ABSTRACTCOLLECTIONTEST_H_ */
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractCollectionTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,356 @@
+/*
+ * 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 "AbstractListTest.h"
+
+#include <decaf/lang/Integer.h>
+#include <decaf/util/AbstractList.h>
+#include <vector>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+namespace {
+
+ template<typename E>
+ class SimpleList : public AbstractList<E> {
+ private:
+
+ std::vector<E> array;
+
+ public:
+
+ using AbstractList<E>::add;
+
+ public:
+
+ SimpleList() : AbstractList<E>() {
+ }
+
+ virtual ~SimpleList() {}
+
+ virtual E get( int index ) const {
+
+ if( index < 0 || index >= (int)array.size() ) {
+ throw IndexOutOfBoundsException();
+ }
+
+ return this->array[index];
+ }
+
+ virtual void add( int i, const E& value ) {
+ if( i < 0 || i > (int)array.size() ) {
+ throw IndexOutOfBoundsException();
+ }
+
+ this->array.insert( this->array.begin() + i, value );
+ }
+
+ virtual E removeAt( int i ) {
+ if( i < 0 || i >= (int)array.size() ) {
+ throw IndexOutOfBoundsException();
+ }
+
+ E oldValue = this->array[i];
+ this->array.erase( this->array.begin() + i );
+ return oldValue;
+ }
+
+ virtual int size() const {
+ return (int)this->array.size();
+ }
+ };
+
+ template<typename E>
+ class MockArrayList : public AbstractList<E> {
+ public:
+
+ std::vector<E> array;
+
+ public:
+
+ using AbstractList<E>::add;
+
+ public:
+
+ MockArrayList() : AbstractList<E>() {
+ }
+
+ virtual ~MockArrayList() {}
+
+ virtual E get( int index ) const {
+ if( index < 0 || index >= (int)array.size() ) {
+ throw IndexOutOfBoundsException();
+ }
+
+ return this->array[index];
+ }
+
+ virtual void add( int i, const E& value ) {
+ if( i < 0 || i > (int)array.size() ) {
+ throw IndexOutOfBoundsException();
+ }
+
+ this->modCount += 10;
+ this->array.insert( this->array.begin() + i, value );
+ }
+
+ virtual E removeAt( int i ) {
+ if( i < 0 || i >= (int)array.size() ) {
+ throw IndexOutOfBoundsException();
+ }
+
+ this->modCount++;
+ E oldValue = this->array[i];
+ this->array.erase( this->array.begin() + i );
+ return oldValue;
+ }
+
+ virtual int size() const {
+ return (int)this->array.size();
+ }
+ };
+
+ template<typename E>
+ class MockRemoveFailureArrayList : public AbstractList<E> {
+ public:
+
+ virtual ~MockRemoveFailureArrayList() {}
+
+ virtual E get( int index ) const {
+ return E();
+ }
+
+ virtual int size() const {
+ return 0;
+ }
+
+ virtual E removeAt( int i ) {
+ this->modCount += 2;
+ return E();
+ }
+
+ int getModCount() const {
+ return this->modCount;
+ }
+
+ };
+
+ template<typename E>
+ class MockList : public AbstractList<E> {
+ private:
+
+ std::vector<E> array;
+
+ public:
+
+ using AbstractList<E>::add;
+
+ public:
+
+ virtual ~MockList() {}
+
+ virtual E get( int index ) const {
+ if( index < 0 || index >= (int)array.size() ) {
+ throw IndexOutOfBoundsException();
+ }
+
+ return array[index];
+ }
+
+ virtual int size() const {
+ return (int)array.size();
+ }
+ };
+}
+
+////////////////////////////////////////////////////////////////////////////////
+AbstractListTest::AbstractListTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+AbstractListTest::~AbstractListTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractListTest::testIterator() {
+
+ SimpleList<int> list;
+ list.add( 10 );
+ list.add( 20 );
+ std::auto_ptr< Iterator<int> > iter( list.iterator() );
+
+ CPPUNIT_ASSERT_EQUAL( 10, iter->next() );
+ iter->remove();
+ CPPUNIT_ASSERT_EQUAL( 20, iter->next() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractListTest::testListIterator() {
+
+ int tempValue;
+ SimpleList<int> list;
+
+ list.add( 3 );
+ list.add( 15 );
+ list.add( 5 );
+ list.add( 1 );
+ list.add( 7 );
+
+ std::auto_ptr< ListIterator<int> > iter( list.listIterator() );
+
+ CPPUNIT_ASSERT_MESSAGE( "Should not have previous", !iter->hasPrevious() );
+ CPPUNIT_ASSERT_MESSAGE( "Should have next", iter->hasNext() );
+ tempValue = iter->next();
+ CPPUNIT_ASSERT_MESSAGE( std::string( "next returned wrong value. Wanted 3, got: " ) +
+ Integer::toString( tempValue ), tempValue == 3 );
+ tempValue = iter->previous();
+
+ SimpleList<std::string> list2;
+ list2.add( std::string("1") );
+ std::auto_ptr< ListIterator<std::string> > iter2( list2.listIterator() );
+ iter2->add( std::string("2") );
+ iter2->next();
+ CPPUNIT_ASSERT_MESSAGE( "Should contain two elements", list2.size() == 2 );
+
+ SimpleList<int> list3;
+ std::auto_ptr< ListIterator<int> > it( list3.listIterator() );
+ it->add( 1 );
+ it->add( 2 );
+ CPPUNIT_ASSERT_MESSAGE( "Should contain two elements", list3.size() == 2 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractListTest::testIteratorNext() {
+
+ MockArrayList<std::string> t;
+ t.array.push_back( "a" );
+ t.array.push_back( "b" );
+
+ std::auto_ptr< Iterator<std::string> > it( t.iterator() );
+
+ while( it->hasNext() ) {
+ it->next();
+ }
+
+ try {
+ it->next();
+ CPPUNIT_FAIL( "Should throw NoSuchElementException" );
+ } catch( NoSuchElementException& cme ) {
+ // expected
+ }
+
+ t.add( "c" );
+ try {
+ it->remove();
+ CPPUNIT_FAIL( "Should throw ConcurrentModificationException" );
+ } catch( ConcurrentModificationException& cme ) {
+ // expected
+ }
+
+ it.reset( t.iterator() );
+ try {
+ it->remove();
+ CPPUNIT_FAIL( "Should throw IllegalStateException" );
+ } catch( IllegalStateException& ise ) {
+ // expected
+ }
+
+ std::string value = it->next();
+ CPPUNIT_ASSERT_EQUAL( std::string("a"), value );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractListTest::testRemove() {
+
+ MockRemoveFailureArrayList<std::string> list;
+ std::auto_ptr< Iterator<std::string> > iter( list.iterator() );
+
+ iter->next();
+ iter->remove();
+
+ try {
+ iter->remove();
+ } catch( ConcurrentModificationException& e ) {
+ CPPUNIT_FAIL("Excepted to catch IllegalStateException not ConcurrentModificationException");
+ } catch( IllegalStateException& e ) {
+ //Excepted to catch IllegalStateException here
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractListTest::testIndexOf() {
+
+ SimpleList<int> array;
+ for( int i = 1; i < 6; i++ ) {
+ array.add(i);
+ }
+
+ MockArrayList<int> list;
+ list.addAll( array );
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "find 0 in the list do not contain 0", -1, list.indexOf( 0 ) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "did not return the right location of element 3", 2, list.indexOf( 3 ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractListTest::testLastIndexOf() {
+
+ SimpleList<int> array;
+ for( int i = 1; i < 6; i++ ) {
+ array.add(i);
+ }
+ for( int i = 5; i > 0; i-- ) {
+ array.add(i);
+ }
+
+ CPPUNIT_ASSERT( array.size() == 10 );
+
+ MockArrayList<int> list;
+ list.addAll( array );
+
+ CPPUNIT_ASSERT( list.size() == 10 );
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "find 6 in the list do not contain 6",
+ -1, list.lastIndexOf( 6 ) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "did not return the right location of element 4",
+ 6, list.lastIndexOf( 4 ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractListTest::testRemoveAt() {
+
+ MockList<int> list;
+
+ try {
+ list.removeAt( 0 );
+ CPPUNIT_FAIL("should throw UnsupportedOperationException");
+ } catch( UnsupportedOperationException& e ) {
+ // expected
+ }
+
+ try {
+ list.set( 0, 1 );
+ CPPUNIT_FAIL("should throw UnsupportedOperationException");
+ } catch( UnsupportedOperationException& e ) {
+ // expected
+ }
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.h Thu Dec 16 23:18:02 2010
@@ -0,0 +1,56 @@
+/*
+ * 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_ABSTRACTLISTTEST_H_
+#define _DECAF_UTIL_ABSTRACTLISTTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf {
+namespace util {
+
+ class AbstractListTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( AbstractListTest );
+ CPPUNIT_TEST( testIterator );
+ CPPUNIT_TEST( testListIterator );
+ CPPUNIT_TEST( testIteratorNext );
+ CPPUNIT_TEST( testRemove );
+ CPPUNIT_TEST( testIndexOf );
+ CPPUNIT_TEST( testLastIndexOf );
+ CPPUNIT_TEST( testRemoveAt );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ AbstractListTest();
+ virtual ~AbstractListTest();
+
+ void testIterator();
+ void testListIterator();
+ void testIteratorNext();
+ void testRemove();
+ void testIndexOf();
+ void testLastIndexOf();
+ void testRemoveAt();
+
+ };
+
+}}
+
+#endif /* _DECAF_UTIL_ABSTRACTLISTTEST_H_ */
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractListTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,213 @@
+/*
+ * 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 "AbstractSequentialListTest.h"
+
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/util/AbstractSequentialList.h>
+#include <decaf/util/LinkedList.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+namespace {
+
+ template< typename E >
+ class SimpleList : public AbstractSequentialList<E> {
+ private:
+
+ LinkedList<E> list;
+
+ public:
+
+ virtual ~SimpleList() {}
+
+ virtual ListIterator<E>* listIterator( int index ) {
+ return list.listIterator( index );
+ }
+ virtual ListIterator<E>* listIterator( int index ) const {
+ return list.listIterator( index );
+ }
+
+ virtual int size() const {
+ return list.size();
+ }
+
+ };
+
+ template< typename E >
+ class MockListIterator : public ListIterator<E> {
+ public:
+
+ virtual ~MockListIterator() {}
+
+ virtual E next() {
+ throw UnsupportedOperationException();
+ }
+
+ virtual bool hasNext() const {
+ throw UnsupportedOperationException();
+ }
+
+ virtual void remove() {
+ throw UnsupportedOperationException();
+ }
+
+ virtual void add( const E& e ) {
+ throw UnsupportedOperationException();
+ }
+
+ virtual void set( const E& e ) {
+ throw UnsupportedOperationException();
+ }
+
+ virtual bool hasPrevious() const {
+ throw UnsupportedOperationException();
+ }
+
+ virtual E previous() {
+ throw UnsupportedOperationException();
+ }
+
+ virtual int nextIndex() const {
+ throw UnsupportedOperationException();
+ }
+
+ virtual int previousIndex() const {
+ throw UnsupportedOperationException();
+ }
+
+ };
+
+ template< typename E >
+ class MockAbstractSequentialList : public AbstractSequentialList<E> {
+ public:
+
+ virtual ~MockAbstractSequentialList() {}
+
+ virtual ListIterator<E>* listIterator( int index ) {
+ return new MockListIterator<E>();
+ }
+ virtual ListIterator<E>* listIterator( int index ) const {
+ return new MockListIterator<E>();
+ }
+
+ virtual int size() const {
+ return 0;
+ }
+ };
+}
+
+////////////////////////////////////////////////////////////////////////////////
+AbstractSequentialListTest::AbstractSequentialListTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+AbstractSequentialListTest::~AbstractSequentialListTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractSequentialListTest::testAddAll() {
+
+ LinkedList<int> collection;
+ for( int i = 0; i < 50; ++i ) {
+ collection.add( i );
+ }
+
+ SimpleList<int> list;
+ list.addAll( collection );
+ CPPUNIT_ASSERT_MESSAGE( "Should return true", list.addAll( 2, collection ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractSequentialListTest::testGet() {
+
+ SimpleList<int> list;
+
+ list.add( 1 );
+ list.add( 2 );
+
+ CPPUNIT_ASSERT_EQUAL( 1, list.get( 0 ) );
+ CPPUNIT_ASSERT_EQUAL( 2, list.get( 1 ) );
+
+ // get value by index which is out of bounds
+ try {
+ list.get( list.size() );
+ CPPUNIT_FAIL("Should throw IndexOutOfBoundsException.");
+ } catch( IndexOutOfBoundsException& e ) {
+ // expected
+ }
+
+ try {
+ list.get( -1 );
+ CPPUNIT_FAIL("Should throw IndexOutOfBoundsException.");
+ } catch( IndexOutOfBoundsException& e ) {
+ // expected
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractSequentialListTest::testRemove() {
+
+ SimpleList<int> list;
+ list.add(1);
+
+ CPPUNIT_ASSERT_EQUAL( 1, list.removeAt( 0 ) );
+
+ list.add( 2 );
+ CPPUNIT_ASSERT_EQUAL( 2, list.removeAt( 0 ) );
+
+ // remove index is out of bounds
+ try {
+ list.removeAt( list.size() );
+ CPPUNIT_FAIL("Should throw IndexOutOfBoundsException.");
+ } catch( IndexOutOfBoundsException& e ) {
+ // expected
+ }
+ try {
+ list.removeAt( -1 );
+ CPPUNIT_FAIL("Should throw IndexOutOfBoundsException.");
+ } catch( IndexOutOfBoundsException& e ) {
+ // expected
+ }
+
+ // list dont't support remove operation
+ try {
+ MockAbstractSequentialList<int> mylist;
+ mylist.removeAt( 0 );
+ CPPUNIT_FAIL("Should throw UnsupportedOperationException.");
+ } catch( UnsupportedOperationException& e ) {
+ // expected
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AbstractSequentialListTest::testSet() {
+
+ SimpleList<int> list;
+
+ try {
+ list.set( 0, 12 );
+ CPPUNIT_FAIL("should throw IndexOutOfBoundsException");
+ } catch( IndexOutOfBoundsException& e ) {
+ // expected
+ }
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.h Thu Dec 16 23:18:02 2010
@@ -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.
+ */
+
+#ifndef _DECAF_UTIL_ABSTRACTSEQUENTIALLISTTEST_H_
+#define _DECAF_UTIL_ABSTRACTSEQUENTIALLISTTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf {
+namespace util {
+
+ class AbstractSequentialListTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( AbstractSequentialListTest );
+ CPPUNIT_TEST( testAddAll );
+ CPPUNIT_TEST( testGet );
+ CPPUNIT_TEST( testSet );
+ CPPUNIT_TEST( testRemove );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ AbstractSequentialListTest();
+
+ virtual ~AbstractSequentialListTest();
+
+ void testAddAll();
+ void testGet();
+ void testSet();
+ void testRemove();
+
+ };
+
+}}
+
+#endif /* _DECAF_UTIL_ABSTRACTSEQUENTIALLISTTEST_H_ */
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/AbstractSequentialListTest.h
------------------------------------------------------------------------------
svn:eol-style = native