KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > naming > ejb > NamingTests


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.naming.ejb;
23
24 import javax.ejb.DuplicateKeyException JavaDoc;
25 import javax.naming.InitialContext JavaDoc;
26
27 import org.jboss.test.util.ejb.EJBTestCase;
28 import org.jboss.test.JBossTestCase;
29 import org.jboss.test.naming.interfaces.TestENCHome;
30 import org.jboss.test.naming.interfaces.TestENC;
31 import org.jboss.test.cts.interfaces.CtsCmpLocalHome;
32 import org.jboss.test.cts.interfaces.CtsCmpLocal;
33 import org.jboss.test.cts.keys.AccountPK;
34 import org.jboss.test.cts.ejb.LocalEjbTests;
35 import org.jboss.logging.Logger;
36 import junit.framework.Test;
37
38 /** Tests of JNDI ENC performance. The following properties are used:
39  *
40  * <ul>
41  * <li>ejbRunnerJndiName, the JNDI name of the EJBTestRunning. Defaults
42  * to EJBTestRunnerHome
43  * </li>
44  * <li>encBeanJndiName, the JNDI name of the ENCBean. Defaults to ENCBean.
45  * </li>
46  * </ul>
47  * @author Scott.Stark@jboss.org
48  * @version $Revision: 37406 $
49  */

50 public class NamingTests extends EJBTestCase
51 {
52    Logger log = Logger.getLogger(NamingTests.class);
53
54    public NamingTests(String JavaDoc methodName)
55    {
56       super(methodName);
57    }
58
59    public String JavaDoc getEJBRunnerJndiName()
60    {
61       String JavaDoc jndiName = "EJBTestRunnerHome";
62       if( props != null )
63          jndiName = props.getProperty("ejbRunnerJndiName", "EJBTestRunnerHome");
64       return jndiName;
65    }
66
67    public void testENCPerf() throws Exception JavaDoc
68    {
69       InitialContext JavaDoc ctx = new InitialContext JavaDoc();
70       String JavaDoc name = "ENCBean";
71       if( props != null )
72          name = props.getProperty("encBeanJndiName", "ENCBean");
73       TestENCHome home = (TestENCHome) ctx.lookup(name);
74       TestENC bean = home.create();
75       int iterations = Integer.getInteger("encIterations", 1000).intValue();
76       long time = bean.stressENC(iterations);
77       log.info("testENCPerf, time="+time);
78       bean.remove();
79    }
80 }
81
Popular Tags