activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r925692 [13/14] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/commands/ main/activemq/io/ main/activemq/wireformat/openwire/ main/activemq/wireformat/openwire/marshal/ main/decaf/internal/io/ main/decaf/internal/ni...
Date Sat, 20 Mar 2010 21:57:24 GMT
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.cpp Sat Mar 20 21:57:20 2010
@@ -28,6 +28,11 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
+const int IntArrayBufferTest::testData1Size = 100;
+const int IntArrayBufferTest::SMALL_TEST_LENGTH = 5;
+const int IntArrayBufferTest::BUFFER_LENGTH = 250;
+
+////////////////////////////////////////////////////////////////////////////////
 void IntArrayBufferTest::test() {
 
     // Check that we have setup the array and our initial assumptions on state
@@ -127,7 +132,7 @@ void IntArrayBufferTest::testAsReadOnlyB
     CPPUNIT_ASSERT( testBuffer1->position() == readOnly->position() );
     CPPUNIT_ASSERT( testBuffer1->limit() == readOnly->limit() );
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); ++i ) {
+    for( int i = 0; i < testBuffer1->capacity(); ++i ) {
         CPPUNIT_ASSERT( testBuffer1->get( i ) == readOnly->get( i ) );
     }
 
@@ -296,7 +301,7 @@ void IntArrayBufferTest::testEquals() {
 void IntArrayBufferTest::testGet() {
 
     testBuffer1->clear();
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         CPPUNIT_ASSERT( testBuffer1->get() == testBuffer1->get(i) );
     }
@@ -313,7 +318,7 @@ void IntArrayBufferTest::testGetIntArray
     std::vector<int> array(1);
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         IntBuffer& ret = testBuffer1->get( array );
         CPPUNIT_ASSERT( array[0] == testBuffer1->get(i) );
@@ -330,44 +335,81 @@ void IntArrayBufferTest::testGetIntArray
 void IntArrayBufferTest::testGetIntArray2() {
 
     testBuffer1->clear();
-    int* array = new int[testBuffer1->capacity()];
+    int* array1 = new int[testBuffer1->capacity()];
+    int* array2 = new int[testBuffer1->capacity() + 1];
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw BufferUnderflowException",
-        testBuffer1->get( array, 0, testBuffer1->capacity() + 1 ),
+        testBuffer1->get( array2, testBuffer1->capacity() + 1, 0, testBuffer1->capacity() + 1 ),
         BufferUnderflowException );
 
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
-    testBuffer1->get( array, 10, 0 );
+    testBuffer1->get( array1, testBuffer1->capacity(), 10, 0 );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
-        "Should throw BufferUnderflowException",
-        testBuffer1->get( array, 1, Integer::MAX_VALUE ),
-        BufferUnderflowException );
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), -1, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), testBuffer1->capacity() + 1, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), 2, -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), 2, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), Integer::MAX_VALUE, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw NullPointerException",
+        testBuffer1->get( NULL, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        NullPointerException );
 
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
     testBuffer1->clear();
-    IntBuffer& ret = testBuffer1->get( array, 0, testBuffer1->capacity() );
+    IntBuffer& ret = testBuffer1->get( array1, testBuffer1->capacity(), 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
-    assertContentEquals( testBuffer1, array, 0, testBuffer1->capacity() );
+    assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( &ret == testBuffer1 );
 
-    delete [] array;
+    delete [] array1;
+    delete [] array2;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void IntArrayBufferTest::testGet2() {
 
     testBuffer1->clear();
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         CPPUNIT_ASSERT( testBuffer1->get() == testBuffer1->get(i) );
     }
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
         testBuffer1->get( testBuffer1->limit() ),
         IndexOutOfBoundsException );
 }
@@ -382,7 +424,7 @@ void IntArrayBufferTest::testPutInt() {
 
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++) {
+    for( int i = 0; i < testBuffer1->capacity(); i++) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         IntBuffer& ret = testBuffer1->put( (int)i );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (int)i );
@@ -401,17 +443,17 @@ void IntArrayBufferTest::testPutIntArray
     int* array = new int[1];
 
     testBuffer1->clear();
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         array[0] = (int) i;
-        IntBuffer& ret = testBuffer1->put( array, 0, 1 );
+        IntBuffer& ret = testBuffer1->put( array, 1, 0, 1 );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (int)i );
         CPPUNIT_ASSERT( &ret == testBuffer1 );
     }
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw BufferOverflowException",
-        testBuffer1->put( array, 0, 1 ),
+        testBuffer1->put( array, 1, 0, 1 ),
         BufferOverflowException );
 
     delete [] array;
@@ -426,18 +468,53 @@ void IntArrayBufferTest::testPutIntArray
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw BufferOverflowException",
-        testBuffer1->put( array2, 0, testBuffer1->capacity() + 1 ),
+        testBuffer1->put( array2, testBuffer1->capacity() + 1, 0, testBuffer1->capacity() + 1 ),
         BufferOverflowException );
 
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
-    testBuffer1->put( array1, testBuffer1->capacity() + 1, 0 );
+    testBuffer1->put( array1, testBuffer1->capacity(), testBuffer1->capacity() + 1, 0 );
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), -1, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), testBuffer1->capacity() + 1, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), 2, -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), 2, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), Integer::MAX_VALUE, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw NullPointerException",
+        testBuffer1->put( NULL, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        NullPointerException );
+
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
     loadTestData2( array1, 0, testBuffer1->capacity() );
-    IntBuffer& ret = testBuffer1->put( array1, 0, testBuffer1->capacity() );
+    IntBuffer& ret = testBuffer1->put( array1, testBuffer1->capacity(), 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
     assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( &ret == testBuffer1 );
@@ -481,7 +558,7 @@ void IntArrayBufferTest::testGetWithInde
 
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == 0 );
         IntBuffer& ret = testBuffer1->put( i, (int)i );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (int)i );
@@ -490,6 +567,11 @@ void IntArrayBufferTest::testGetWithInde
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( -1, 0 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
         testBuffer1->put( testBuffer1->limit(), 0 ),
         IndexOutOfBoundsException );
 }
@@ -507,7 +589,7 @@ void IntArrayBufferTest::testPutIndexed(
 
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == 0 );
         IntBuffer& ret = testBuffer1->put( i, (int)i );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (int)i );
