FileDocCategorySizeDatePackage
TestUUID.javaAPI DocApache Axis 1.42075Sat Apr 22 18:57:28 BST 2006test.components

TestUUID

public class TestUUID extends TestCase
UUIDGen adopted from the juddi project (http://sourceforge.net/projects/juddi/)

Fields Summary
Constructors Summary
public TestUUID(String name)

        super(name);
    
Methods Summary
public static junit.framework.Testsuite()

        return new TestSuite(TestUUID.class);
    
public voidtestSequence()

        String current = null;
        String prev = null;
        
        FastUUIDGen g = new FastUUIDGen();
        for (int i=0;i<1000;i++) {
            current = g.nextUUID();
            if (current.equals(prev)) {
                fail("same uuid generated: " + current + " " + prev);
            }
            prev = current;
        }
    
public voidtestUUID()

        long startTime = 0;
        long endTime = 0;
        UUIDGen uuidgen = null;

        uuidgen = UUIDGenFactory.getUUIDGen();
        startTime = System.currentTimeMillis();
        for (int i = 1; i <= 10; ++i) {
            String u = uuidgen.nextUUID();
            System.out.println(i + ":  " + u);
        }
        endTime = System.currentTimeMillis();
        System.out.println("UUIDGen took " + (endTime - startTime) + " milliseconds");