01: /*
02: * JBoss, Home of Professional Open Source
03: * Copyright 2005, JBoss Inc., and individual contributors as indicated
04: * by the @authors tag. See the copyright.txt in the distribution for a
05: * full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * 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.cmp2.jbas3717;
23:
24: import javax.naming.InitialContext;
25: import javax.naming.NamingException;
26: import org.jboss.test.JBossTestCase;
27: import org.jboss.test.util.ejb.EJBTestCase;
28: import junit.framework.Test;
29:
30: /**
31: * @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
32: * @version <tt>$Revision: 44174 $</tt>
33: */
34: public class JBAS3717UnitTestCase extends EJBTestCase {
35: public static Test suite() throws Exception {
36: return JBossTestCase.getDeploySetup(JBAS3717UnitTestCase.class,
37: "cmp2-jbas3717.ear");
38: }
39:
40: public JBAS3717UnitTestCase(String methodName) {
41: super (methodName);
42: }
43:
44: protected void setUp() throws Exception {
45: getALocalHome().create(new Long(1));
46: }
47:
48: protected void tearDown() throws Exception {
49: getALocalHome().remove(new Long(1));
50: }
51:
52: // Tests
53:
54: public void testJBAS3541() throws Throwable {
55: getALocalHome().findByPrimaryKey(new Long(1));
56: }
57:
58: // Private
59:
60: private ALocalHome getALocalHome() throws NamingException {
61: return (ALocalHome) lookup("ALocal");
62: }
63:
64: private Object lookup(String name) throws NamingException {
65: InitialContext ic = new InitialContext();
66: return ic.lookup(name);
67: }
68: }
|