@@ -516,6 +598,11 @@ void IntArrayBufferTest::testPutIndexed(
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw a IndexOutOfBoundsException",
+        testBuffer1->put( -1, 0 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a IndexOutOfBoundsException",
         testBuffer1->put( testBuffer1->limit(), 0 ),
         IndexOutOfBoundsException );
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.h Sat Mar 20 21:57:20 2010
@@ -57,9 +57,9 @@ namespace nio{
         decaf::nio::IntBuffer* testBuffer1;
         int* 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;
+        static const int testData1Size;
+        static const int SMALL_TEST_LENGTH;
+        static const int BUFFER_LENGTH;
 
     public:
 
@@ -70,7 +70,7 @@ namespace nio{
             testBuffer1 = decaf::nio::IntBuffer::allocate( testData1Size );
 
             testData1 = new int[testData1Size];
-            for( std::size_t i = 0; i < testData1Size; ++i ){
+            for( int i = 0; i < testData1Size; ++i ){
                 testData1[i] = (int)i;
             }
         }
@@ -105,36 +105,36 @@ namespace nio{
 
     protected:
 
-        void loadTestData1( int* array, std::size_t offset, std::size_t length ) {
-            for( std::size_t i = 0; i < length; i++ ) {
+        void loadTestData1( int* array, int offset, int length ) {
+            for( int i = 0; i < length; i++ ) {
                 array[offset + i] = (int)i;
             }
         }
 
-        void loadTestData2( int* array, std::size_t offset, std::size_t length ) {
-            for( std::size_t i = 0; i < length; i++ ) {
+        void loadTestData2( int* array, int offset, int length ) {
+            for( int i = 0; i < length; i++ ) {
                 array[offset + i] = (int)(length - i);
             }
         }
 
         void loadTestData1( decaf::nio::IntBuffer* buf ) {
             buf->clear();
-            for( std::size_t i = 0; i < buf->capacity(); i++ ) {
+            for( int i = 0; i < buf->capacity(); i++ ) {
                 buf->put( i, (int)i );
             }
         }
 
         void loadTestData2( decaf::nio::IntBuffer* buf ) {
             buf->clear();
-            for( std::size_t i = 0; i < buf->capacity(); i++ ) {
+            for( int i = 0; i < buf->capacity(); i++ ) {
                 buf->put(i, (int)( buf->capacity() - i) );
             }
         }
 
         void assertContentEquals( decaf::nio::IntBuffer* buf, int* array,
-                                  std::size_t offset, std::size_t length) {
+                                  int offset, int length) {
 
-            for( std::size_t i = 0; i < length; i++ ) {
+            for( int i = 0; i < length; i++ ) {
                 CPPUNIT_ASSERT( buf->get(i) == array[offset + i] );
             }
         }
@@ -142,17 +142,17 @@ namespace nio{
         void assertContentEquals( decaf::nio::IntBuffer* buf,
                                   decaf::nio::IntBuffer* other ) {
             CPPUNIT_ASSERT( buf->capacity() == other->capacity() );
-            for( std::size_t i = 0; i < buf->capacity(); i++ ) {
+            for( int i = 0; i < buf->capacity(); i++ ) {
                 CPPUNIT_ASSERT(buf->get(i) == other->get(i) );
             }
         }
 
         void assertContentLikeTestData1(
-            decaf::nio::IntBuffer* buf, std::size_t startIndex,
-            int startValue, std::size_t length ) {
+            decaf::nio::IntBuffer* buf, int startIndex,
+            int startValue, int length ) {
 
             int value = startValue;
-            for( std::size_t i = 0; i < length; i++ ) {
+            for( int i = 0; i < length; i++ ) {
                 CPPUNIT_ASSERT( buf->get( startIndex + i ) == value );
                 value = value + 1;
             }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.cpp Sat Mar 20 21:57:20 2010
@@ -29,6 +29,11 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
+const int LongArrayBufferTest::testData1Size = 100;
+const int LongArrayBufferTest::SMALL_TEST_LENGTH = 5;
+const int LongArrayBufferTest::BUFFER_LENGTH = 250;
+
+////////////////////////////////////////////////////////////////////////////////
 void LongArrayBufferTest::test() {
 
     // Check that we have setup the array and our initial assumptions on state
@@ -128,7 +133,7 @@ void LongArrayBufferTest::testAsReadOnly
     CPPUNIT_ASSERT( testBuffer1->position() == readOnly->position() );
     CPPUNIT_ASSERT( testBuffer1->limit() == readOnly->limit() );
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); ++i ) {
+    for( int i = 0; i < testBuffer1->capacity(); ++i ) {
         CPPUNIT_ASSERT( testBuffer1->get( i ) == readOnly->get( i ) );
     }
 
@@ -297,7 +302,7 @@ void LongArrayBufferTest::testEquals() {
 void LongArrayBufferTest::testGet() {
 
     testBuffer1->clear();
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         CPPUNIT_ASSERT( testBuffer1->get() == testBuffer1->get(i) );
     }
@@ -314,7 +319,7 @@ void LongArrayBufferTest::testGetLongArr
     std::vector<long long> array(1);
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         LongBuffer& ret = testBuffer1->get( array );
         CPPUNIT_ASSERT( array[0] == testBuffer1->get(i) );
@@ -331,44 +336,81 @@ void LongArrayBufferTest::testGetLongArr
 void LongArrayBufferTest::testGetLongArray2() {
 
     testBuffer1->clear();
-    long long* array = new long long[testBuffer1->capacity()];
+    long long* array1 = new long long[testBuffer1->capacity()];
+    long long* array2 = new long long[testBuffer1->capacity() + 1];
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw BufferUnderflowException",
-        testBuffer1->get( array, 0, testBuffer1->capacity() + 1 ),
+        testBuffer1->get( array2, testBuffer1->capacity() + 1, 0, testBuffer1->capacity() + 1 ),
         BufferUnderflowException );
 
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
-    testBuffer1->get( array, 10, 0 );
+    testBuffer1->get( array1, testBuffer1->capacity(), 10, 0 );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
-        "Should throw BufferUnderflowException",
-        testBuffer1->get( array, 1, Integer::MAX_VALUE ),
-        BufferUnderflowException );
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), -1, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), testBuffer1->capacity() + 1, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), 2, -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), 2, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), Integer::MAX_VALUE, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw NullPointerException",
+        testBuffer1->get( NULL, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        NullPointerException );
 
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
     testBuffer1->clear();
-    LongBuffer& ret = testBuffer1->get( array, 0, testBuffer1->capacity() );
+    LongBuffer& ret = testBuffer1->get( array1, testBuffer1->capacity(), 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
-    assertContentEquals( testBuffer1, array, 0, testBuffer1->capacity() );
+    assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( &ret == testBuffer1 );
 
-    delete [] array;
+    delete [] array1;
+    delete [] array2;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void LongArrayBufferTest::testGet2() {
 
     testBuffer1->clear();
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         CPPUNIT_ASSERT( testBuffer1->get() == testBuffer1->get(i) );
     }
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
         testBuffer1->get( testBuffer1->limit() ),
         IndexOutOfBoundsException );
 }
@@ -383,7 +425,7 @@ void LongArrayBufferTest::testPutLong() 
 
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++) {
+    for( int i = 0; i < testBuffer1->capacity(); i++) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         LongBuffer& ret = testBuffer1->put( (long long)i );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (long long)i );
@@ -402,17 +444,17 @@ void LongArrayBufferTest::testPutLongArr
     long long* array = new long long[1];
 
     testBuffer1->clear();
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         array[0] = (long long) i;
-        LongBuffer& ret = testBuffer1->put( array, 0, 1 );
+        LongBuffer& ret = testBuffer1->put( array, 1, 0, 1 );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (long long)i );
         CPPUNIT_ASSERT( &ret == testBuffer1 );
     }
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw BufferOverflowException",
-        testBuffer1->put( array, 0, 1 ),
+        testBuffer1->put( array, 1, 0, 1 ),
         BufferOverflowException );
 
     delete [] array;
@@ -427,18 +469,53 @@ void LongArrayBufferTest::testPutLongArr
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw BufferOverflowException",
-        testBuffer1->put( array2, 0, testBuffer1->capacity() + 1 ),
+        testBuffer1->put( array2, testBuffer1->capacity() + 1, 0, testBuffer1->capacity() + 1 ),
         BufferOverflowException );
 
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
-    testBuffer1->put( array1, testBuffer1->capacity() + 1, 0 );
+    testBuffer1->put( array1, testBuffer1->capacity(), testBuffer1->capacity() + 1, 0 );
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), -1, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), testBuffer1->capacity() + 1, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), 2, -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), 2, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), Integer::MAX_VALUE, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw NullPointerException",
+        testBuffer1->put( NULL, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        NullPointerException );
+
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
     loadTestData2( array1, 0, testBuffer1->capacity() );
-    LongBuffer& ret = testBuffer1->put( array1, 0, testBuffer1->capacity() );
+    LongBuffer& ret = testBuffer1->put( array1, testBuffer1->capacity(), 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
     assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( &ret == testBuffer1 );
@@ -482,7 +559,7 @@ void LongArrayBufferTest::testGetWithInd
 
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == 0 );
         LongBuffer& ret = testBuffer1->put( i, (long long)i );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (long long)i );
@@ -491,6 +568,11 @@ void LongArrayBufferTest::testGetWithInd
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( -1, 0 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
         testBuffer1->put( testBuffer1->limit(), 0 ),
         IndexOutOfBoundsException );
 }
@@ -508,7 +590,7 @@ void LongArrayBufferTest::testPutIndexed
 
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == 0 );
         LongBuffer& ret = testBuffer1->put(i, i );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (long long)i );
