01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package test;
08:
09: import junit.framework.Test;
10: import junit.framework.TestCase;
11: import junit.framework.TestSuite;
12: import junit.textui.TestRunner;
13: import org.codehaus.aspectwerkz.util.UuidGenerator;
14:
15: /**
16: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
17: */
18: public class UUIDTest extends TestCase {
19: private int m_numberOfInvocations = 1000000;
20:
21: public UUIDTest(String name) {
22: super (name);
23: }
24:
25: public void testPerformance() {
26: long startTime = System.currentTimeMillis();
27: for (int i = 0; i < m_numberOfInvocations; i++) {
28: String uuid = UuidGenerator.generate(this );
29: }
30: long time = System.currentTimeMillis() - startTime;
31: double timePerUuidGenaration = time
32: / (double) m_numberOfInvocations;
33: }
34:
35: public static void main(String[] args) {
36: TestRunner.run(suite());
37: }
38:
39: public static Test suite() {
40: return new TestSuite(UUIDTest.class);
41: }
42: }
|