[jboss-cvs] JBoss Messaging SVN: r4657 - in trunk/tests/src/org/jboss/messaging/tests: unit/util and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 7 13:35:49 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-07-07 13:35:49 -0400 (Mon, 07 Jul 2008)
New Revision: 4657

Added:
   trunk/tests/src/org/jboss/messaging/tests/timing/util/UUIDTest.java
Modified:
   trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDTest.java
Log:
Extending UUIDTest as a timing test

Added: trunk/tests/src/org/jboss/messaging/tests/timing/util/UUIDTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/timing/util/UUIDTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/timing/util/UUIDTest.java	2008-07-07 17:35:49 UTC (rev 4657)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, 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.timing.util;
+/**
+ * 
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ *
+ */
+public class UUIDTest extends org.jboss.messaging.tests.unit.util.UUIDTest
+{
+
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+
+   @Override
+   protected int getTimes()
+   {
+      return 1000000;
+   }
+   
+  
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
+   
+}

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDTest.java	2008-07-07 17:06:22 UTC (rev 4656)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDTest.java	2008-07-07 17:35:49 UTC (rev 4657)
@@ -22,15 +22,14 @@
 
 package org.jboss.messaging.tests.unit.util;
 
-import junit.framework.TestCase;
-import org.jboss.messaging.util.UUIDGenerator;
-
 import java.net.InetAddress;
-import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
+import junit.framework.TestCase;
+
+import org.jboss.messaging.util.UUIDGenerator;
+
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  *
@@ -41,8 +40,6 @@
 {
    // Constants -----------------------------------------------------
 
-   private static final int MANY_TIMES = 1000;
-   
    // Attributes ----------------------------------------------------
 
    // Static --------------------------------------------------------
@@ -53,18 +50,18 @@
 
    public void testManyUUIDs() throws Exception
    {
-      List<String> uuids = new ArrayList<String>(MANY_TIMES);
+      final int MANY_TIMES = getTimes();
+      Set<String> uuidsSet = new HashSet<String>();
       
       UUIDGenerator gen = UUIDGenerator.getInstance();
       InetAddress addr = InetAddress.getLocalHost();
       
       for (int i = 0; i < MANY_TIMES; i++)
       {
-         uuids.add(gen.generateTimeBasedUUID(addr).toString());
+         uuidsSet.add(gen.generateTimeBasedUUID(addr).toString());
       }
       
       // we put them in a set to check duplicates
-      Set<String> uuidsSet = new HashSet<String>(uuids);
       assertEquals(MANY_TIMES, uuidsSet.size());
    }
    
@@ -72,6 +69,11 @@
 
    // Protected -----------------------------------------------------
 
+   protected int getTimes()
+   {
+      return 1000;
+   }
+   
    // Private -------------------------------------------------------
 
    // Inner classes -------------------------------------------------




More information about the jboss-cvs-commits mailing list