[jboss-cvs] JBoss Messaging SVN: r7212 - trunk/tests/src/org/jboss/messaging/tests/unit/core/asyncio.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 5 00:42:05 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-05 00:42:05 -0400 (Fri, 05 Jun 2009)
New Revision: 7212

Added:
   trunk/tests/src/org/jboss/messaging/tests/unit/core/asyncio/SleepTest.java
Modified:
   trunk/tests/src/org/jboss/messaging/tests/unit/core/asyncio/AsynchronousFileTest.java
Log:
Moving sleepTest

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/asyncio/AsynchronousFileTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/asyncio/AsynchronousFileTest.java	2009-06-05 04:25:49 UTC (rev 7211)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/asyncio/AsynchronousFileTest.java	2009-06-05 04:42:05 UTC (rev 7212)
@@ -951,34 +951,7 @@
       controller.close();
 
    }
-   
-   public void testNanoSleep() throws Exception
-   {
-      AsynchronousFileImpl.setNanoSleepInterval(1);
-      AsynchronousFileImpl.nanoSleep();
-      
-      long timeInterval = 1000000;
-      long nloops = 1000;
-      
-      AsynchronousFileImpl.setNanoSleepInterval((int)timeInterval);
 
-      long time = System.currentTimeMillis();
-      
-      for (long i = 0 ; i < nloops; i++)
-      {
-         AsynchronousFileImpl.nanoSleep();
-      }
-      
-      long end = System.currentTimeMillis();
-      
-      long expectedTime = (timeInterval * nloops / 1000000l);
-      
-      System.out.println("TotalTime = " +  (end - time) + " expected = " + expectedTime);
-      
-      assertTrue((end - time) >= expectedTime);
-      
-   }
-
    private void addString(final String str, final ByteBuffer buffer)
    {
       CharBuffer charBuffer = CharBuffer.wrap(str);

Added: trunk/tests/src/org/jboss/messaging/tests/unit/core/asyncio/SleepTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/asyncio/SleepTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/asyncio/SleepTest.java	2009-06-05 04:42:05 UTC (rev 7212)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.messaging.tests.unit.core.asyncio;
+
+import junit.framework.TestCase;
+
+import org.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl;
+
+/**
+ * A SleepTest
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class SleepTest extends TestCase
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+   
+   public void testNanoSleep() throws Exception
+   {
+      AsynchronousFileImpl.setNanoSleepInterval(1);
+      AsynchronousFileImpl.nanoSleep();
+      
+      long timeInterval = 1000000;
+      long nloops = 1000;
+      
+      AsynchronousFileImpl.setNanoSleepInterval((int)timeInterval);
+
+      long time = System.currentTimeMillis();
+      
+      for (long i = 0 ; i < nloops; i++)
+      {
+         AsynchronousFileImpl.nanoSleep();
+      }
+      
+      long end = System.currentTimeMillis();
+      
+      long expectedTime = (timeInterval * nloops / 1000000l);
+      
+      System.out.println("TotalTime = " +  (end - time) + " expected = " + expectedTime);
+      
+      assertTrue((end - time) >= expectedTime);
+      
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}




More information about the jboss-cvs-commits mailing list