[jboss-cvs] JBoss Messaging SVN: r4679 - trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 11 21:52:46 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-07-11 21:52:46 -0400 (Fri, 11 Jul 2008)
New Revision: 4679

Modified:
   trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/SingleThreadWriteNativeTest.java
Log:
Some journal work (tests)

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/SingleThreadWriteNativeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/SingleThreadWriteNativeTest.java	2008-07-12 01:19:25 UTC (rev 4678)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/SingleThreadWriteNativeTest.java	2008-07-12 01:52:46 UTC (rev 4679)
@@ -309,22 +309,25 @@
       try
       {
          
-         final int NUMBER_LINES = 1000;
+         final int NUMBER_LINES = 5000;
          final int SIZE = 1024;
          
-         controller.open(FILE_NAME, 10, 1200);
+         controller.open(FILE_NAME, 1000, 1200);
          
          log.debug("Filling file");
          
          controller.fill(0, 1, NUMBER_LINES * SIZE, (byte) 'j');
          
-         ByteBuffer buffer = controller.newBuffer(SIZE);
          
          log.debug("Writing file");
          
+         {
+         CountDownLatch latch = new CountDownLatch(NUMBER_LINES);
+         CountDownCallback aio = new CountDownCallback(latch);
+
          for (int i = 0; i < NUMBER_LINES; i++)
          {
-            buffer.clear();
+            ByteBuffer buffer = ByteBuffer.allocateDirect(SIZE);
             addString("Str value " + i + "\n", buffer);
             for (int j = buffer.position(); j < buffer.capacity() - 1; j++)
             {
@@ -332,14 +335,14 @@
             }
             buffer.put((byte) '\n');
             
-            CountDownLatch latch = new CountDownLatch(1);
-            CountDownCallback aio = new CountDownCallback(latch);
             controller.write(i * SIZE, SIZE, buffer, aio);
-            latch.await();
-            assertFalse(aio.errorCalled);
-            assertTrue(aio.doneCalled);
          }
          
+         latch.await();
+         assertFalse(aio.errorCalled);
+         assertEquals(NUMBER_LINES, aio.timesDoneCalled.get());
+         }
+ 
          // If you call close you're supposed to wait events to finish before closing it
          log.debug("Closing file");
          controller.close();
@@ -360,6 +363,9 @@
             
             CountDownLatch latch = new CountDownLatch(1);
             CountDownCallback aio = new CountDownCallback(latch);
+            
+            ByteBuffer buffer = ByteBuffer.allocateDirect(SIZE);
+            
             controller.read(i * SIZE, SIZE, buffer, aio);
             latch.await();
             assertFalse(aio.errorCalled);
@@ -381,8 +387,6 @@
             
             assertTrue(buffer.equals(newBuffer));
          }
-         
-         controller.destroyBuffer(buffer);
       } finally
       {
          try




More information about the jboss-cvs-commits mailing list