@@ -517,6 +599,11 @@ void LongArrayBufferTest::testPutIndexed
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw a IndexOutOfBoundsException",
+        testBuffer1->put( -1, 0 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a IndexOutOfBoundsException",
         testBuffer1->put( testBuffer1->limit(), 0 ),
         IndexOutOfBoundsException );
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.h Sat Mar 20 21:57:20 2010
@@ -57,9 +57,9 @@ namespace nio{
         decaf::nio::LongBuffer* testBuffer1;
         long long* 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;
+        static const int testData1Size;
+        static const int SMALL_TEST_LENGTH;
+        static const int BUFFER_LENGTH;
 
     public:
 
@@ -70,7 +70,7 @@ namespace nio{
             testBuffer1 = decaf::nio::LongBuffer::allocate( testData1Size );
 
             testData1 = new long long[testData1Size];
-            for( std::size_t i = 0; i < testData1Size; ++i ){
+            for( int i = 0; i < testData1Size; ++i ){
                 testData1[i] = (long long)i;
             }
         }
@@ -105,36 +105,36 @@ namespace nio{
 
     protected:
 
-        void loadTestData1( long long* array, std::size_t offset, std::size_t length ) {
-            for( std::size_t i = 0; i < length; i++ ) {
+        void loadTestData1( long long* array, int offset, int length ) {
+            for( int i = 0; i < length; i++ ) {
                 array[offset + i] = (long long)i;
             }
         }
 
-        void loadTestData2( long long* array, std::size_t offset, std::size_t length ) {
-            for( std::size_t i = 0; i < length; i++ ) {
+        void loadTestData2( long long* array, int offset, int length ) {
+            for( int i = 0; i < length; i++ ) {
                 array[offset + i] = (long long)length - i;
             }
         }
 
         void loadTestData1( decaf::nio::LongBuffer* buf ) {
             buf->clear();
-            for( std::size_t i = 0; i < buf->capacity(); i++ ) {
+            for( int i = 0; i < buf->capacity(); i++ ) {
                 buf->put( i, (long long)i );
             }
         }
 
         void loadTestData2( decaf::nio::LongBuffer* buf ) {
             buf->clear();
-            for( std::size_t i = 0; i < buf->capacity(); i++ ) {
+            for( int i = 0; i < buf->capacity(); i++ ) {
                 buf->put(i, (long long) buf->capacity() - i);
             }
         }
 
         void assertContentEquals( decaf::nio::LongBuffer* buf, long long* array,
-                                  std::size_t offset, std::size_t length) {
+                                  int offset, int length) {
 
-            for( std::size_t i = 0; i < length; i++ ) {
+            for( int i = 0; i < length; i++ ) {
                 CPPUNIT_ASSERT( buf->get(i) == array[offset + i] );
             }
         }
@@ -142,17 +142,17 @@ namespace nio{
         void assertContentEquals( decaf::nio::LongBuffer* buf,
                                   decaf::nio::LongBuffer* other ) {
             CPPUNIT_ASSERT( buf->capacity() == other->capacity() );
-            for( std::size_t i = 0; i < buf->capacity(); i++ ) {
+            for( int i = 0; i < buf->capacity(); i++ ) {
                 CPPUNIT_ASSERT(buf->get(i) == other->get(i) );
             }
         }
 
         void assertContentLikeTestData1(
-            decaf::nio::LongBuffer* buf, std::size_t startIndex,
-            long long startValue, std::size_t length ) {
+            decaf::nio::LongBuffer* buf, int startIndex,
+            long long startValue, int length ) {
 
             long long value = startValue;
-            for( std::size_t i = 0; i < length; i++ ) {
+            for( int i = 0; i < length; i++ ) {
                 CPPUNIT_ASSERT( buf->get( startIndex + i ) == value );
                 value = value + 1;
             }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp Sat Mar 20 21:57:20 2010
@@ -28,6 +28,11 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
+const int ShortArrayBufferTest::testData1Size = 100;
+const int ShortArrayBufferTest::SMALL_TEST_LENGTH = 5;
+const int ShortArrayBufferTest::BUFFER_LENGTH = 250;
+
+////////////////////////////////////////////////////////////////////////////////
 void ShortArrayBufferTest::test() {
 
     // Check that we have setup the array and our initial assumptions on state
@@ -127,7 +132,7 @@ void ShortArrayBufferTest::testAsReadOnl
     CPPUNIT_ASSERT( testBuffer1->position() == readOnly->position() );
     CPPUNIT_ASSERT( testBuffer1->limit() == readOnly->limit() );
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); ++i ) {
+    for( int i = 0; i < testBuffer1->capacity(); ++i ) {
         CPPUNIT_ASSERT( testBuffer1->get( i ) == readOnly->get( i ) );
     }
 
@@ -296,7 +301,7 @@ void ShortArrayBufferTest::testEquals() 
 void ShortArrayBufferTest::testGet() {
 
     testBuffer1->clear();
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         CPPUNIT_ASSERT( testBuffer1->get() == testBuffer1->get(i) );
     }
@@ -313,7 +318,7 @@ void ShortArrayBufferTest::testGetShortA
     std::vector<short> array(1);
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         ShortBuffer& ret = testBuffer1->get( array );
         CPPUNIT_ASSERT( array[0] == testBuffer1->get(i) );
@@ -330,38 +335,70 @@ void ShortArrayBufferTest::testGetShortA
 void ShortArrayBufferTest::testGetShortArray2() {
 
     testBuffer1->clear();
-    short* array = new short[testBuffer1->capacity()];
+    short* array1 = new short[testBuffer1->capacity()];
+    short* array2 = new short[testBuffer1->capacity() + 1];
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw BufferUnderflowException",
-        testBuffer1->get( array, 0, testBuffer1->capacity() + 1 ),
+        testBuffer1->get( array2, testBuffer1->capacity() + 1, 0, testBuffer1->capacity() + 1 ),
         BufferUnderflowException );
 
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
-    testBuffer1->get( array, 10, 0 );
+    testBuffer1->get( array1, testBuffer1->capacity(), 10, 0 );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
-        "Should throw BufferUnderflowException",
-        testBuffer1->get( array, 1, Integer::MAX_VALUE ),
-        BufferUnderflowException );
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), -1, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), testBuffer1->capacity() + 1, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), 2, -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), 2, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( array1, testBuffer1->capacity(), Integer::MAX_VALUE, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw NullPointerException",
+        testBuffer1->get( NULL, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        NullPointerException );
 
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
     testBuffer1->clear();
-    ShortBuffer& ret = testBuffer1->get( array, 0, testBuffer1->capacity() );
+    ShortBuffer& ret = testBuffer1->get( array1, testBuffer1->capacity(), 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
-    assertContentEquals( testBuffer1, array, 0, testBuffer1->capacity() );
+    assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( &ret == testBuffer1 );
 
-    delete [] array;
+    delete [] array1;
+    delete [] array2;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void ShortArrayBufferTest::testGet2() {
 
     testBuffer1->clear();
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         CPPUNIT_ASSERT( testBuffer1->get() == testBuffer1->get(i) );
     }
@@ -370,6 +407,11 @@ void ShortArrayBufferTest::testGet2() {
         "Should throw IndexOutOfBoundsException",
         testBuffer1->get( testBuffer1->limit() ),
         IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->get( -1 ),
+        IndexOutOfBoundsException );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -382,7 +424,7 @@ void ShortArrayBufferTest::testPutShort(
 
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++) {
+    for( int i = 0; i < testBuffer1->capacity(); i++) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         ShortBuffer& ret = testBuffer1->put( (short)i );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (short)i );
@@ -401,17 +443,17 @@ void ShortArrayBufferTest::testPutShortA
     short* array = new short[1];
 
     testBuffer1->clear();
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == i );
         array[0] = (short) i;
-        ShortBuffer& ret = testBuffer1->put( array, 0, 1 );
+        ShortBuffer& ret = testBuffer1->put( array, 1, 0, 1 );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (short)i );
         CPPUNIT_ASSERT( &ret == testBuffer1 );
     }
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw BufferOverflowException",
-        testBuffer1->put( array, 0, 1 ),
+        testBuffer1->put( array, 1, 0, 1 ),
         BufferOverflowException );
 
     delete [] array;
@@ -426,18 +468,53 @@ void ShortArrayBufferTest::testPutShortA
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw BufferOverflowException",
-        testBuffer1->put( array2, 0, testBuffer1->capacity() + 1 ),
+        testBuffer1->put( array2, testBuffer1->capacity() + 1, 0, testBuffer1->capacity() + 1 ),
         BufferOverflowException );
 
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
-    testBuffer1->put( array1, testBuffer1->capacity() + 1, 0 );
+    testBuffer1->put( array1, testBuffer1->capacity(), testBuffer1->capacity() + 1, 0 );
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), -1, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), testBuffer1->capacity() + 1, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), 2, -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), 2, testBuffer1->capacity() ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( array1, testBuffer1->capacity(), Integer::MAX_VALUE, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw NullPointerException",
+        testBuffer1->put( NULL, testBuffer1->capacity(), 1, Integer::MAX_VALUE ),
+        NullPointerException );
+
     CPPUNIT_ASSERT( testBuffer1->position() == 0 );
 
     loadTestData2( array1, 0, testBuffer1->capacity() );
-    ShortBuffer& ret = testBuffer1->put( array1, 0, testBuffer1->capacity() );
+    ShortBuffer& ret = testBuffer1->put( array1, testBuffer1->capacity(), 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
     assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
     CPPUNIT_ASSERT( &ret == testBuffer1 );
@@ -481,7 +558,7 @@ void ShortArrayBufferTest::testGetWithIn
 
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == 0 );
         ShortBuffer& ret = testBuffer1->put( i, (short)i );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (short)i );
@@ -490,6 +567,11 @@ void ShortArrayBufferTest::testGetWithIn
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should throw IndexOutOfBoundsException",
+        testBuffer1->put( -1, 0 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw IndexOutOfBoundsException",
         testBuffer1->put( testBuffer1->limit(), 0 ),
         IndexOutOfBoundsException );
 }
@@ -507,7 +589,7 @@ void ShortArrayBufferTest::testPutIndexe
 
     testBuffer1->clear();
 
