User: d_jencks Date: 01/09/17 10:33:53 Modified: src/main/org/jboss/test/perf/test Command.java PerfStressTestCase.java SecurePerfStressTestCase.java Setup.java Log: Finished converting to JBossTestCase for deploy and logging. Security tests still do not work due to deploy problems Revision Changes Path 1.2 +7 -0 jbosstest/src/main/org/jboss/test/perf/test/Command.java Index: Command.java =================================================================== RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/perf/test/Command.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Command.java 2000/08/25 13:43:45 1.1 +++ Command.java 2001/09/17 17:33:53 1.2 @@ -1,3 +1,10 @@ +/* + * JBoss, the OpenSource J2EE webOS + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + package org.jboss.test.perf.test; // Command.java import org.jboss.test.perf.interfaces.*; 1.2 +66 -63 jbosstest/src/main/org/jboss/test/perf/test/PerfStressTestCase.java Index: PerfStressTestCase.java =================================================================== RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/perf/test/PerfStressTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PerfStressTestCase.java 2001/09/12 04:55:40 1.1 +++ PerfStressTestCase.java 2001/09/17 17:33:53 1.2 @@ -1,3 +1,10 @@ +/* + * JBoss, the OpenSource J2EE webOS + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + package org.jboss.test.perf.test; import java.io.IOException; @@ -23,14 +30,16 @@ import org.jboss.test.perf.interfaces.TxSession; import org.jboss.test.perf.interfaces.TxSessionHome; +import org.jboss.test.JBossTestCase; + /** Test of EJB call invocation overhead. @author [EMAIL PROTECTED] - @version $Revision: 1.1 $ + @version $Revision: 1.2 $ */ -public class PerfStressTestCase extends junit.framework.TestCase +public class PerfStressTestCase extends JBossTestCase { - static int N = 1000; + static int N = 1000; public PerfStressTestCase(String name) { @@ -39,14 +48,13 @@ public void testClientSession() throws Exception { - System.out.println("+++ testClientSession()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("ClientSession"); + getLog().debug("+++ testClientSession()"); + Object obj = getInitialContext().lookup("ClientSession"); obj = PortableRemoteObject.narrow(obj, SessionHome.class); SessionHome home = (SessionHome) obj; - System.out.println("Found SessionHome @ jndiName=ClientSession"); + getLog().debug("Found SessionHome @ jndiName=ClientSession"); Session bean = home.create("Entity"); - System.out.println("Created ClientSession"); + getLog().debug("Created ClientSession"); try { bean.create(0, 100); @@ -62,19 +70,18 @@ bean.remove(0, 100); long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println("Elapsed time = "+(elapsed / N)); + getLog().debug("Elapsed time = "+(elapsed / N)); } public void testTimings() throws Exception { - System.out.println("+++ testTimings()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("Probe"); + getLog().debug("+++ testTimings()"); + Object obj = getInitialContext().lookup("Probe"); obj = PortableRemoteObject.narrow(obj, ProbeHome.class); ProbeHome home = (ProbeHome) obj; - System.out.println("Found ProbeHome @ jndiName=Probe"); + getLog().debug("Found ProbeHome @ jndiName=Probe"); Probe bean = home.create(); - System.out.println("Created Probe"); + getLog().debug("Created Probe"); warmup(bean); noop(bean); ping(bean); @@ -83,14 +90,13 @@ public void testTimingsCMT() throws Exception { - System.out.println("+++ testTimingsCMT()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("ProbeCMT"); + getLog().debug("+++ testTimingsCMT()"); + Object obj = getInitialContext().lookup("ProbeCMT"); obj = PortableRemoteObject.narrow(obj, ProbeHome.class); ProbeHome home = (ProbeHome) obj; - System.out.println("Found ProbeHome @ jndiName=ProbeCMT"); + getLog().debug("Found ProbeHome @ jndiName=ProbeCMT"); Probe bean = home.create(); - System.out.println("Created ProbeCMT"); + getLog().debug("Created ProbeCMT"); warmup(bean); noop(bean); ping(bean); @@ -99,14 +105,13 @@ public void testTxTimings() throws Exception { - System.out.println("+++ testTxTimings()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("TxSession"); + getLog().debug("+++ testTxTimings()"); + Object obj = getInitialContext().lookup("TxSession"); obj = PortableRemoteObject.narrow(obj, TxSessionHome.class); TxSessionHome home = (TxSessionHome) obj; - System.out.println("Found TxSession @ jndiName=TxSession"); + getLog().debug("Found TxSession @ jndiName=TxSession"); TxSession bean = home.create(); - System.out.println("Created TxSession"); + getLog().debug("Created TxSession"); txRequired(bean); txRequiresNew(bean); txSupports(bean); @@ -117,45 +122,43 @@ } public void testFindByPrimaryKey() throws Exception { - System.out.println("+++ testFindByPrimaryKey()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("Entity"); + getLog().debug("+++ testFindByPrimaryKey()"); + Object obj = getInitialContext().lookup("Entity"); obj = PortableRemoteObject.narrow(obj, EntityHome.class); EntityHome home = (EntityHome) obj; - System.out.println("Found EntityHome @ jndiName=Entity"); + getLog().debug("Found EntityHome @ jndiName=Entity"); EntityPK key = new EntityPK(1); Entity bean = null; - System.out.println("Running with 1 instance..."); + getLog().debug("Running with 1 instance..."); findByPrimaryKey(key, home); - System.out.println("Running with 100 instance..."); + getLog().debug("Running with 100 instance..."); findByPrimaryKey(key, home); - System.out.println("Running with 1000 instance..."); + getLog().debug("Running with 1000 instance..."); findByPrimaryKey(key, home); /* - System.out.println("Running with 10000 instance..."); + getLog().debug("Running with 10000 instance..."); findByPrimaryKey(key, home); */ } public void testFindByPrimaryKey2() throws Exception { - System.out.println("+++ testFindByPrimaryKey2()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("Entity2"); + getLog().debug("+++ testFindByPrimaryKey2()"); + Object obj = getInitialContext().lookup("Entity2"); obj = PortableRemoteObject.narrow(obj, Entity2Home.class); Entity2Home home = (Entity2Home) obj; - System.out.println("Found EntityHome @ jndiName=Entity"); + getLog().debug("Found EntityHome @ jndiName=Entity"); Entity2PK key = new Entity2PK(1, "String1", new Double(1)); Entity bean = null; - System.out.println("Running with 1 instance..."); + getLog().debug("Running with 1 instance..."); findByPrimaryKey(key, home); - System.out.println("Running with 100 instance..."); + getLog().debug("Running with 100 instance..."); findByPrimaryKey(key, home); - System.out.println("Running with 1000 instance..."); + getLog().debug("Running with 1000 instance..."); findByPrimaryKey(key, home); /* - System.out.println("Running with 10000 instance..."); + getLog().debug("Running with 10000 instance..."); findByPrimaryKey(key, home); */ } @@ -169,27 +172,27 @@ private void noop(Probe bean) throws Exception { - System.out.println("Starting "+N+" noop() invocations"); + getLog().debug("Starting "+N+" noop() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) bean.noop(); long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" noop() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); + getLog().debug(N+" noop() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); } private void ping(Probe bean) throws Exception { - System.out.println("Starting "+N+" ping(PING) invocations"); + getLog().debug("Starting "+N+" ping(PING) invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) bean.ping("PING"); long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" ping() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); + getLog().debug(N+" ping() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); } private void echo(Probe bean) throws Exception { - System.out.println("Starting "+N+" echo(ECHO) invocations"); + getLog().debug("Starting "+N+" echo(ECHO) invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -197,11 +200,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" echo() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); + getLog().debug(N+" echo() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); } private void txRequired(TxSession bean) throws Exception { - System.out.println("Starting "+N+" txRequired() invocations"); + getLog().debug("Starting "+N+" txRequired() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -209,11 +212,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" txRequired() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txRequired"); + getLog().debug(N+" txRequired() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txRequired"); } private void txRequiresNew(TxSession bean) throws Exception { - System.out.println("Starting "+N+" txRequired() invocations"); + getLog().debug("Starting "+N+" txRequired() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -221,11 +224,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" txRequiresNew() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txRequiresNew"); + getLog().debug(N+" txRequiresNew() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txRequiresNew"); } private void txSupports(TxSession bean) throws Exception { - System.out.println("Starting "+N+" txSupports() invocations"); + getLog().debug("Starting "+N+" txSupports() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -233,11 +236,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" txSupports() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txSupports"); + getLog().debug(N+" txSupports() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txSupports"); } private void txNotSupported(TxSession bean) throws Exception { - System.out.println("Starting "+N+" txNotSupported() invocations"); + getLog().debug("Starting "+N+" txNotSupported() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -245,11 +248,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" txNotSupported() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txNotSupported"); + getLog().debug(N+" txNotSupported() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txNotSupported"); } private void requiredToSupports(TxSession bean) throws Exception { - System.out.println("Starting "+N+" requiredToSupports() invocations"); + getLog().debug("Starting "+N+" requiredToSupports() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -257,11 +260,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" requiredToSupports() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToSupports"); + getLog().debug(N+" requiredToSupports() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToSupports"); } private void requiredToMandatory(TxSession bean) throws Exception { - System.out.println("Starting "+N+" requiredToMandatory() invocations"); + getLog().debug("Starting "+N+" requiredToMandatory() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -269,11 +272,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" requiredToMandatory() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToMandatory"); + getLog().debug(N+" requiredToMandatory() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToMandatory"); } private void requiredToRequiresNew(TxSession bean) throws Exception { - System.out.println("Starting "+N+" requiredToRequiresNew() invocations"); + getLog().debug("Starting "+N+" requiredToRequiresNew() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -281,12 +284,12 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" requiredToRequiresNew() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToRequiresNew"); + getLog().debug(N+" requiredToRequiresNew() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToRequiresNew"); } private void findByPrimaryKey(EntityPK key, EntityHome home) throws Exception { - System.out.println("Starting "+N+" findByPrimaryKey(key="+key+") invocations"); + getLog().debug("Starting "+N+" findByPrimaryKey(key="+key+") invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -294,11 +297,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" findByPrimaryKey() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/findByPrimaryKey"); + getLog().debug(N+" findByPrimaryKey() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/findByPrimaryKey"); } private void findByPrimaryKey(Entity2PK key, Entity2Home home) throws Exception { - System.out.println("Starting "+N+" findByPrimaryKey(key="+key+") invocations"); + getLog().debug("Starting "+N+" findByPrimaryKey(key="+key+") invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -306,7 +309,7 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" findByPrimaryKey() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/findByPrimaryKey"); + getLog().debug(N+" findByPrimaryKey() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/findByPrimaryKey"); } public static Test suite() 1.2 +66 -61 jbosstest/src/main/org/jboss/test/perf/test/SecurePerfStressTestCase.java Index: SecurePerfStressTestCase.java =================================================================== RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/perf/test/SecurePerfStressTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SecurePerfStressTestCase.java 2001/09/12 04:55:40 1.1 +++ SecurePerfStressTestCase.java 2001/09/17 17:33:53 1.2 @@ -1,3 +1,10 @@ +/* + * JBoss, the OpenSource J2EE webOS + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + package org.jboss.test.perf.test; import java.io.IOException; @@ -24,14 +31,16 @@ import org.jboss.test.perf.interfaces.TxSession; import org.jboss.test.perf.interfaces.TxSessionHome; +import org.jboss.test.JBossTestCase; + /** Test of EJB call invocation overhead in the presence of EJB security. @author [EMAIL PROTECTED] - @version $Revision: 1.1 $ + @version $Revision: 1.2 $ */ -public class SecurePerfStressTestCase extends junit.framework.TestCase +public class SecurePerfStressTestCase extends JBossTestCase { - static int N = 1000; + static int N = 1000; static LoginContext lc = null; public SecurePerfStressTestCase(String name) @@ -41,14 +50,13 @@ public void testClientSession() throws Exception { - System.out.println("+++ testClientSession()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("secure/perf/ClientSession"); + getLog().debug("+++ testClientSession()"); + Object obj = getInitialContext().lookup("secure/perf/ClientSession"); obj = PortableRemoteObject.narrow(obj, SessionHome.class); SessionHome home = (SessionHome) obj; - System.out.println("Found SessionHome @ jndiName=ClientSession"); + getLog().debug("Found SessionHome @ jndiName=ClientSession"); Session bean = home.create("secure/perf/Entity"); - System.out.println("Created ClientSession"); + getLog().debug("Created ClientSession"); try { bean.create(0, 100); @@ -64,19 +72,18 @@ bean.remove(0, 100); long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println("Elapsed time = "+(elapsed / N)); + getLog().debug("Elapsed time = "+(elapsed / N)); } public void testTimings() throws Exception { - System.out.println("+++ testTimings()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("secure/perf/Probe"); + getLog().debug("+++ testTimings()"); + Object obj = getInitialContext().lookup("secure/perf/Probe"); obj = PortableRemoteObject.narrow(obj, ProbeHome.class); ProbeHome home = (ProbeHome) obj; - System.out.println("Found ProbeHome @ jndiName=Probe"); + getLog().debug("Found ProbeHome @ jndiName=Probe"); Probe bean = home.create(); - System.out.println("Created Probe"); + getLog().debug("Created Probe"); warmup(bean); noop(bean); ping(bean); @@ -85,14 +92,14 @@ public void testTimingsCMT() throws Exception { - System.out.println("+++ testTimingsCMT()"); + getLog().debug("+++ testTimingsCMT()"); InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("secure/perf/ProbeCMT"); + Object obj = getInitialContext().lookup("secure/perf/ProbeCMT"); obj = PortableRemoteObject.narrow(obj, ProbeHome.class); ProbeHome home = (ProbeHome) obj; - System.out.println("Found ProbeHome @ jndiName=ProbeCMT"); + getLog().debug("Found ProbeHome @ jndiName=ProbeCMT"); Probe bean = home.create(); - System.out.println("Created ProbeCMT"); + getLog().debug("Created ProbeCMT"); warmup(bean); noop(bean); ping(bean); @@ -101,14 +108,13 @@ public void testTxTimings() throws Exception { - System.out.println("+++ testTxTimings()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("secure/perf/TxSession"); + getLog().debug("+++ testTxTimings()"); + Object obj = getInitialContext().lookup("secure/perf/TxSession"); obj = PortableRemoteObject.narrow(obj, TxSessionHome.class); TxSessionHome home = (TxSessionHome) obj; - System.out.println("Found TxSession @ jndiName=TxSession"); + getLog().debug("Found TxSession @ jndiName=TxSession"); TxSession bean = home.create(); - System.out.println("Created TxSession"); + getLog().debug("Created TxSession"); txRequired(bean); txRequiresNew(bean); txSupports(bean); @@ -119,46 +125,45 @@ } public void testFindByPrimaryKey() throws Exception { - System.out.println("+++ testFindByPrimaryKey()"); + getLog().debug("+++ testFindByPrimaryKey()"); InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("secure/perf/Entity"); + Object obj = getInitialContext().lookup("secure/perf/Entity"); obj = PortableRemoteObject.narrow(obj, EntityHome.class); EntityHome home = (EntityHome) obj; - System.out.println("Found EntityHome @ jndiName=Entity"); + getLog().debug("Found EntityHome @ jndiName=Entity"); EntityPK key = new EntityPK(1); Entity bean = null; - System.out.println("Running with 1 instance..."); + getLog().debug("Running with 1 instance..."); findByPrimaryKey(key, home); - System.out.println("Running with 100 instance..."); + getLog().debug("Running with 100 instance..."); findByPrimaryKey(key, home); - System.out.println("Running with 1000 instance..."); + getLog().debug("Running with 1000 instance..."); findByPrimaryKey(key, home); /* - System.out.println("Running with 10000 instance..."); + getLog().debug("Running with 10000 instance..."); findByPrimaryKey(key, home); */ } public void testFindByPrimaryKey2() throws Exception { - System.out.println("+++ testFindByPrimaryKey2()"); - InitialContext jndiContext = new InitialContext(); - Object obj = jndiContext.lookup("secure/perf/Entity2"); + getLog().debug("+++ testFindByPrimaryKey2()"); + Object obj = getInitialContext().lookup("secure/perf/Entity2"); obj = PortableRemoteObject.narrow(obj, Entity2Home.class); Entity2Home home = (Entity2Home) obj; - System.out.println("Found EntityHome @ jndiName=Entity"); + getLog().debug("Found EntityHome @ jndiName=Entity"); Entity2PK key = new Entity2PK(1, "String1", new Double(1)); Entity bean = null; - System.out.println("Running with 1 instance..."); + getLog().debug("Running with 1 instance..."); findByPrimaryKey(key, home); - System.out.println("Running with 100 instance..."); + getLog().debug("Running with 100 instance..."); findByPrimaryKey(key, home); - System.out.println("Running with 1000 instance..."); + getLog().debug("Running with 1000 instance..."); findByPrimaryKey(key, home); /* - System.out.println("Running with 10000 instance..."); + getLog().debug("Running with 10000 instance..."); findByPrimaryKey(key, home); */ } @@ -172,27 +177,27 @@ private void noop(Probe bean) throws Exception { - System.out.println("Starting "+N+" noop() invocations"); + getLog().debug("Starting "+N+" noop() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) bean.noop(); long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" noop() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); + getLog().debug(N+" noop() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); } private void ping(Probe bean) throws Exception { - System.out.println("Starting "+N+" ping(PING) invocations"); + getLog().debug("Starting "+N+" ping(PING) invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) bean.ping("PING"); long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" ping() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); + getLog().debug(N+" ping() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); } private void echo(Probe bean) throws Exception { - System.out.println("Starting "+N+" echo(ECHO) invocations"); + getLog().debug("Starting "+N+" echo(ECHO) invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -200,11 +205,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" echo() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); + getLog().debug(N+" echo() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/noop"); } private void txRequired(TxSession bean) throws Exception { - System.out.println("Starting "+N+" txRequired() invocations"); + getLog().debug("Starting "+N+" txRequired() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -212,11 +217,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" txRequired() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txRequired"); + getLog().debug(N+" txRequired() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txRequired"); } private void txRequiresNew(TxSession bean) throws Exception { - System.out.println("Starting "+N+" txRequired() invocations"); + getLog().debug("Starting "+N+" txRequired() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -224,11 +229,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" txRequiresNew() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txRequiresNew"); + getLog().debug(N+" txRequiresNew() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txRequiresNew"); } private void txSupports(TxSession bean) throws Exception { - System.out.println("Starting "+N+" txSupports() invocations"); + getLog().debug("Starting "+N+" txSupports() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -236,11 +241,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" txSupports() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txSupports"); + getLog().debug(N+" txSupports() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txSupports"); } private void txNotSupported(TxSession bean) throws Exception { - System.out.println("Starting "+N+" txNotSupported() invocations"); + getLog().debug("Starting "+N+" txNotSupported() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -248,11 +253,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" txNotSupported() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txNotSupported"); + getLog().debug(N+" txNotSupported() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/txNotSupported"); } private void requiredToSupports(TxSession bean) throws Exception { - System.out.println("Starting "+N+" requiredToSupports() invocations"); + getLog().debug("Starting "+N+" requiredToSupports() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -260,11 +265,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" requiredToSupports() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToSupports"); + getLog().debug(N+" requiredToSupports() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToSupports"); } private void requiredToMandatory(TxSession bean) throws Exception { - System.out.println("Starting "+N+" requiredToMandatory() invocations"); + getLog().debug("Starting "+N+" requiredToMandatory() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -272,11 +277,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" requiredToMandatory() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToMandatory"); + getLog().debug(N+" requiredToMandatory() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToMandatory"); } private void requiredToRequiresNew(TxSession bean) throws Exception { - System.out.println("Starting "+N+" requiredToRequiresNew() invocations"); + getLog().debug("Starting "+N+" requiredToRequiresNew() invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -284,12 +289,12 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" requiredToRequiresNew() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToRequiresNew"); + getLog().debug(N+" requiredToRequiresNew() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/requiredToRequiresNew"); } private void findByPrimaryKey(EntityPK key, EntityHome home) throws Exception { - System.out.println("Starting "+N+" findByPrimaryKey(key="+key+") invocations"); + getLog().debug("Starting "+N+" findByPrimaryKey(key="+key+") invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -297,11 +302,11 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" findByPrimaryKey() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/findByPrimaryKey"); + getLog().debug(N+" findByPrimaryKey() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/findByPrimaryKey"); } private void findByPrimaryKey(Entity2PK key, Entity2Home home) throws Exception { - System.out.println("Starting "+N+" findByPrimaryKey(key="+key+") invocations"); + getLog().debug("Starting "+N+" findByPrimaryKey(key="+key+") invocations"); long start = System.currentTimeMillis(); for(int n = 0; n < N; n ++) { @@ -309,7 +314,7 @@ } long end = System.currentTimeMillis(); long elapsed = end - start; - System.out.println(N+" findByPrimaryKey() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/findByPrimaryKey"); + getLog().debug(N+" findByPrimaryKey() invocations = "+elapsed+" ms, "+(elapsed / N)+" ms/findByPrimaryKey"); } public static Test suite() 1.5 +32 -21 jbosstest/src/main/org/jboss/test/perf/test/Setup.java Index: Setup.java =================================================================== RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/perf/test/Setup.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Setup.java 2001/09/12 02:10:23 1.4 +++ Setup.java 2001/09/17 17:33:53 1.5 @@ -1,3 +1,10 @@ +/* + * JBoss, the OpenSource J2EE webOS + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + package org.jboss.test.perf.test; import java.io.IOException; @@ -21,14 +28,15 @@ import org.jboss.test.perf.interfaces.Entity2Home; import org.jboss.test.util.AppCallbackHandler; -import org.jboss.test.util.Deploy; +//import org.jboss.test.util.Deploy; +import org.jboss.test.JBossTestSetup; /** Setup utility class. @author [EMAIL PROTECTED] - @version $Revision: 1.4 $ + @version $Revision: 1.5 $ */ -public class Setup extends TestSetup +public class Setup extends JBossTestSetup { LoginContext lc = null; String filename; @@ -43,64 +51,65 @@ protected void setUp() throws Exception { - System.out.println("+++ Performing the TestSuite setup"); + super.setUp(); + getLog().debug("+++ Performing the TestSuite setup"); if( isSecure ) + { login(); - Deploy.deploy(filename); + } + deployJ2ee(filename); createEntityBeans(1000); createEntity2Beans(1000); } protected void tearDown() throws Exception { - System.out.println("+++ Performing the TestSuite tear down"); + getLog().debug("+++ Performing the TestSuite tear down"); removeEntityBeans(1000); removeEntity2Beans(1000); - Deploy.undeploy(filename); + undeployJ2ee(filename); if( isSecure ) + { logout(); + } } private void createEntityBeans(int max) throws Exception { - InitialContext jndiContext = new InitialContext(); String jndiName = isSecure ? "secure/perf/Entity" : "Entity"; - Object obj = jndiContext.lookup(jndiName); + Object obj = getInitialContext().lookup(jndiName); obj = PortableRemoteObject.narrow(obj, EntityHome.class); EntityHome home = (EntityHome) obj; - System.out.println("Creating "+max+" Entity beans"); + getLog().debug("Creating "+max+" Entity beans"); for(int n = 0; n < max; n ++) home.create(n, n); } private void removeEntityBeans(int max) throws Exception { - InitialContext jndiContext = new InitialContext(); String jndiName = isSecure ? "secure/perf/Entity" : "Entity"; - Object obj = jndiContext.lookup(jndiName); + Object obj = getInitialContext().lookup(jndiName); obj = PortableRemoteObject.narrow(obj, EntityHome.class); EntityHome home = (EntityHome) obj; - System.out.println("Removing "+max+" Entity beans"); + getLog().debug("Removing "+max+" Entity beans"); for(int n = 0; n < max; n ++) home.remove(new EntityPK(n)); } private void createEntity2Beans(int max) throws Exception { - InitialContext jndiContext = new InitialContext(); String jndiName = isSecure ? "secure/perf/Entity2" : "Entity2"; - Object obj = jndiContext.lookup(jndiName); + Object obj = getInitialContext().lookup(jndiName); obj = PortableRemoteObject.narrow(obj, Entity2Home.class); Entity2Home home = (Entity2Home) obj; - System.out.println("Creating "+max+" Entity2 beans"); + getLog().debug("Creating "+max+" Entity2 beans"); for(int n = 0; n < max; n ++) home.create(n, "String"+n, new Double(n), n); } private void removeEntity2Beans(int max) throws Exception { - InitialContext jndiContext = new InitialContext(); String jndiName = isSecure ? "secure/perf/Entity2" : "Entity2"; - Object obj = jndiContext.lookup(jndiName); + Object obj = getInitialContext().lookup(jndiName); obj = PortableRemoteObject.narrow(obj, Entity2Home.class); Entity2Home home = (Entity2Home) obj; - System.out.println("Removing "+max+" Entity2 beans"); + getLog().debug("Removing "+max+" Entity2 beans"); for(int n = 0; n < max; n ++) home.remove(new Entity2PK(n, "String"+n, new Double(n))); } @@ -123,11 +132,12 @@ String username = "jduke"; char[] password = "theduke".toCharArray(); AppCallbackHandler handler = new AppCallbackHandler(username, password); - System.out.println("Creating LoginContext(other)"); + getLog().debug("Creating LoginContext(other)"); lc = new LoginContext("spec-test", handler); lc.login(); - System.out.println("Created LoginContext, subject="+lc.getSubject()); + getLog().debug("Created LoginContext, subject="+lc.getSubject()); } + private void logout() { try @@ -136,6 +146,7 @@ } catch(Exception e) { + getLog().error("logout error: ", e); } } } _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development