[jboss-cvs] JBoss Messaging SVN: r5089 - trunk/tests/src/org/jboss/messaging/tests/unit/util.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 8 15:27:31 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-10-08 15:27:30 -0400 (Wed, 08 Oct 2008)
New Revision: 5089

Modified:
   trunk/tests/src/org/jboss/messaging/tests/unit/util/TimeAndCounterIDGeneratorTest.java
Log:
Changing IDGenerator to take 4 extra bits from time

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/TimeAndCounterIDGeneratorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/TimeAndCounterIDGeneratorTest.java	2008-10-08 19:26:58 UTC (rev 5088)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/TimeAndCounterIDGeneratorTest.java	2008-10-08 19:27:30 UTC (rev 5089)
@@ -22,7 +22,6 @@
 
 package org.jboss.messaging.tests.unit.util;
 
-import java.util.Date;
 import java.util.concurrent.CountDownLatch;
 
 import org.jboss.messaging.tests.util.UnitTestCase;
@@ -165,11 +164,11 @@
 
       TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
 
-      System.out.println("Current Time = " + hex(System.currentTimeMillis()));
+      System.out.println("Current Time = " + hex(System.currentTimeMillis()) + " " + seq);
       
       seq.setInternalDate(System.currentTimeMillis() + 10000l); // 10 seconds in the future
 
-      seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK -1); // 1 ID about to explode
+      seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK); // 1 ID about to explode
      
       try
       {
@@ -184,11 +183,15 @@
       seq = new TimeAndCounterIDGenerator();
       
       seq.setInternalDate(System.currentTimeMillis() - 10000l); // 10 seconds in the past
+      
+      long timeMark = seq.getInternalTimeMark();
 
-      seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK -1); // 1 ID about to explode
+      seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK); // 1 ID about to explode
       
       // This is ok... the time portion would be added to the next one generated 10 seconds ago
       seq.generateID();
+
+      assertTrue (hex(timeMark) + " < " + hex(seq.getInternalTimeMark()), timeMark < seq.getInternalTimeMark());
    }
 
    private static String hex(final long value)




More information about the jboss-cvs-commits mailing list