-    for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
+    for( int i = 0; i < testBuffer1->capacity(); i++ ) {
         CPPUNIT_ASSERT( testBuffer1->position() == 0 );
         ShortBuffer& ret = testBuffer1->put( i, (short)i );
         CPPUNIT_ASSERT( testBuffer1->get(i) == (short)i );
@@ -518,6 +600,11 @@ void ShortArrayBufferTest::testPutIndexe
         "Should throw a IndexOutOfBoundsException",
         testBuffer1->put( testBuffer1->limit(), 0 ),
         IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a IndexOutOfBoundsException",
+        testBuffer1->put( -1, 0 ),
+        IndexOutOfBoundsException );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.h Sat Mar 20 21:57:20 2010
@@ -57,9 +57,9 @@ namespace nio{
         decaf::nio::ShortBuffer* testBuffer1;
         short* 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;
+        static const int testData1Size;
+        static const int SMALL_TEST_LENGTH;
+        static const int BUFFER_LENGTH;
 
     public:
 
@@ -70,7 +70,7 @@ namespace nio{
             testBuffer1 = decaf::nio::ShortBuffer::allocate( testData1Size );
 
             testData1 = new short[testData1Size];
-            for( std::size_t i = 0; i < testData1Size; ++i ){
+            for( int i = 0; i < testData1Size; ++i ){
                 testData1[i] = (short)i;
             }
         }
@@ -105,36 +105,36 @@ namespace nio{
 
     protected:
 
-        void loadTestData1( short* array, std::size_t offset, std::size_t length ) {
-            for( std::size_t i = 0; i < length; i++ ) {
+        void loadTestData1( short* array, int offset, int length ) {
+            for( int i = 0; i < length; i++ ) {
                 array[offset + i] = (short)i;
             }
         }
 
-        void loadTestData2( short* array, std::size_t offset, std::size_t length ) {
-            for( std::size_t i = 0; i < length; i++ ) {
+        void loadTestData2( short* array, int offset, int length ) {
+            for( int i = 0; i < length; i++ ) {
                 array[offset + i] = (short)(length - i);
             }
         }
 
         void loadTestData1( decaf::nio::ShortBuffer* buf ) {
             buf->clear();
-            for( std::size_t i = 0; i < buf->capacity(); i++ ) {
+            for( int i = 0; i < buf->capacity(); i++ ) {
                 buf->put( i, (short)i );
             }
         }
 
         void loadTestData2( decaf::nio::ShortBuffer* buf ) {
             buf->clear();
-            for( std::size_t i = 0; i < buf->capacity(); i++ ) {
+            for( int i = 0; i < buf->capacity(); i++ ) {
                 buf->put(i, (short)( buf->capacity() - i) );
             }
         }
 
         void assertContentEquals( decaf::nio::ShortBuffer* buf, short* array,
-                                  std::size_t offset, std::size_t length) {
+                                  int offset, int length) {
 
-            for( std::size_t i = 0; i < length; i++ ) {
+            for( int i = 0; i < length; i++ ) {
                 CPPUNIT_ASSERT( buf->get(i) == array[offset + i] );
             }
         }
@@ -142,17 +142,17 @@ namespace nio{
         void assertContentEquals( decaf::nio::ShortBuffer* buf,
                                   decaf::nio::ShortBuffer* other ) {
             CPPUNIT_ASSERT( buf->capacity() == other->capacity() );
-            for( std::size_t i = 0; i < buf->capacity(); i++ ) {
+            for( int i = 0; i < buf->capacity(); i++ ) {
                 CPPUNIT_ASSERT(buf->get(i) == other->get(i) );
             }
         }
 
         void assertContentLikeTestData1(
-            decaf::nio::ShortBuffer* buf, std::size_t startIndex,
-            short startValue, std::size_t length ) {
+            decaf::nio::ShortBuffer* buf, int startIndex,
+            short startValue, int length ) {
 
             short value = startValue;
-            for( std::size_t i = 0; i < length; i++ ) {
+            for( int i = 0; i < length; i++ ) {
                 CPPUNIT_ASSERT( buf->get( startIndex + i ) == value );
                 value = value + 1;
             }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp Sat Mar 20 21:57:20 2010
@@ -32,16 +32,16 @@ void ByteArrayAdapterTest::testArray() {
 
     ByteArrayAdapter testBuffer1( testData1Size );
 
-    testBuffer1.write( testData1, 0, testData1Size );
+    testBuffer1.write( testData1, testData1Size, 0, testData1Size );
 
-    for( std::size_t ix = 0; ix < testBuffer1.getCapacity(); ++ix ) {
+    for( int ix = 0; ix < testBuffer1.getCapacity(); ++ix ) {
         CPPUNIT_ASSERT( testBuffer1.get( ix ) == testData1[ix] );
     }
 
     unsigned char* array = testBuffer1.getByteArray();
     CPPUNIT_ASSERT( array != NULL );
 
-    for( std::size_t ix = 0; ix < testBuffer1.getCapacity(); ++ix ) {
+    for( int ix = 0; ix < testBuffer1.getCapacity(); ++ix ) {
         CPPUNIT_ASSERT( array[ix] == testData1[ix] );
     }
 }
@@ -59,7 +59,7 @@ void ByteArrayAdapterTest::testRead(){
     CPPUNIT_ASSERT( array.getCapacity() == 256 );
 
     unsigned char* result = new unsigned char[256];
-    array.read( result, 0, 256 );
+    array.read( result, 256, 0, 256 );
 
     for( int i = 0; i < 256; ++i ){
         CPPUNIT_ASSERT( data[i] == result[i] );
@@ -77,13 +77,13 @@ void ByteArrayAdapterTest::testWrite(){
         data[i] = i;
     }
 
-    ByteArrayAdapter array( (std::size_t)256 );
+    ByteArrayAdapter array( (int)256 );
 
     CPPUNIT_ASSERT( array.getCapacity() == 256 );
 
-    array.write( data, 0, 256 );
+    array.write( data, 256, 0, 256 );
     unsigned char* result = new unsigned char[256];
-    array.read( result, 0, 256 );
+    array.read( result, 256, 0, 256 );
 
     for( int i = 0; i < 256; ++i ){
         CPPUNIT_ASSERT( data[i] == result[i] );
@@ -96,13 +96,13 @@ void ByteArrayAdapterTest::testWrite(){
 ////////////////////////////////////////////////////////////////////////////////
 void ByteArrayAdapterTest::testCtor1(){
 
-    ByteArrayAdapter array1( (std::size_t)256 );
+    ByteArrayAdapter array1( 256 );
     CPPUNIT_ASSERT( array1.getCapacity() == 256 );
-    ByteArrayAdapter array2( (std::size_t)54 );
+    ByteArrayAdapter array2( 54 );
     CPPUNIT_ASSERT( array2.getCapacity() == 54 );
-    ByteArrayAdapter array3( (std::size_t)5555 );
+    ByteArrayAdapter array3( 5555 );
     CPPUNIT_ASSERT( array3.getCapacity() == 5555 );
-    ByteArrayAdapter array4( (std::size_t)0 );
+    ByteArrayAdapter array4( 0 );
     CPPUNIT_ASSERT( array4.getCapacity() == 0 );
 }
 
@@ -133,20 +133,20 @@ void ByteArrayAdapterTest::testClear(){
         data[i] = i;
     }
 
-    ByteArrayAdapter array( (std::size_t)256 );
+    ByteArrayAdapter array( (int)256 );
 
     CPPUNIT_ASSERT( array.getCapacity() == 256 );
 
-    array.write( data, 0, 256 );
+    array.write( data, 256, 0, 256 );
     unsigned char* result = new unsigned char[256];
-    array.read( result, 0, 256 );
+    array.read( result, 256, 0, 256 );
 
     for( int i = 0; i < 256; ++i ){
         CPPUNIT_ASSERT( data[i] == result[i] );
     }
 
     array.clear();
-    array.read( result, 0, 256 );
+    array.read( result, 256, 0, 256 );
 
     for( int i = 0; i < 256; ++i ){
         CPPUNIT_ASSERT( result[i] == 0 );
@@ -164,13 +164,13 @@ void ByteArrayAdapterTest::testReszie(){
         data[i] = i;
     }
 
-    ByteArrayAdapter array( (std::size_t)256 );
+    ByteArrayAdapter array( (int)256 );
 
     CPPUNIT_ASSERT( array.getCapacity() == 256 );
 
-    array.write( data, 0, 256 );
+    array.write( data, 256, 0, 256 );
     unsigned char* result = new unsigned char[256];
-    array.read( result, 0, 256 );
+    array.read( result, 256, 0, 256 );
 
     for( int i = 0; i < 256; ++i ){
         CPPUNIT_ASSERT( data[i] == result[i] );
@@ -179,7 +179,7 @@ void ByteArrayAdapterTest::testReszie(){
     array.resize( 128 );
     CPPUNIT_ASSERT( array.getCapacity() == 128 );
     unsigned char* result2 = new unsigned char[128];
-    array.read( result2, 0, 128 );
+    array.read( result2, 128, 0, 128 );
 
     for( int i = 0; i < 128; ++i ){
         CPPUNIT_ASSERT( result[i] == data[i] );
@@ -221,7 +221,7 @@ void ByteArrayAdapterTest::testReadExcep
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should Throw NullPointerException",
-        array.read( NULL, 0, 500 ),
+        array.read( NULL, 1, 0, 500 ),
         NullPointerException );
 
     unsigned char result[5000];
@@ -229,7 +229,7 @@ void ByteArrayAdapterTest::testReadExcep
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should Throw BufferUnderflowException",
-        array.read( result, 0, 500 ),
+        array.read( result, 5000, 0, 500 ),
         BufferUnderflowException );
 
 
@@ -246,7 +246,7 @@ void ByteArrayAdapterTest::testWriteExce
     ByteArrayAdapter array( data, 256, true );
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should Throw NullPointerException",
-        array.write( NULL, 0, 500 ),
+        array.write( NULL, 1, 0, 500 ),
         NullPointerException );
 
     unsigned char result[5000];
@@ -254,7 +254,7 @@ void ByteArrayAdapterTest::testWriteExce
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should Throw BufferOverflowException",
-        array.write( result, 0, 500 ),
+        array.write( result, 5000, 0, 500 ),
         BufferOverflowException );
 }
 
@@ -278,8 +278,8 @@ void ByteArrayAdapterTest::testPut() {
 
     ByteArrayAdapter testBuffer1( testData1Size );
 
-    std::size_t i = 0;
-    for( ; ( testBuffer1.getCapacity() - i ) >= sizeof(unsigned char); i+=sizeof(unsigned char) ) {
+    int i = 0;
+    for( ; ( testBuffer1.getCapacity() - i ) >= (int)sizeof(unsigned char); i+=sizeof(unsigned char) ) {
         testBuffer1.put( i, (unsigned char)(i + 99) );
         CPPUNIT_ASSERT( testBuffer1.get( i ) == (unsigned char)(i + 99) );
     }
@@ -295,8 +295,8 @@ void ByteArrayAdapterTest::testPutChar()
 
     ByteArrayAdapter testBuffer1( testData1Size );
 
-    std::size_t i = 0;
-    for( ; ( testBuffer1.getCapacity() - i ) >= sizeof(char); i+=sizeof(char) ) {
+    int i = 0;
+    for( ; ( testBuffer1.getCapacity() - i ) >= (int)sizeof(char); i+=sizeof(char) ) {
         testBuffer1.putChar( i, (char)( i + 99 ) );
         CPPUNIT_ASSERT( testBuffer1.getChar( i ) == (char)(i + 99) );
     }
@@ -312,7 +312,7 @@ void ByteArrayAdapterTest::testPutLong()
 
     ByteArrayAdapter testBuffer1( testData1Size );
 
-    std::size_t i = 0;
+    int i = 0;
     for( ; i < testBuffer1.getLongCapacity(); ++i  ) {
         testBuffer1.putLong( i, i + 99 );
         CPPUNIT_ASSERT( testBuffer1.getLong( i ) == (long long)(i + 99) );
@@ -329,7 +329,7 @@ void ByteArrayAdapterTest::testPutInt() 
 
     ByteArrayAdapter testBuffer1( testData1Size );
 
-    std::size_t i = 0;
+    int i = 0;
     for( ; i < testBuffer1.getIntCapacity(); ++i  ) {
         testBuffer1.putInt( i, (int)( i + 99 ) );
         CPPUNIT_ASSERT( testBuffer1.getInt( i ) == (int)(i + 99) );
@@ -346,7 +346,7 @@ void ByteArrayAdapterTest::testPutShort(
 
     ByteArrayAdapter testBuffer1( testData1Size );
 
-    std::size_t i = 0;
+    int i = 0;
     for( ; i < testBuffer1.getShortCapacity(); ++i  ) {
         testBuffer1.putShort( i, (short)( i + 99 ) );
         CPPUNIT_ASSERT( testBuffer1.getShort( i ) == (short)(i + 99) );
@@ -363,7 +363,7 @@ void ByteArrayAdapterTest::testPutDouble
 
     ByteArrayAdapter testBuffer1( testData1Size );
 
-    std::size_t i = 0;
+    int i = 0;
     for( ; i < testBuffer1.getDoubleCapacity(); ++i  ) {
         testBuffer1.putDouble( i, i + 99.025 );
         CPPUNIT_ASSERT( Double::doubleToLongBits( testBuffer1.getDouble( i ) ) ==
@@ -381,7 +381,7 @@ void ByteArrayAdapterTest::testPutFloat(
 
     ByteArrayAdapter testBuffer1( testData1Size );
 
-    std::size_t i = 0;
+    int i = 0;
     for( ; i < testBuffer1.getFloatCapacity(); ++i  ) {
         testBuffer1.putFloat( i, i + 99.025f );
         CPPUNIT_ASSERT( Float::floatToIntBits( testBuffer1.getFloat( i ) ) ==
@@ -400,13 +400,13 @@ void ByteArrayAdapterTest::testGet() {
     ByteArrayAdapter testBuffer1( testData1Size );
 
     std::vector<unsigned char> values;
-    for( std::size_t i = 0; i < testBuffer1.getCapacity(); ++i ) {
+    for( int i = 0; i < testBuffer1.getCapacity(); ++i ) {
         testBuffer1.put( i, (unsigned char)i );
         values.push_back( (unsigned char)i );
     }
 
-    std::size_t i = 0;
-    std::size_t j = 0;
+    int i = 0;
+    int j = 0;
 
     for( ; i < testBuffer1.getCapacity(); ++i, ++j ) {
         CPPUNIT_ASSERT( testBuffer1.get( i ) == values[j] );
@@ -424,13 +424,13 @@ void ByteArrayAdapterTest::testGetChar()
     ByteArrayAdapter testBuffer1( testData1Size );
 
     std::vector<char> values;
-    for( std::size_t i = 0; i < testBuffer1.getCapacity(); ++i ) {
+    for( int i = 0; i < testBuffer1.getCapacity(); ++i ) {
         testBuffer1.putChar( i, (char)i );
         values.push_back( (char)i );
     }
 
-    std::size_t i = 0;
-    std::size_t j = 0;
+    int i = 0;
+    int j = 0;
 
     for( ; i < testBuffer1.getCapacity(); ++i, ++j ) {
         CPPUNIT_ASSERT( testBuffer1.getChar( i ) == values[j] );
@@ -448,13 +448,13 @@ void ByteArrayAdapterTest::testGetShort(
     ByteArrayAdapter testBuffer1( testData1Size );
 
     std::vector<short> values;
-    for( std::size_t i = 0; i < testBuffer1.getShortCapacity(); ++i ) {
+    for( int i = 0; i < testBuffer1.getShortCapacity(); ++i ) {
         testBuffer1.putShort( i, (short)i );
         values.push_back( (short)i );
     }
 
-    std::size_t i = 0;
-    std::size_t j = 0;
+    int i = 0;
+    int j = 0;
 
     for( ; i < testBuffer1.getShortCapacity(); ++i, ++j ) {
         CPPUNIT_ASSERT( testBuffer1.getShort( i ) == values[j] );
@@ -472,13 +472,13 @@ void ByteArrayAdapterTest::testGetInt() 
     ByteArrayAdapter testBuffer1( testData1Size );
 
     std::vector<int> values;
-    for( std::size_t i = 0; i < testBuffer1.getIntCapacity(); ++i ) {
+    for( int i = 0; i < testBuffer1.getIntCapacity(); ++i ) {
         testBuffer1.putInt( i, (int)i );
         values.push_back( (int)i );
     }
 
-    std::size_t i = 0;
-    std::size_t j = 0;
+    int i = 0;
+    int j = 0;
 
     for( ; i < testBuffer1.getIntCapacity(); ++i, ++j ) {
         CPPUNIT_ASSERT( testBuffer1.getInt( i ) == values[j] );
@@ -496,13 +496,13 @@ void ByteArrayAdapterTest::testGetLong()
     ByteArrayAdapter testBuffer1( testData1Size );
 
     std::vector<long long> values;
-    for( std::size_t i = 0; i < testBuffer1.getLongCapacity(); ++i ) {
+    for( int i = 0; i < testBuffer1.getLongCapacity(); ++i ) {
         testBuffer1.putLong( i, (long long)i );
         values.push_back( (long long)i );
     }
 
-    std::size_t i = 0;
-    std::size_t j = 0;
+    int i = 0;
+    int j = 0;
 
     for( ; i < testBuffer1.getLongCapacity(); ++i, ++j ) {
         CPPUNIT_ASSERT( testBuffer1.getLong( i ) == values[j] );
@@ -520,13 +520,13 @@ void ByteArrayAdapterTest::testGetFloat(
     ByteArrayAdapter testBuffer1( testData1Size );
 
     std::vector<float> values;
-    for( std::size_t i = 0; i < testBuffer1.getFloatCapacity(); ++i ) {
+    for( int i = 0; i < testBuffer1.getFloatCapacity(); ++i ) {
         testBuffer1.putFloat( i, (float)i + 0.025f );
         values.push_back( (float)i + 0.025f );
     }
 
-    std::size_t i = 0;
-    std::size_t j = 0;
+    int i = 0;
+    int j = 0;
 
     for( ; i < testBuffer1.getFloatCapacity(); ++i, ++j ) {
         CPPUNIT_ASSERT( Float::floatToIntBits( testBuffer1.getFloat( i ) ) ==
@@ -545,13 +545,13 @@ void ByteArrayAdapterTest::testGetDouble
     ByteArrayAdapter testBuffer1( testData1Size );
 
     std::vector<double> values;
-    for( std::size_t i = 0; i < testBuffer1.getDoubleCapacity(); ++i ) {
+    for( int i = 0; i < testBuffer1.getDoubleCapacity(); ++i ) {
         testBuffer1.putDouble( i, (double)i + 0.025 );
         values.push_back( (double)i + 0.025 );
     }
 
-    std::size_t i = 0;
-    std::size_t j = 0;
+    int i = 0;
+    int j = 0;
 
     for( ; i < testBuffer1.getDoubleCapacity(); ++i, ++j ) {
         CPPUNIT_ASSERT( Double::doubleToLongBits( testBuffer1.getDouble( i ) ) ==

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.h Sat Mar 20 21:57:20 2010
@@ -59,7 +59,7 @@ namespace util{
         CPPUNIT_TEST_SUITE_END();
 
         unsigned char* testData1;
-        static const std::size_t testData1Size = 100;
+        static const int testData1Size = 100;
 
     public:
 
@@ -68,7 +68,7 @@ namespace util{
 
         void setUp() {
             testData1 = new unsigned char[testData1Size];
-            for( std::size_t i = 0; i < testData1Size; ++i ){
+            for( int i = 0; i < testData1Size; ++i ){
                 testData1[i] = (unsigned char)i;
             }
         }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.cpp Sat Mar 20 21:57:20 2010
@@ -82,7 +82,7 @@ namespace {
     class MyInputStream : public InputStream{
     private:
         std::string data;
-        std::size_t pos;
+        int pos;
         bool throwOnRead;
         bool closed;
 
@@ -108,13 +108,13 @@ namespace {
             return this->closed;
         }
 
-        virtual std::size_t available() const throw (IOException){
+        virtual int available() const throw (IOException){
             if( isClosed() ) {
                 throw IOException(
                     __FILE__, __LINE__,
                     "MyInputStream::read - Stream already closed." );
             }
-            std::size_t len = data.length();
+            int len = (int)data.length();
             return len - pos;
         }
 
@@ -125,20 +125,19 @@ namespace {
                     "MyInputStream::read - Throw on Read on." );
             }
 
-            if( pos >= data.length() ){
+            if( pos >= (int)data.length() ){
                 return -1;
             }
 
             return data.c_str()[pos++];
         }
 
-        virtual int doReadArrayOffsetAndLength( unsigned char* buffer, std::size_t size,
-                                                std::size_t offset, std::size_t length )
+        virtual int doReadArrayOffsetAndLength( unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::IndexOutOfBoundsException,
                     decaf::lang::exceptions::NullPointerException ) {
 
-            std::size_t numToRead = std::min( length, available() );
+            int numToRead = std::min( length, available() );
 
             if( this->isThrowOnRead() ) {
                 throw IOException(
@@ -152,7 +151,7 @@ namespace {
             }
 
             const char* str = data.c_str();
-            for( std::size_t ix=0; ix<numToRead; ++ix ){
+            for( int ix=0; ix<numToRead; ++ix ){
                 buffer[ix+offset] = str[pos+ix];
             }
 
@@ -165,8 +164,10 @@ namespace {
             this->closed = true;
         }
 
-        virtual std::size_t skip( std::size_t num ) throw ( io::IOException, lang::exceptions::UnsupportedOperationException ) {
-            return ( pos += std::min( num, available() ) );
+        virtual long long skip( long long num )
+            throw ( io::IOException, lang::exceptions::UnsupportedOperationException ) {
+
+            return ( pos += std::min( num, (long long)available() ) );
         }
 
     };
@@ -180,7 +181,7 @@ void BufferedInputStreamTest::testConstr
     MyInputStream myStream( testStr );
 
     // Create buffer with exact size of data
-    BufferedInputStream is( &myStream, testStr.length() );
+    BufferedInputStream is( &myStream, (int)testStr.length() );
 
     // Ensure buffer gets filled by evaluating one read
     CPPUNIT_ASSERT( is.read() != -1 );
@@ -200,7 +201,7 @@ void BufferedInputStreamTest::testConstr
             IOException );
     }
     {
-        BufferedInputStream nullStream( NULL, (std::size_t)1 );
+        BufferedInputStream nullStream( NULL, 1 );
         CPPUNIT_ASSERT_THROW_MESSAGE(
             "Should have thrown an IOException",
             nullStream.read(),
@@ -214,12 +215,12 @@ void BufferedInputStreamTest::testAvaila
     std::string testStr = "TEST12345678910";
     MyInputStream myStream( testStr );
     // Create buffer with exact size of data
-    BufferedInputStream is( &myStream, testStr.length() );
+    BufferedInputStream is( &myStream, (int)testStr.length() );
 
     // Test for method int BufferedInputStream.available()
     try {
         CPPUNIT_ASSERT_MESSAGE( "Returned incorrect number of available bytes",
-                                 is.available() == testStr.length() );
+                                 is.available() == (int)testStr.length() );
     } catch( IOException& e ) {
         CPPUNIT_ASSERT_MESSAGE("Exception during available test", false );
     }
@@ -227,9 +228,9 @@ void BufferedInputStreamTest::testAvaila
     // Test that a closed stream throws an IOE for available()
     std::string testStr2 = "hello world";
     MyInputStream myStream2( testStr2 );
-    BufferedInputStream bis( &myStream2, testStr2.length() );
+    BufferedInputStream bis( &myStream2, (int)testStr2.length() );
 
-    std::size_t available;
+    int available;
 
     try {
         available = bis.available();
@@ -261,7 +262,7 @@ void BufferedInputStreamTest::testClose(
 
         // Test a null stream
         MyInputStream* ptr = NULL;
-        BufferedInputStream buf( ptr, (std::size_t)5 );
+        BufferedInputStream buf( ptr, 5 );
         buf.close();
     } catch(...) {
         CPPUNIT_FAIL("Close shouldn't throw an error here" );
@@ -282,7 +283,7 @@ void BufferedInputStreamTest::testRead()
         std::string testStr = "TEST12345678910";
         MyInputStream myStream( testStr );
         // Create buffer with exact size of data
-        BufferedInputStream is( &myStream, testStr.length() );
+        BufferedInputStream is( &myStream, (int)(int)testStr.length() );
 
         char c = is.read();
         CPPUNIT_ASSERT_MESSAGE( "read returned incorrect char",
@@ -298,13 +299,13 @@ void BufferedInputStreamTest::testRead()
 
     // New stream, owns the inner one.
     BufferedInputStream is(
-        new ByteArrayInputStream( &bytes[0], (std::size_t)256 ), (std::size_t)12, true );
+        new ByteArrayInputStream( &bytes[0], 256 ), 12, true );
 
     try {
         CPPUNIT_ASSERT_MESSAGE( "Wrong initial byte", 0 == is.read() );
         // Fill the buffer
         unsigned char buf[14];
-        is.read( &buf[0], 14, 0, (std::size_t)14 );
+        is.read( &buf[0], 14, 0, 14 );
 
         // Read greater than the buffer
         CPPUNIT_ASSERT_MESSAGE( "Wrong block read data",
@@ -326,7 +327,7 @@ void BufferedInputStreamTest::testRead2(
     testStr.append( "B", 1000 );
     MyInputStream myStream( testStr );
     // Create buffer with exact size of data
-    BufferedInputStream is( &myStream, testStr.length() );
+    BufferedInputStream is( &myStream, (int)testStr.length() );
 
     // Test for method int BufferedInputStream.read(byte [], int,
     // int)
@@ -373,35 +374,35 @@ void BufferedInputStreamTest::testSmalle
 
     std::string testStr = "TEST12345678910";
     MyInputStream myStream( testStr );
-    BufferedInputStream bufStream( &myStream, (std::size_t)1 );
+    BufferedInputStream bufStream( &myStream, 1 );
 
-    std::size_t available = bufStream.available();
-    CPPUNIT_ASSERT( available == testStr.length() );
+    int available = bufStream.available();
+    CPPUNIT_ASSERT( available == (int)testStr.length() );
 
     unsigned char dummy = bufStream.read();
     CPPUNIT_ASSERT( dummy == 'T' );
 
     available = bufStream.available();
-    CPPUNIT_ASSERT( available == (testStr.length() - 1) );
+    CPPUNIT_ASSERT( available == ((int)testStr.length() - 1) );
 
     dummy = bufStream.read();
     CPPUNIT_ASSERT( dummy == 'E' );
 
     available = bufStream.available();
-    CPPUNIT_ASSERT( available == (testStr.length() - 2 ) );
+    CPPUNIT_ASSERT( available == ((int)testStr.length() - 2 ) );
 
     dummy = bufStream.read();
     CPPUNIT_ASSERT( dummy == 'S' );
 
     available = bufStream.available();
-    CPPUNIT_ASSERT( available == (testStr.length() - 3 ) );
+    CPPUNIT_ASSERT( available == ((int)testStr.length() - 3 ) );
 
     dummy = bufStream.read();
     CPPUNIT_ASSERT( dummy == 'T' );
 
     unsigned char dummyBuf[20];
     memset( dummyBuf, 0, 20 );
-    std::size_t numRead = bufStream.read( dummyBuf, 20, 0, 10 );
+    int numRead = bufStream.read( dummyBuf, 20, 0, 10 );
     CPPUNIT_ASSERT( numRead == 10 );
     CPPUNIT_ASSERT( strcmp( (char*)dummyBuf, "1234567891" ) == 0 );
 
@@ -414,35 +415,35 @@ void BufferedInputStreamTest::testBigger
 
     std::string testStr = "TEST12345678910";
     MyInputStream myStream( testStr );
-    BufferedInputStream bufStream( &myStream, (std::size_t)10 );
+    BufferedInputStream bufStream( &myStream, 10 );
 
-    std::size_t available = bufStream.available();
-    CPPUNIT_ASSERT( available == testStr.length() );
+    int available = bufStream.available();
+    CPPUNIT_ASSERT( available == (int)testStr.length() );
 
     unsigned char dummy = bufStream.read();
     CPPUNIT_ASSERT( dummy == 'T' );
 
     available = bufStream.available();
-    CPPUNIT_ASSERT( available == (testStr.length() - 1 ) );
+    CPPUNIT_ASSERT( available == ((int)testStr.length() - 1 ) );
 
     dummy = bufStream.read();
     CPPUNIT_ASSERT( dummy == 'E' );
 
     available = bufStream.available();
-    CPPUNIT_ASSERT( available == (testStr.length() - 2 ) );
+    CPPUNIT_ASSERT( available == ((int)testStr.length() - 2 ) );
 
     dummy = bufStream.read();
     CPPUNIT_ASSERT( dummy == 'S' );
 
     available = bufStream.available();
-    CPPUNIT_ASSERT( available == (testStr.length() - 3 ) );
+    CPPUNIT_ASSERT( available == ((int)testStr.length() - 3 ) );
 
     dummy = bufStream.read();
     CPPUNIT_ASSERT( dummy == 'T' );
 
     unsigned char dummyBuf[20];
     memset( dummyBuf, 0, 20 );
-    std::size_t numRead = bufStream.read( dummyBuf, 20, 0, 10 );
+    int numRead = bufStream.read( dummyBuf, 20, 0, 10 );
     CPPUNIT_ASSERT( numRead == 10 );
     CPPUNIT_ASSERT( strcmp( (char*)dummyBuf, "1234567891" ) == 0 );
 
@@ -453,8 +454,8 @@ void BufferedInputStreamTest::testBigger
 ////////////////////////////////////////////////////////////////////////////////
 void BufferedInputStreamTest::testSkipNullInputStream() {
 
-    BufferedInputStream buf( NULL, (std::size_t)5 );
-    CPPUNIT_ASSERT_EQUAL( (std::size_t)0, buf.skip( 0 ) );
+    BufferedInputStream buf( NULL, 5 );
+    CPPUNIT_ASSERT_EQUAL( 0LL, buf.skip( 0 ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -487,7 +488,7 @@ void BufferedInputStreamTest::testMarkI(
     {
         ByteArrayInputStream bais;
         bais.setByteArray( bytes, 256 );
-        BufferedInputStream in( &bais, (std::size_t)12 );
+        BufferedInputStream in( &bais, 12 );
 
         in.skip( 6 );
         in.mark( 14 );
@@ -500,7 +501,7 @@ void BufferedInputStreamTest::testMarkI(
     {
         ByteArrayInputStream bais;
         bais.setByteArray( bytes, 256 );
-        BufferedInputStream in( &bais, (std::size_t)12 );
+        BufferedInputStream in( &bais, 12 );
 
         in.skip( 6 );
         in.mark( 8 );
@@ -512,7 +513,7 @@ void BufferedInputStreamTest::testMarkI(
         unsigned char temp[] = { 0, 1, 2, 3, 4 };
         ByteArrayInputStream bais;
         bais.setByteArray( temp, 5 );
-        BufferedInputStream buf( &bais, (std::size_t)2 );
+        BufferedInputStream buf( &bais, 2 );
 
         buf.mark( 3 );
         unsigned char bitBucket[3];
@@ -527,7 +528,7 @@ void BufferedInputStreamTest::testMarkI(
         unsigned char temp[] = { 0, 1, 2, 3, 4 };
         ByteArrayInputStream bais;
         bais.setByteArray( temp, 5 );
-        BufferedInputStream buf( &bais, (std::size_t)2 );
+        BufferedInputStream buf( &bais, 2 );
 
         buf.mark( 3 );
         unsigned char bitBucket[4];
@@ -545,7 +546,7 @@ void BufferedInputStreamTest::testMarkI(
         unsigned char temp[] = { 0, 1, 2, 3, 4 };
         ByteArrayInputStream bais;
         bais.setByteArray( temp, 5 );
-        BufferedInputStream buf( &bais, (std::size_t)2 );
+        BufferedInputStream buf( &bais, 2 );
 
         buf.mark( Integer::MAX_VALUE );
         buf.read();
@@ -659,7 +660,7 @@ void BufferedInputStreamTest::testSkipJ(
                                   testString.substr( 1000, 10 ) );
 
     // throws IOException with message "stream is closed"
-    BufferedInputStream buf( NULL, (std::size_t)5 );
+    BufferedInputStream buf( NULL, 5 );
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "should throw IOException",
         buf.skip( 10 ),

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.cpp Sat Mar 20 21:57:20 2010
@@ -32,7 +32,7 @@ namespace {
     class MyOutputStream : public OutputStream{
     private:
         char buffer[100];
-        std::size_t pos;
+        int pos;
     public:
 
         MyOutputStream(){
@@ -51,8 +51,8 @@ namespace {
             buffer[pos++] = c;
         }
 
-        virtual void doWriteByteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                              std::size_t offset, std::size_t length )
+        virtual void doWriteByteArrayBounded( const unsigned char* buffer, int size,
+                                              int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::NullPointerException,
                     decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -87,7 +87,7 @@ void BufferedOutputStreamTest::testConst
 
     try {
         MyOutputStream myStream;
-        BufferedOutputStream os( &myStream, (std::size_t)1024 );
+        BufferedOutputStream os( &myStream, 1024 );
         os.write( (unsigned char*)&testString[0], 500, 0, 500 );
     } catch( IOException& e) {
         CPPUNIT_FAIL("IOException during Constrcutor test");
@@ -100,7 +100,7 @@ void BufferedOutputStreamTest::testFlush
     try {
 
         ByteArrayOutputStream myStream;
-        BufferedOutputStream os( &myStream, (std::size_t)600 );
+        BufferedOutputStream os( &myStream, 600 );
         os.write( (unsigned char*)&testString[0], 500, 0, 500 );
         os.flush();
         CPPUNIT_ASSERT_MESSAGE("Bytes not written after flush",
@@ -116,7 +116,7 @@ void BufferedOutputStreamTest::testWrite
     try {
 
         ByteArrayOutputStream baos;
-        BufferedOutputStream os( &baos, (std::size_t)512 );
+        BufferedOutputStream os( &baos, 512 );
         os.write( (unsigned char*)&testString[0], 500, 0, 500 );
 
         CPPUNIT_ASSERT_MESSAGE( "Bytes written, not buffered", NULL == baos.toByteArray() );
@@ -148,7 +148,7 @@ void BufferedOutputStreamTest::testWrite
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "should throw NullPointerException",
-        bos.write( nullByteArray, 0, 0, (std::size_t)1 ),
+        bos.write( nullByteArray, 0, 0, 1 ),
         NullPointerException );
 
     bos.write( byteArray, 10, 0, 0 );
@@ -158,7 +158,7 @@ void BufferedOutputStreamTest::testWrite
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "should throw IOException",
-        bos.write( nullByteArray, 0, 0, (std::size_t)1 ),
+        bos.write( nullByteArray, 0, 0, 1 ),
         IOException );
 }
 
@@ -170,28 +170,28 @@ void BufferedOutputStreamTest::testWrite
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "should throw NullPointerException",
-        bos.write( nullByteArray, 0, 0, (std::size_t)1 ),
+        bos.write( nullByteArray, 0, 0, 1 ),
         IOException );
 
     CPPUNIT_ASSERT_NO_THROW_MESSAGE(
         "should not throw NullPointerException",
-        bos.write( nullByteArray, 0, 0, (std::size_t)0 ) );
+        bos.write( nullByteArray, 0, 0, 0 ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void BufferedOutputStreamTest::testWriteNullStreamNullArraySize() {
 
-    BufferedOutputStream bos( NULL, (std::size_t)1 );
+    BufferedOutputStream bos( NULL, 1 );
     unsigned char* nullByteArray = NULL;
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "should throw IOException",
-        bos.write( nullByteArray, 0, 0, (std::size_t)1 ),
+        bos.write( nullByteArray, 0, 0, 1 ),
         IOException );
 
     CPPUNIT_ASSERT_NO_THROW_MESSAGE(
         "should not throw NullPointerException",
-        bos.write( nullByteArray, 0, 0, (std::size_t)0 ) );
+        bos.write( nullByteArray, 0, 0, 0 ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -202,23 +202,23 @@ void BufferedOutputStreamTest::testWrite
 
     CPPUNIT_ASSERT_NO_THROW_MESSAGE(
         "should not throw IOException",
-        bos.write( byteArray, 10, 0, (std::size_t)0 ) );
+        bos.write( byteArray, 10, 0, 0 ) );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "should throw IOException",
-        bos.write( byteArray, 10, 0, (std::size_t)1 ),
+        bos.write( byteArray, 10, 0, 1 ),
         IOException );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "should throw IOException",
-        bos.write( byteArray, 10, 0, (std::size_t)10 ),
+        bos.write( byteArray, 10, 0, 10 ),
         IOException );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void BufferedOutputStreamTest::testWriteNullStreamSize() {
 
-    BufferedOutputStream bos( NULL, (std::size_t)1 );
+    BufferedOutputStream bos( NULL, 1 );
     unsigned char byteArray[10];
 
     bos.write( byteArray, 0, 0, 0 );
@@ -260,7 +260,7 @@ void BufferedOutputStreamTest::testWrite
 void BufferedOutputStreamTest::testSmallerBuffer(){
 
     MyOutputStream myStream;
-    BufferedOutputStream bufStream( &myStream, (std::size_t)1 );
+    BufferedOutputStream bufStream( &myStream, 1 );
 
     const char* buffer = myStream.getBuffer();
 
@@ -284,7 +284,7 @@ void BufferedOutputStreamTest::testSmall
 void BufferedOutputStreamTest::testBiggerBuffer(){
 
     MyOutputStream myStream;
-    BufferedOutputStream bufStream( &myStream, (std::size_t)10 );
+    BufferedOutputStream bufStream( &myStream, 10 );
 
     const char* buffer = myStream.getBuffer();
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/ByteArrayInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/ByteArrayInputStreamTest.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/ByteArrayInputStreamTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/ByteArrayInputStreamTest.cpp Sat Mar 20 21:57:20 2010
@@ -40,13 +40,13 @@ void ByteArrayInputStreamTest::testConst
     testBuffer.push_back('s');
     testBuffer.push_back('t');
 
-    ByteArrayInputStream stream_a( &testBuffer[0], testBuffer.size());
+    ByteArrayInputStream stream_a( &testBuffer[0], (int)testBuffer.size());
     ByteArrayInputStream stream_b( testBuffer );
 
     CPPUNIT_ASSERT_MESSAGE( "Unable to create ByteArrayInputStream",
-                            stream_a.available() == testBuffer.size() );
+                            stream_a.available() == (int)testBuffer.size() );
     CPPUNIT_ASSERT_MESSAGE( "Unable to create ByteArrayInputStream",
-                            stream_b.available() == testBuffer.size() );
+                            stream_b.available() == (int)testBuffer.size() );
 
     ByteArrayInputStream nullStream;
     CPPUNIT_ASSERT_THROW_MESSAGE(
@@ -89,7 +89,7 @@ void ByteArrayInputStreamTest::testAvail
 
     // Test for method int ByteArrayInputStream.available()
     CPPUNIT_ASSERT_MESSAGE( "Returned incorrect number of available bytes",
-                            bis.available() == ( testBuffer.size() - 10 ) );
+                            bis.available() == ( (int)testBuffer.size() - 10 ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp Sat Mar 20 21:57:20 2010
@@ -58,7 +58,7 @@ void DataInputStreamTest::testRead1() {
     try {
 
         std::vector<unsigned char> test( testData.begin(), testData.end() );
-        os->write( test );
+        os->write( &test[0], (int)test.size() );
         os->close();
         openDataInputStream();
         std::vector<unsigned char> result;
@@ -75,7 +75,9 @@ void DataInputStreamTest::testRead1() {
 void DataInputStreamTest::testRead2() {
     try {
 
-        os->write( std::vector<unsigned char>( testData.begin(), testData.end() ) );
+        std::vector<unsigned char> temp( testData.begin(), testData.end() );
+
+        os->write( &temp[0], (int)temp.size() );
         os->close();
         openDataInputStream();
         unsigned char* result = new unsigned char[ testData.length() ];
@@ -152,54 +154,85 @@ void DataInputStreamTest::test_readFloat
 
 ////////////////////////////////////////////////////////////////////////////////
 void DataInputStreamTest::test_readFully1() {
-    try {
-        os->write( std::vector<unsigned char>( testData.begin(), testData.end() ) );
-        os->close();
-        openDataInputStream();
-        std::vector<unsigned char> result;
-        result.resize( testData.length() );
-        is->readFully( &result[0], testData.length() );
 
-        string expected = "";
-        for( size_t ix = 0; ix < result.size(); ++ix ) {
-            expected += (char)result[ix];
-        }
-
-        CPPUNIT_ASSERT_MESSAGE("Incorrect data read", expected == testData );
+    std::vector<unsigned char> temp( testData.begin(), testData.end() );
+    os->write( &temp[0], temp.size() );
+    os->close();
+    openDataInputStream();
+    std::vector<unsigned char> result;
+    result.resize( testData.length() );
+    is->readFully( &result[0], testData.length() );
 
-    } catch( IOException &e ) {
-        CPPUNIT_FAIL("IOException during readFully test : " + e.getMessage());
+    string expected = "";
+    for( size_t ix = 0; ix < result.size(); ++ix ) {
+        expected += (char)result[ix];
     }
+
+    CPPUNIT_ASSERT_MESSAGE("Incorrect data read", expected == testData );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "should throw IndexOutOfBoundsException",
+        is->readFully( &result[0], -1 ),
+        IndexOutOfBoundsException );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void DataInputStreamTest::test_readFully2() {
 
-    try {
-        os->write( std::vector<unsigned char>( testData.begin(), testData.end() ) );
-        os->close();
-        openDataInputStream();
-        unsigned char* rbytes = new unsigned char[ testData.length() ];
-        is->readFully( rbytes, testData.length() );
+    std::vector<unsigned char> temp( testData.begin(), testData.end() );
+    os->write( &temp[0], temp.size() );
+    openDataInputStream();
+    unsigned char* rbytes = new unsigned char[ testData.length() ];
+    is->readFully( rbytes, testData.length() );
 
-        string expected = "";
-        for( size_t ix = 0; ix < testData.length(); ++ix ) {
-            expected += (char)rbytes[ix];
-        }
+    string expected = "";
+    for( size_t ix = 0; ix < testData.length(); ++ix ) {
+        expected += (char)rbytes[ix];
+    }
 
-        CPPUNIT_ASSERT_MESSAGE("Incorrect data read", expected == testData );
+    CPPUNIT_ASSERT_MESSAGE("Incorrect data read", expected == testData );
 
-        delete [] rbytes;
-    } catch( IOException &e ) {
-        CPPUNIT_FAIL("IOException during readFully test : " + e.getMessage());
-    }
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "should throw IndexOutOfBoundsException",
+        is->readFully( &temp[0], temp.size(), -1, -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "should throw IndexOutOfBoundsException",
+        is->readFully( &temp[0], temp.size(), 0, -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "should throw IndexOutOfBoundsException",
+        is->readFully( &temp[0], temp.size(), 1, -1 ),
+        IndexOutOfBoundsException );
+
+    is->readFully( &temp[0], temp.size(), -1, 0 );
+    is->readFully( &temp[0], temp.size(), 0, 0 );
+    is->readFully( &temp[0], temp.size(), 1, 0 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "should throw IndexOutOfBoundsException",
+        is->readFully( &temp[0], temp.size(), -1, 1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "should throw IndexOutOfBoundsException",
+        is->readFully( &temp[0], temp.size(), 0, Integer::MAX_VALUE ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "should throw IndexOutOfBoundsException",
+        is->readFully( &temp[0], temp.size(), 1, Integer::MAX_VALUE ),
+        IndexOutOfBoundsException );
+
+    delete [] rbytes;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void DataInputStreamTest::test_readFullyNullArray() {
     std::vector<unsigned char> test( 5000 );
-    DataInputStream is(
-        new ByteArrayInputStream( test ), true );
+    DataInputStream is( new ByteArrayInputStream( test ), true );
 
     unsigned char* nullByteArray = NULL;
 
@@ -333,7 +366,8 @@ void DataInputStreamTest::test_readUnsig
 ////////////////////////////////////////////////////////////////////////////////
 void DataInputStreamTest::test_skipBytes() {
     try {
-        os->write( std::vector<unsigned char>( testData.begin(), testData.end() ) );
+        std::vector<unsigned char> temp( testData.begin(), testData.end() );
+        os->write( &temp[0], temp.size() );
         os->close();
         openDataInputStream();
         is->skip( 100 );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataOutputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataOutputStreamTest.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataOutputStreamTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataOutputStreamTest.cpp Sat Mar 20 21:57:20 2010
@@ -252,7 +252,7 @@ void DataOutputStreamTest::testWriteUTF(
     os->close();
     openDataInputStream();
     CPPUNIT_ASSERT_MESSAGE("Failed to write string in UTF format",
-        is->available() == testString.length() + 2 );
+        is->available() == (int)testString.length() + 2 );
     CPPUNIT_ASSERT_MESSAGE("Incorrect string returned",
         is->readUTF() == testString );
 }
@@ -309,7 +309,7 @@ void DataOutputStreamTest::testHelper( u
     CPPUNIT_ASSERT( result[0] == 0x00 );
     CPPUNIT_ASSERT( result[1] == (unsigned char)( expectLength ) );
 
-    for( std::size_t i = 2; i < baos->size(); ++i ) {
+    for( int i = 2; i < baos->size(); ++i ) {
         CPPUNIT_ASSERT( result[i] == expect[i-2] );
     }
 



Mime
View raw message