[jboss-cvs] JBoss Messaging SVN: r4487 - in trunk/tests/src/org/jboss/messaging/tests: unit/core/journal/impl and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jun 16 14:27:01 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-06-16 14:27:01 -0400 (Mon, 16 Jun 2008)
New Revision: 4487

Modified:
   trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/AIOTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/SingleThreadWriteNativeTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AIOSequentialFileFactoryTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/RealAIOJournalImplTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/timing/RealJournalImplAIOTest.java
Log:
JBMESSAGING-1334 - Fixing aio tests on hudson

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/AIOTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/AIOTestBase.java	2008-06-16 16:14:23 UTC (rev 4486)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/AIOTestBase.java	2008-06-16 18:27:01 UTC (rev 4487)
@@ -38,7 +38,8 @@
  */
 public abstract class AIOTestBase extends UnitTestCase
 {
-   protected String fileDir = System.getProperty("user.home") + "/journal-test";
+   // The AIO Test must use a local filesystem. Sometimes $HOME is on a NFS on most enterprise systems
+   protected String fileDir = "/tmp/journal-test";
    protected String FILE_NAME = fileDir + "/fileUsedOnNativeTests.log";
    
    protected void setUp() throws Exception
@@ -63,6 +64,7 @@
    {
       super.tearDown();
       assertEquals(0, AsynchronousFileImpl.getTotalMaxIO());
+      //deleteDirectory(new File(fileDir));
    }
    
    protected void encodeBufer(ByteBuffer buffer)

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-06-16 16:14:23 UTC (rev 4486)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/asyncio/impl/SingleThreadWriteNativeTest.java	2008-06-16 18:27:01 UTC (rev 4487)
@@ -528,7 +528,7 @@
          long timeTotal = System.currentTimeMillis() - valueInitial;
          log.info("After completions time = " + timeTotal + " for "
                + numberOfLines + " registers " + " size each line = " + size
-               + " Records/Sec=" + (numberOfLines * 1000 / timeTotal)
+               + ", Records/Sec=" + (numberOfLines * 1000 / timeTotal)
                + " (Assynchronous)");
          
          for (CountDownCallback tmp : list)
@@ -595,42 +595,41 @@
       
    }
  
-//   disabled until http://jira.jboss.com/jira/browse/JBMESSAGING-1334 is done
-//   public void testInvalidWrite() throws Exception
-//   {
-//      final AsynchronousFileImpl controller = new AsynchronousFileImpl();
-//      controller.open(FILE_NAME, 2000, 120);
-//      
-//      try
-//      {
-//         
-//         final int SIZE = 512;
-//         
-//         ByteBuffer block = controller.newBuffer(SIZE);
-//         encodeBufer(block);
-//         
-//         preAlloc(controller, 1000 * 512);
-//         
-//         CountDownLatch latchDone = new CountDownLatch(1);
-//         
-//         CountDownCallback aioBlock = new CountDownCallback(latchDone);
-//         controller.write(11, 512, block, aioBlock);
-//         
-//         latchDone.await();
-//         
-//         assertTrue(aioBlock.errorCalled);
-//         assertFalse(aioBlock.doneCalled);
-//         
-//         controller.destroyBuffer(block);
-//      } catch (Exception e)
-//      {
-//         throw e;
-//      } finally
-//      {
-//         controller.close();
-//      }
-//      
-//   }
+   public void testInvalidWrite() throws Exception
+   {
+      final AsynchronousFileImpl controller = new AsynchronousFileImpl();
+      controller.open(FILE_NAME, 2000, 120);
+      
+      try
+      {
+         
+         final int SIZE = 512;
+         
+         ByteBuffer block = controller.newBuffer(SIZE);
+         encodeBufer(block);
+         
+         preAlloc(controller, 10 * 512);
+         
+         CountDownLatch latchDone = new CountDownLatch(1);
+         
+         CountDownCallback aioBlock = new CountDownCallback(latchDone);
+         controller.write(11, 512, block, aioBlock);
+         
+         latchDone.await();
+         
+         assertTrue(aioBlock.errorCalled);
+         assertFalse(aioBlock.doneCalled);
+         
+         controller.destroyBuffer(block);
+      } catch (Exception e)
+      {
+         throw e;
+      } finally
+      {
+         controller.close();
+      }
+      
+   }
    
    public void testInvalidAlloc() throws Exception
    {

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AIOSequentialFileFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AIOSequentialFileFactoryTest.java	2008-06-16 16:14:23 UTC (rev 4486)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AIOSequentialFileFactoryTest.java	2008-06-16 18:27:01 UTC (rev 4487)
@@ -42,7 +42,7 @@
 public class AIOSequentialFileFactoryTest extends SequentialFileFactoryTestBase
 {
 
-   protected String journalDir = System.getProperty("user.home") + "/journal-test";
+   protected String journalDir = "/tmp/journal-test";
    
    protected void setUp() throws Exception
    {
@@ -55,6 +55,13 @@
       file.mkdir();     
    }
 
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+
+      deleteDirectory(new File(journalDir));
+   }
+
    protected SequentialFileFactory createFactory()
    {
       return new AIOSequentialFileFactory(journalDir);

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/RealAIOJournalImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/RealAIOJournalImplTest.java	2008-06-16 16:14:23 UTC (rev 4486)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/RealAIOJournalImplTest.java	2008-06-16 18:27:01 UTC (rev 4487)
@@ -39,13 +39,15 @@
  *   III - Add -Djava.library.path=<your project place>/native/src/.libs
  *
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
  *
  */
 public class RealAIOJournalImplTest extends JournalImplTestUnit
 {
    private static final Logger log = Logger.getLogger(RealAIOJournalImplTest.class);
    
-   protected String journalDir = System.getProperty("user.home") + "/journal-test";
+   // Need to run the test over a local disk (no NFS)
+   protected String journalDir = "/tmp/journal-test";
      
    @Override
    protected void setUp() throws Exception
@@ -60,6 +62,12 @@
       }
    }
    
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+      deleteDirectory(new File(journalDir));
+   }
+   
    protected SequentialFileFactory getFileFactory() throws Exception
    {
       File file = new File(journalDir);

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/timing/RealJournalImplAIOTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/timing/RealJournalImplAIOTest.java	2008-06-16 16:14:23 UTC (rev 4486)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/timing/RealJournalImplAIOTest.java	2008-06-16 18:27:01 UTC (rev 4487)
@@ -38,8 +38,17 @@
 {
    private static final Logger log = Logger.getLogger(RealJournalImplAIOTest.class);
    
-   protected String journalDir = System.getProperty("user.home") + "/journal-test";
+   // Need to run the test over a local disk (no NFS)
+   protected String journalDir = "/tmp/journal-test";
+   
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
       
+      deleteDirectory(new File(journalDir));
+   }
+
+      
    protected SequentialFileFactory getFileFactory() throws Exception
    {
       File file = new File(journalDir);




More information about the jboss-cvs-commits mailing list