jdillon 2003/08/30 02:33:33
Modified: modules/core/src/test/org/apache/geronimo/naming/java
BasicContextTest.java
modules/core/src/java/org/apache/geronimo Main.java
Log:
o Using StopWatch.toDuration()
Revision Changes Path
1.3 +13 -8
incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/BasicContextTest.java
Index: BasicContextTest.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/BasicContextTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BasicContextTest.java 23 Aug 2003 22:13:15 -0000 1.2
+++ BasicContextTest.java 30 Aug 2003 09:33:32 -0000 1.3
@@ -60,6 +60,7 @@
import java.util.Map;
import java.util.Properties;
import java.util.NoSuchElementException;
+
import javax.naming.Binding;
import javax.naming.CompositeName;
import javax.naming.CompoundName;
@@ -69,10 +70,12 @@
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
+import org.apache.geronimo.common.StopWatch;
+
import junit.framework.TestCase;
/**
- *
+* Unit tests for basic ops on an [EMAIL PROTECTED] InitialContext}.
*
* @version $Revision$ $Date$
*/
@@ -105,7 +108,7 @@
assertEquals(envContext, envContext.lookup(""));
}
-
+
public void testSchemeLookup() throws NamingException {
envContext.lookup("dns:apache.org");
assertEquals("Hello", envContext.lookup("java:comp/env/hello"));
@@ -181,15 +184,17 @@
}
public void testSpeed() throws NamingException {
+ StopWatch watch = new StopWatch();
Context comp = (Context) initialContext.lookup("java:comp");
- long start = System.currentTimeMillis();
+
+ watch.start();
for (int i=0; i < 1000000; i++) {
-// initialContext.lookup("java:comp/hello"); // this is sloooow
due to scheme resolution
-// envContext.lookup("hello");
+ // initialContext.lookup("java:comp/hello"); // this is sloooow
due to scheme resolution
+ // envContext.lookup("hello");
comp.lookup("env/hello");
}
- long end = System.currentTimeMillis();
- System.out.println("lookup(String): "+ (end-start) + "ns.");
+
+ System.out.println("lookup(String): " + watch.toDuration());
}
protected void setUp() throws Exception {
1.15 +2 -3
incubator-geronimo/modules/core/src/java/org/apache/geronimo/Main.java
Index: Main.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/Main.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Main.java 29 Aug 2003 17:56:39 -0000 1.14
+++ Main.java 30 Aug 2003 09:33:33 -0000 1.15
@@ -67,7 +67,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.impl.LogFactoryImpl;
-import org.apache.geronimo.common.Duration;
import org.apache.geronimo.common.StopWatch;
import org.apache.geronimo.deployment.DeploymentException;
@@ -151,7 +150,7 @@
MBeanServer mbServer = kernel.getMBeanServer();
mbServer.invoke(controllerName, "deploy", deployArgs,
DEPLOY_ARG_TYPES);
- log.info("Started Server in " + new
Duration(watch.getTime()));
+ log.info("Started Server in " + watch.toDuration());
} catch (Throwable e) {
log.error("Error starting Server", e);
return;