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 2007/12/05 19:30:15 UTC
svn commit: r601461 - in /activemq/activemq-cpp/decaf/trunk/src:
main/decaf/internal/nio/ main/decaf/nio/ test/ test/decaf/internal/nio/
Author: tabish
Date: Wed Dec 5 10:30:14 2007
New Revision: 601461
URL: http://svn.apache.org/viewvc?rev=601461&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-153
Working on implementing the NIO package
Added:
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h
Modified:
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.h
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h
activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp
activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.cpp?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.cpp Wed Dec 5 10:30:14 2007
@@ -18,6 +18,7 @@
#include "BufferFactory.h"
#include <decaf/internal/nio/ByteArrayBuffer.h>
+#include <decaf/internal/nio/CharArrayBuffer.h>
using namespace decaf;
using namespace decaf::internal;
@@ -55,6 +56,40 @@
try{
return new ByteArrayBuffer( &buffer[0], 0, buffer.size(), false );
+ }
+ DECAF_CATCH_RETHROW( Exception )
+ DECAF_CATCHALL_THROW( Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CharBuffer* BufferFactory::createCharBuffer( std::size_t capacity ) {
+
+ try{
+ return new CharArrayBuffer( capacity );
+ }
+ DECAF_CATCH_RETHROW( Exception )
+ DECAF_CATCHALL_THROW( Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CharBuffer* BufferFactory::createCharBuffer( char* buffer,
+ std::size_t offset,
+ std::size_t length )
+ throw( lang::exceptions::NullPointerException ) {
+
+ try{
+ return new CharArrayBuffer( buffer, offset, length, false );
+ }
+ DECAF_CATCH_RETHROW( NullPointerException )
+ DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
+ DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CharBuffer* BufferFactory::createCharBuffer( std::vector<char>& buffer ) {
+
+ try{
+ return new CharArrayBuffer( &buffer[0], 0, buffer.size(), false );
}
DECAF_CATCH_RETHROW( Exception )
DECAF_CATCHALL_THROW( Exception )
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.h?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/BufferFactory.h Wed Dec 5 10:30:14 2007
@@ -79,6 +79,46 @@
*/
static decaf::nio::ByteBuffer* createByteBuffer( std::vector<unsigned char>& buffer );
+ /**
+ * Allocates a new char buffer whose position will be zero its limit will
+ * be its capacity and its mark is not set.
+ * @param capacity - the internal buffer's capacity.
+ * @returns a newly allocated CharBuffer which the caller owns.
+ */
+ static decaf::nio::CharBuffer* createCharBuffer( std::size_t capacity );
+
+ /**
+ * Wraps the passed buffer with a new CharBuffer.
+ * <p>
+ * The new buffer will be backed by the given byte array; that is, modifications
+ * to the buffer will cause the array to be modified and vice versa. The new
+ * buffer's capacity will be array.length, its position will be offset, its limit
+ * will be offset + length, and its mark will be undefined. Its backing array
+ * will be the given array, and its array offset will be zero.
+ * @param buffer - The array that will back the new buffer
+ * @param offset - The offset of the subarray to be used
+ * @param length - The length of the subarray to be used
+ * @returns a new CharBuffer that is backed by buffer, caller owns.
+ */
+ static decaf::nio::CharBuffer* createCharBuffer( char* buffer,
+ std::size_t offset,
+ std::size_t length )
+ throw( lang::exceptions::NullPointerException );
+
+ /**
+ * Wraps the passed STL Byte Vector in a CharBuffer.
+ * <p>
+ * The new buffer will be backed by the given byte array; modifications to the
+ * buffer will cause the array to be modified and vice versa. The new buffer's
+ * capacity and limit will be buffer.size(), its position will be zero, and its
+ * mark will be undefined. Its backing array will be the given array, and its
+ * array offset will be zero.
+ * @param buffer - The vector that will back the new buffer, the vector must
+ * have been sized to the desired size already by calling vector.resize( N ).
+ * @returns a new CharBuffer that is backed by buffer, caller owns.
+ */
+ static decaf::nio::CharBuffer* createCharBuffer( std::vector<char>& buffer );
+
};
}}}
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp Wed Dec 5 10:30:14 2007
@@ -34,3 +34,11 @@
this->references = 1;
}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayPerspective::ByteArrayPerspective( char* array, std::size_t capacity, bool own )
+ throw( lang::exceptions::NullPointerException ) :
+ ByteArrayAdapter( array, capacity, own ) {
+
+ this->references = 1;
+}
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h Wed Dec 5 10:30:14 2007
@@ -59,6 +59,17 @@
ByteArrayPerspective( unsigned char* array, std::size_t capacity, bool own = false )
throw( lang::exceptions::NullPointerException );
+ /**
+ * Creates a array object that wraps the given array. If the own flag
+ * is set then it will delete this array when this object is deleted.
+ * @param array - array to wrap
+ * @param capacity - size of the array, this is the limit we read and write to.
+ * @param own - is this class now the owner of the pointer.
+ * @throws NullPointerException if buffer is NULL
+ */
+ ByteArrayPerspective( char* array, std::size_t capacity, bool own = false )
+ throw( lang::exceptions::NullPointerException );
+
virtual ~ByteArrayPerspective() {}
/**
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp Wed Dec 5 10:30:14 2007
@@ -36,7 +36,7 @@
}
///////////////////////////////////////////////////////////////////////////////
-CharArrayBuffer::CharArrayBuffer( unsigned char* array, std::size_t offset,
+CharArrayBuffer::CharArrayBuffer( char* array, std::size_t offset,
std::size_t capacity, bool readOnly )
throw( decaf::lang::exceptions::NullPointerException ) : CharBuffer( capacity ) {
@@ -79,7 +79,7 @@
///////////////////////////////////////////////////////////////////////////////
CharArrayBuffer::CharArrayBuffer( const CharArrayBuffer& other )
- : CharBuffer( other.capacity() ) {
+ : CharBuffer( other ) {
// get the byte buffer of the caller and take a reference
this->_array = other._array->takeRef();
@@ -187,7 +187,7 @@
CharBuffer* CharArrayBuffer::duplicate() {
try{
- return NULL; //new CharArrayBuffer( *this );
+ return new CharArrayBuffer( *this );
}
DECAF_CATCH_RETHROW( Exception )
DECAF_CATCHALL_THROW( Exception )
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h Wed Dec 5 10:30:14 2007
@@ -62,7 +62,7 @@
* @param readOnly - should this buffer be read-only, default as false
* @throws NullPointerException if buffer is NULL
*/
- CharArrayBuffer( unsigned char* array, std::size_t offset,
+ CharArrayBuffer( char* array, std::size_t offset,
std::size_t capacity, bool readOnly = false )
throw( decaf::lang::exceptions::NullPointerException );
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp Wed Dec 5 10:30:14 2007
@@ -18,12 +18,14 @@
#include "CharBuffer.h"
#include <decaf/lang/Character.h>
#include <decaf/lang/Math.h>
+#include "decaf/internal/nio/BufferFactory.h"
using namespace std;
using namespace decaf;
using namespace decaf::nio;
using namespace decaf::lang;
using namespace decaf::lang::exceptions;
+using namespace decaf::internal::nio;
////////////////////////////////////////////////////////////////////////////////
CharBuffer::CharBuffer( std::size_t capacity )
@@ -32,6 +34,54 @@
}
////////////////////////////////////////////////////////////////////////////////
+CharBuffer* CharBuffer::allocate( std::size_t capacity ) {
+
+ try{
+
+ return BufferFactory::createCharBuffer( capacity );
+ }
+ DECAF_CATCH_RETHROW( Exception )
+ DECAF_CATCHALL_THROW( Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CharBuffer* CharBuffer::wrap( char* buffer, std::size_t offset, std::size_t length )
+ throw( lang::exceptions::NullPointerException ) {
+
+ try{
+
+ if( buffer == NULL ) {
+ throw NullPointerException(
+ __FILE__, __LINE__,
+ "CharBuffer::wrap - Passed Buffer is Null.");
+ }
+
+ return BufferFactory::createCharBuffer( buffer, offset, length );
+ }
+ DECAF_CATCH_RETHROW( NullPointerException )
+ DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
+ DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CharBuffer* CharBuffer::wrap( std::vector<char>& buffer ) {
+
+ try{
+
+ if( buffer.empty() ) {
+ throw NullPointerException(
+ __FILE__, __LINE__,
+ "CharBuffer::wrap - Passed Buffer is Empty.");
+ }
+
+ return BufferFactory::createCharBuffer( &buffer[0], 0, buffer.size() );
+ }
+ DECAF_CATCH_RETHROW( NullPointerException )
+ DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
+ DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
std::string CharBuffer::toString() const {
std::string strbuf;
@@ -158,6 +208,7 @@
return *this;
}
+ DECAF_CATCH_RETHROW( NullPointerException )
DECAF_CATCH_RETHROW( BufferUnderflowException )
DECAF_CATCH_EXCEPTION_CONVERT( Exception, BufferUnderflowException )
DECAF_CATCHALL_THROW( BufferUnderflowException )
Modified: activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am Wed Dec 5 10:30:14 2007
@@ -20,6 +20,7 @@
decaf/internal/nio/ByteArrayPerspectiveTest.cpp \
decaf/internal/nio/ByteArrayBufferTest.cpp \
decaf/internal/nio/BufferFactoryTest.cpp \
+ decaf/internal/nio/CharArrayBufferTest.cpp \
decaf/lang/ByteTest.cpp \
decaf/lang/CharacterTest.cpp \
decaf/lang/BooleanTest.cpp \
@@ -63,7 +64,8 @@
decaf/internal/util/ByteArrayAdapterTest.h \
decaf/internal/nio/ByteArrayPerspectiveTest.h \
decaf/internal/nio/ByteArrayBufferTest.h \
- decaf/internal/nio/BufferFactoryTest.cpp \
+ decaf/internal/nio/BufferFactoryTest.h \
+ decaf/internal/nio/CharArrayBufferTest.h \
decaf/lang/ByteTest.h \
decaf/lang/CharacterTest.h \
decaf/lang/BooleanTest.h \
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp Wed Dec 5 10:30:14 2007
@@ -512,7 +512,7 @@
IllegalArgumentException );
ByteBuffer* toBig = testBuffer1->allocate( testBuffer1->capacity() + 1 );
- readOnly->clear();
+ toBig->clear();
CPPUNIT_ASSERT_THROW_MESSAGE(
"Should throw a BufferOverflowException",
testBuffer1->put( *toBig ),
@@ -594,8 +594,8 @@
<< ", slice get index = " << ix << "\n";
CPPUNIT_ASSERT( testBuffer1->get( ix + 1 ) == slice->get( ix ) );
}
-// testBuffer1->put( 2, 100 );
-// CPPUNIT_ASSERT( slice->get(1) == 100 );
+ testBuffer1->put( 2, 100 );
+ CPPUNIT_ASSERT( slice->get(1) == 100 );
delete slice;
}
Added: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp?rev=601461&view=auto
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp (added)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp Wed Dec 5 10:30:14 2007
@@ -0,0 +1,621 @@
+/*
+ * 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 "CharArrayBufferTest.h"
+#include <decaf/lang/Integer.h>
+#include <decaf/lang/Double.h>
+#include <decaf/lang/Float.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::nio;
+using namespace decaf::internal::nio;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::test() {
+
+ // Check that we have setup the array and our initial assumptions on state
+ // are correct. This is the first test run.
+ CPPUNIT_ASSERT( testBuffer1 != NULL );
+ CPPUNIT_ASSERT( testBuffer1->capacity() == testData1Size );
+ CPPUNIT_ASSERT( testBuffer1->hasRemaining() == true );
+ CPPUNIT_ASSERT( testBuffer1->limit() == testBuffer1->capacity() );
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+ CPPUNIT_ASSERT( testBuffer1->isReadOnly() == false );
+ CPPUNIT_ASSERT( testBuffer1->toString() != "" );
+ CPPUNIT_ASSERT( testBuffer1->hasArray() == true );
+ CPPUNIT_ASSERT( testBuffer1->array() != NULL );
+ CPPUNIT_ASSERT( testBuffer1->arrayOffset() == 0 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testArray() {
+
+ testBuffer1->put( testData1, 0, testData1Size );
+ testBuffer1->position( 0 );
+
+ testBuffer1->mark();
+
+ for( std::size_t ix = 0; ix < testBuffer1->capacity(); ++ix ) {
+ CPPUNIT_ASSERT( testBuffer1->get() == testData1[ix] );
+ }
+
+ testBuffer1->reset();
+
+ char* array = testBuffer1->array();
+ CPPUNIT_ASSERT( array != NULL );
+
+ for( std::size_t ix = 0; ix < testBuffer1->capacity(); ++ix ) {
+ CPPUNIT_ASSERT( array[ix] == testData1[ix] );
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testArrayOffset() {
+
+ testBuffer1->put( testData1, 0, testData1Size );
+ CPPUNIT_ASSERT( testBuffer1->arrayOffset() == 0 );
+ testBuffer1->rewind();
+ CPPUNIT_ASSERT( testBuffer1->arrayOffset() == 0 );
+
+ testBuffer1->get();
+ CharBuffer* sliced = testBuffer1->slice();
+ CPPUNIT_ASSERT( sliced->arrayOffset() == 1 );
+ delete sliced;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testReadOnlyArray() {
+
+ CharBuffer* readOnly = testBuffer1->asReadOnlyBuffer();
+
+ CPPUNIT_ASSERT( readOnly != NULL );
+ CPPUNIT_ASSERT( readOnly->isReadOnly() == true );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw UnsupportedOperationException",
+ readOnly->array(),
+ UnsupportedOperationException );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw UnsupportedOperationException",
+ readOnly->arrayOffset(),
+ UnsupportedOperationException );
+
+ delete readOnly;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testAsReadOnlyBuffer() {
+
+ testBuffer1->clear();
+ testBuffer1->mark();
+ testBuffer1->position( testBuffer1->limit() );
+
+ // readonly's contents should be the same as buf
+ CharBuffer* readOnly = testBuffer1->asReadOnlyBuffer();
+
+ CPPUNIT_ASSERT( testBuffer1 != readOnly );
+ CPPUNIT_ASSERT( readOnly->isReadOnly() );
+ CPPUNIT_ASSERT( testBuffer1->position() == readOnly->position() );
+ CPPUNIT_ASSERT( testBuffer1->limit() == readOnly->limit() );
+
+ CPPUNIT_ASSERT( *testBuffer1 == *readOnly );
+ CPPUNIT_ASSERT( testBuffer1->compareTo( *readOnly ) == 0 );
+
+ // readonly's position, mark, and limit should be independent to buf
+ readOnly->reset();
+ CPPUNIT_ASSERT( readOnly->position() == 0 );
+ readOnly->clear();
+ CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->limit() );
+ testBuffer1->reset();
+ CPPUNIT_ASSERT( testBuffer1->position() == 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testCompact() {
+
+ // readonly's contents should be the same as buf
+ CharBuffer* readOnly = testBuffer1->asReadOnlyBuffer();
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a ReadOnlyBufferExceptio",
+ readOnly->compact(),
+ ReadOnlyBufferException );
+
+ // case: buffer is full
+ testBuffer1->clear();
+ testBuffer1->mark();
+
+ for( std::size_t ix = 0; ix < testData1Size; ++ix ){
+ testBuffer1->put( ix, testData1[ix] );
+ }
+
+ CharBuffer& ret = testBuffer1->compact();
+
+ CPPUNIT_ASSERT( &ret == testBuffer1 );
+ CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
+ CPPUNIT_ASSERT( testBuffer1->limit() == testBuffer1->capacity() );
+
+ for( std::size_t ix = 0; ix < testBuffer1->capacity(); ix++ ) {
+ CPPUNIT_ASSERT( testBuffer1->get( ix ) == testData1[ix] );
+ }
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a InvalidMarkException",
+ readOnly->reset(),
+ InvalidMarkException );
+
+ delete readOnly;
+
+ // case: buffer is empty
+ testBuffer1->position(0);
+ testBuffer1->limit(0);
+ testBuffer1->mark();
+ ret = testBuffer1->compact();
+ CPPUNIT_ASSERT( &ret == testBuffer1 );
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+ CPPUNIT_ASSERT( testBuffer1->limit() == testBuffer1->capacity() );
+
+ for( std::size_t ix = 0; ix < testBuffer1->capacity(); ix++ ) {
+ CPPUNIT_ASSERT( testBuffer1->get( ix ) == testData1[ix] );
+ }
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a InvalidMarkException",
+ testBuffer1->reset(),
+ InvalidMarkException );
+
+ // case: normal
+ testBuffer1->position(1);
+ testBuffer1->limit(SMALL_TEST_LENGTH);
+ testBuffer1->mark();
+ ret = testBuffer1->compact();
+ CPPUNIT_ASSERT( &ret == testBuffer1 );
+ CPPUNIT_ASSERT( testBuffer1->position() == SMALL_TEST_LENGTH - 1 );
+ CPPUNIT_ASSERT( testBuffer1->limit() == testBuffer1->capacity() );
+
+ for( std::size_t ix = 0; ix < SMALL_TEST_LENGTH - 1; ix++ ) {
+ CPPUNIT_ASSERT( testBuffer1->get( ix ) == testData1[ix + 1] );
+ }
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a InvalidMarkException",
+ testBuffer1->reset(),
+ InvalidMarkException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testCompareTo() {
+
+ // compare to self
+ CPPUNIT_ASSERT( 0 == testBuffer1->compareTo( *testBuffer1 ) );
+
+ CPPUNIT_ASSERT( testBuffer1->capacity() > SMALL_TEST_LENGTH );
+ testBuffer1->clear();
+ CharBuffer* other = CharBuffer::allocate( testBuffer1->capacity() );
+
+ for( std::size_t ix = 0; ix < testData1Size; ++ix ){
+ testBuffer1->put( ix, testData1[ix] );
+ }
+
+ for( std::size_t ix = 0; ix < testData1Size; ++ix ){
+ other->put( ix, testData1[ix] );
+ }
+
+ CPPUNIT_ASSERT( 0 == testBuffer1->compareTo( *other ) );
+ CPPUNIT_ASSERT( 0 == other->compareTo( *testBuffer1 ) );
+ testBuffer1->position(1);
+ CPPUNIT_ASSERT( testBuffer1->compareTo( *other ) > 0 );
+ CPPUNIT_ASSERT( other->compareTo( *testBuffer1 ) < 0 );
+ other->position( 2 );
+ CPPUNIT_ASSERT( testBuffer1->compareTo( *other ) < 0 );
+ CPPUNIT_ASSERT( other->compareTo( *testBuffer1 ) > 0 );
+ testBuffer1->position( 2 );
+ other->limit(SMALL_TEST_LENGTH);
+ CPPUNIT_ASSERT( testBuffer1->compareTo( *other ) > 0 );
+ CPPUNIT_ASSERT( other->compareTo( *testBuffer1 ) < 0 );
+
+ char* data = new char[21];
+ memset( data, 0, 21 );
+ CharBuffer* empty = CharBuffer::allocate(21);
+ CharBuffer* wrapped = CharBuffer::wrap( data, (std::size_t)0, (std::size_t)21 );
+
+ CPPUNIT_ASSERT( wrapped->compareTo( *empty ) == 0 );
+
+ delete empty;
+ delete wrapped;
+ delete other;
+ delete data;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testDuplicate() {
+
+ testBuffer1->clear();
+ testBuffer1->mark();
+ testBuffer1->position( testBuffer1->limit() );
+
+ for( std::size_t ix = 0; ix < testData1Size; ++ix ){
+ testBuffer1->put( ix, testData1[ix] );
+ }
+
+ // duplicate's contents should be the same as buf
+ CharBuffer* duplicate = testBuffer1->duplicate();
+ CPPUNIT_ASSERT( testBuffer1 != duplicate );
+ CPPUNIT_ASSERT( testBuffer1->position() == duplicate->position() );
+ CPPUNIT_ASSERT( testBuffer1->limit() == duplicate->limit() );
+ CPPUNIT_ASSERT( testBuffer1->isReadOnly() == duplicate->isReadOnly() );
+
+ for( std::size_t ix; ix < testBuffer1->capacity(); ix++ ) {
+ CPPUNIT_ASSERT( testBuffer1->get( ix ) == duplicate->get( ix ) );
+ }
+
+ // duplicate's position, mark, and limit should be independent to buf
+ duplicate->reset();
+ CPPUNIT_ASSERT( duplicate->position() == 0 );
+ duplicate->clear();
+ CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->limit() );
+ testBuffer1->reset();
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+
+ delete duplicate;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testEquals() {
+
+ // equal to self
+ CPPUNIT_ASSERT( testBuffer1->equals( *testBuffer1 ) );
+ CharBuffer* readOnly = testBuffer1->asReadOnlyBuffer();
+ CPPUNIT_ASSERT( testBuffer1->equals( *readOnly ) );
+ CharBuffer* duplicate = testBuffer1->duplicate();
+ CPPUNIT_ASSERT( testBuffer1->equals( *duplicate ) );
+
+ CPPUNIT_ASSERT( testBuffer1->capacity() > SMALL_TEST_LENGTH );
+
+ testBuffer1->limit( testBuffer1->capacity() ).position( 0 );
+ readOnly->limit( readOnly->capacity() ).position( 1 );
+ CPPUNIT_ASSERT( !testBuffer1->equals( *readOnly ) );
+
+ testBuffer1->limit( testBuffer1->capacity() - 1 ).position( 0 );
+ duplicate->limit( duplicate->capacity() ).position( 0 );
+ CPPUNIT_ASSERT( !testBuffer1->equals( *duplicate ) );
+
+ delete readOnly;
+ delete duplicate;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testGet() {
+
+ testBuffer1->clear();
+
+ for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+ CPPUNIT_ASSERT( testBuffer1->position() == i );
+ CPPUNIT_ASSERT( testBuffer1->get() == testBuffer1->get(i) );
+ }
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a BufferUnderflowException",
+ testBuffer1->get(),
+ BufferUnderflowException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testGetbyteArray() {
+
+ std::vector<char> array;
+ array.resize( 1 );
+ testBuffer1->clear();
+
+ for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+
+ CPPUNIT_ASSERT( testBuffer1->position() == i );
+ CharBuffer& ret = testBuffer1->get( array );
+ CPPUNIT_ASSERT( array[0] == testBuffer1->get( i ) );
+ CPPUNIT_ASSERT( &ret == testBuffer1 );
+ }
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a BufferUnderflowException",
+ testBuffer1->get( array ),
+ BufferUnderflowException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testGetbyteArray2() {
+
+ testBuffer1->clear();
+ char* array = new char[testBuffer1->capacity()];
+ char* array2 = new char[testBuffer1->capacity() + 1];
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a BufferUnderflowException",
+ testBuffer1->get( array2, 0, testBuffer1->capacity() + 1 ),
+ BufferUnderflowException );
+
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+
+ testBuffer1->get( array, testBuffer1->capacity(), 0 );
+
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a NullPointerException",
+ testBuffer1->get( NULL, 0, 1 ),
+ NullPointerException );
+
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+
+ testBuffer1->clear();
+ CharBuffer& ret = testBuffer1->get( array, 0, testBuffer1->capacity() );
+ CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
+ for( std::size_t ix; ix < testBuffer1->capacity() - 1; ix++ ) {
+ CPPUNIT_ASSERT( testBuffer1->get( ix ) == array[ix] );
+ }
+
+ CPPUNIT_ASSERT( &ret == testBuffer1);
+
+ delete array;
+ delete array2;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testGetWithIndex() {
+
+ testBuffer1->clear();
+
+ for( std::size_t i = 0; i < testBuffer1->capacity(); i++) {
+ CPPUNIT_ASSERT( testBuffer1->position() == i );
+ CPPUNIT_ASSERT( testBuffer1->get() == testBuffer1->get(i) );
+ }
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a IndexOutOfBoundsException",
+ testBuffer1->get( testBuffer1->limit() ),
+ IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testPutbyte() {
+
+ CharBuffer* readOnly = testBuffer1->asReadOnlyBuffer();
+
+ readOnly->clear();
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a ReadOnlyBufferException",
+ readOnly->put( 0 ),
+ ReadOnlyBufferException );
+
+ delete readOnly;
+
+ testBuffer1->clear();
+ for( size_t i = 0; i < testBuffer1->capacity(); i++) {
+ CPPUNIT_ASSERT( testBuffer1->position() == i );
+ CharBuffer& ret = testBuffer1->put( i );
+ CPPUNIT_ASSERT( testBuffer1->get(i) == (char)i );
+ CPPUNIT_ASSERT( &ret == testBuffer1 );
+ }
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a BufferOverflowException",
+ testBuffer1->put( 0 ),
+ BufferOverflowException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testPutbyteArray() {
+
+ std::vector<char> array;
+ array.push_back( 127 );
+
+ CharBuffer* readOnly = testBuffer1->asReadOnlyBuffer();
+ readOnly->clear();
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a ReadOnlyBufferException",
+ readOnly->put( array ),
+ ReadOnlyBufferException );
+ delete readOnly;
+
+ testBuffer1->clear();
+ for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+ CPPUNIT_ASSERT( testBuffer1->position() == i );
+ array[0] = i;
+ CharBuffer& ret = testBuffer1->put( array );
+ CPPUNIT_ASSERT( testBuffer1->get(i) == (char)i );
+ CPPUNIT_ASSERT( &ret == testBuffer1 );
+ }
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a BufferOverflowException",
+ testBuffer1->put( array ),
+ BufferOverflowException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testPutbyteArray2() {
+
+ testBuffer1->clear();
+ char* array = new char[testBuffer1->capacity()];
+ char* array2 = new char[testBuffer1->capacity() + 1];
+
+ CharBuffer* readOnly = testBuffer1->asReadOnlyBuffer();
+ readOnly->clear();
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a ReadOnlyBufferException",
+ readOnly->put( array, 0, testBuffer1->capacity() ),
+ ReadOnlyBufferException );
+ delete readOnly;
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a BufferOverflowException",
+ testBuffer1->put( array2, 0, testBuffer1->capacity() + 1 ),
+ BufferOverflowException );
+
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+ testBuffer1->put( array, testBuffer1->capacity(), 0 );
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a NullPointerException",
+ testBuffer1->put( NULL, 2, Integer::MAX_VALUE ),
+ NullPointerException );
+
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+
+ for( std::size_t ix = 0; ix < testData1Size; ++ix ){
+ testBuffer1->put( ix, testData1[ix] );
+ }
+
+ CharBuffer& ret = testBuffer1->put( array, 0, testBuffer1->capacity() );
+ CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
+ for( std::size_t ix; ix < testBuffer1->capacity() - 1; ix++ ) {
+ CPPUNIT_ASSERT( testBuffer1->get( ix ) == array[ix] );
+ }
+ CPPUNIT_ASSERT( &ret == testBuffer1 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testPutCharBuffer() {
+
+ CharBuffer* other = CharBuffer::allocate( testBuffer1->capacity() );
+
+ CharBuffer* readOnly = testBuffer1->asReadOnlyBuffer();
+ readOnly->clear();
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a ReadOnlyBufferException",
+ readOnly->put( *other ),
+ ReadOnlyBufferException );
+ delete readOnly;
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a IllegalArgumentException",
+ testBuffer1->put( *testBuffer1 ),
+ IllegalArgumentException );
+
+ CharBuffer* toBig = testBuffer1->allocate( testBuffer1->capacity() + 1 );
+ toBig->clear();
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a BufferOverflowException",
+ testBuffer1->put( *toBig ),
+ BufferOverflowException );
+ delete toBig;
+
+ for( std::size_t ix = 0; ix < testData1Size; ++ix ){
+ other->put( ix, testData1[ix] );
+ }
+ other->clear();
+
+ testBuffer1->clear();
+ CharBuffer& ret = testBuffer1->put( *other );
+ CPPUNIT_ASSERT( other->position() == other->capacity() );
+ CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
+ for( std::size_t ix; ix < testBuffer1->capacity() - 1; ix++ ) {
+ CPPUNIT_ASSERT( testBuffer1->get( ix ) == other->get( ix ) );
+ }
+ CPPUNIT_ASSERT( &ret == testBuffer1 );
+
+ delete other;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testPutIndexed() {
+
+ CharBuffer* readOnly = testBuffer1->asReadOnlyBuffer();
+ readOnly->clear();
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a ReadOnlyBufferException",
+ readOnly->put( 0, 0 ),
+ ReadOnlyBufferException );
+ delete readOnly;
+
+ testBuffer1->clear();
+
+ for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+ CPPUNIT_ASSERT( testBuffer1->position() == 0 );
+ CharBuffer& ret = testBuffer1->put(i, i );
+ CPPUNIT_ASSERT( testBuffer1->get(i) == (char)i );
+ CPPUNIT_ASSERT( &ret == testBuffer1 );
+ }
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a IndexOutOfBoundsException",
+ testBuffer1->put( testBuffer1->limit(), 0 ),
+ IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testSlice() {
+
+ CPPUNIT_ASSERT( testBuffer1->capacity() > SMALL_TEST_LENGTH );
+ testBuffer1->position( 1 );
+ testBuffer1->limit( testBuffer1->capacity() - 1 );
+
+ CharBuffer* slice = testBuffer1->slice();
+ CPPUNIT_ASSERT( testBuffer1->isReadOnly() == slice->isReadOnly() );
+ CPPUNIT_ASSERT( slice->position() == 0 );
+ CPPUNIT_ASSERT( slice->limit() == testBuffer1->remaining() );
+ CPPUNIT_ASSERT( slice->capacity() == testBuffer1->remaining() );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a InvalidMarkException",
+ slice->reset(),
+ InvalidMarkException );
+
+ // slice share the same content with buf
+ for( std::size_t ix = 0; ix < slice->capacity(); ++ix ){
+ slice->put( ix, testData1[ix] );
+ }
+
+ std::cout << "\n TestBuffer1 = " << testBuffer1->toString();
+ std::cout << "\n slice = " << slice->toString();
+ std::cout << "\n slice says its capacity is = " << slice->capacity();
+
+ for( std::size_t ix = 0; ix < slice->capacity(); ix++ ) {
+ std::cout << "TestBuffer1 get index = " << ix + 1
+ << ", slice get index = " << ix << "\n";
+ CPPUNIT_ASSERT( testBuffer1->get( ix + 1 ) == slice->get( ix ) );
+ }
+ testBuffer1->put( 2, 100 );
+ CPPUNIT_ASSERT( slice->get(1) == 100 );
+
+ delete slice;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testToString() {
+
+ string expected = "";
+ for( std::size_t i = testBuffer1->position(); i < testBuffer1->limit(); i++ ) {
+ expected += testBuffer1->get(i);
+ }
+ string str = testBuffer1->toString();
+ CPPUNIT_ASSERT( expected == str );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharArrayBufferTest::testWrapNullArray() {
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should throw a NullPointerException",
+ testBuffer1->wrap( (char*)NULL, 0, 3 ),
+ NullPointerException );
+}
Added: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h?rev=601461&view=auto
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h (added)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h Wed Dec 5 10:30:14 2007
@@ -0,0 +1,108 @@
+/*
+ * 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_INTERNAL_NIO_CHARARRAYBUFFERTEST_H_
+#define _DECAF_INTERNAL_NIO_CHARARRAYBUFFERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <decaf/nio/CharBuffer.h>
+
+namespace decaf{
+namespace internal{
+namespace nio{
+
+ class CharArrayBufferTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( CharArrayBufferTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST( testArray );
+ CPPUNIT_TEST( testArrayOffset );
+ CPPUNIT_TEST( testReadOnlyArray );
+ CPPUNIT_TEST( testAsReadOnlyBuffer );
+ CPPUNIT_TEST( testCompact );
+ CPPUNIT_TEST( testCompareTo );
+ CPPUNIT_TEST( testDuplicate );
+ CPPUNIT_TEST( testEquals );
+ CPPUNIT_TEST( testGet );
+ CPPUNIT_TEST( testGetbyteArray );
+ CPPUNIT_TEST( testGetbyteArray2 );
+ CPPUNIT_TEST( testGetWithIndex );
+ CPPUNIT_TEST( testPutbyte );
+ CPPUNIT_TEST( testPutbyteArray );
+ CPPUNIT_TEST( testPutbyteArray2 );
+ CPPUNIT_TEST( testPutCharBuffer );
+ CPPUNIT_TEST( testPutIndexed );
+ CPPUNIT_TEST( testSlice );
+ CPPUNIT_TEST( testToString );
+ CPPUNIT_TEST( testWrapNullArray );
+ CPPUNIT_TEST_SUITE_END();
+
+ decaf::nio::CharBuffer* testBuffer1;
+ char* testData1;
+
+ static const std::size_t testData1Size = 100;
+ static const std::size_t SMALL_TEST_LENGTH = 5;
+ static const std::size_t BUFFER_LENGTH = 250;
+
+ public:
+
+ CharArrayBufferTest() {}
+ virtual ~CharArrayBufferTest() {}
+
+ void setUp() {
+ testBuffer1 = decaf::nio::CharBuffer::allocate( testData1Size );
+
+ testData1 = new char[testData1Size];
+ for( std::size_t i = 0; i < testData1Size; ++i ){
+ testData1[i] = (char)i;
+ }
+ }
+
+ void tearDown() {
+ delete testBuffer1;
+ delete testData1;
+ }
+
+ void test();
+ void testArray();
+ void testArrayOffset();
+ void testReadOnlyArray();
+ void testAsReadOnlyBuffer();
+ void testCompact();
+ void testCompareTo();
+ void testDuplicate();
+ void testEquals();
+ void testGet();
+ void testGetbyteArray();
+ void testGetbyteArray2();
+ void testGetWithIndex();
+ void testPutbyte();
+ void testPutbyteArray();
+ void testPutbyteArray2();
+ void testPutCharBuffer();
+ void testPutIndexed();
+ void testSlice();
+ void testToString();
+ void testWrapNullArray();
+
+ };
+
+}}}
+
+#endif /*_DECAF_INTERNAL_NIO_CHARARRAYBUFFERTEST_H_*/
Modified: activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp?rev=601461&r1=601460&r2=601461&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp Wed Dec 5 10:30:14 2007
@@ -26,6 +26,8 @@
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/nio/BufferTest.h>
CPPUNIT_TEST_SUITE_REGISTRATION( decaf::nio::BufferTest );