01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a 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.ejb3.test.reference21_30.unit;
23:
24: import javax.naming.*;
25:
26: import org.jboss.ejb3.test.reference21_30.*;
27: import org.jboss.logging.Logger;
28:
29: import javax.ejb.EJBException;
30:
31: import junit.framework.Test;
32:
33: import org.jboss.security.SecurityAssociation;
34: import org.jboss.security.SimplePrincipal;
35: import org.jboss.test.JBossTestCase;
36:
37: /**
38: * Test for EJB3.0/EJB2.1 references
39: *
40: * @version <tt>$Revision: 61034 $</tt>
41: * @author <a href="mailto:bdecoste@jboss.com">William DeCoste</a>
42: */
43: public class GlobalReferenceTestCase extends JBossTestCase {
44:
45: private static final Logger log = Logger
46: .getLogger(GlobalReferenceTestCase.class);
47:
48: public GlobalReferenceTestCase(String name) {
49: super (name);
50: }
51:
52: public void testSession21() throws Exception {
53: InitialContext jndiContext = new InitialContext();
54:
55: Session21Home home = (Session21Home) jndiContext
56: .lookup("Session21Remote");
57: Session21 session = (Session21) home.create();
58: String access = session.access();
59: assertEquals("Session21", access);
60: access = session.globalAccess30();
61: assertEquals("Session30", access);
62: }
63:
64: public void testSession30() throws Exception {
65: InitialContext jndiContext = new InitialContext();
66:
67: Session30 session = (Session30) jndiContext
68: .lookup("GlobalSession30Remote");
69: String access = session.access();
70: assertEquals("Session30", access);
71: access = session.globalAccess21();
72: assertEquals("Session21", access);
73: }
74:
75: protected void setUp() throws Exception {
76: }
77:
78: public static Test suite() throws Exception {
79: // return new TestSuite(BankDeploymentDescriptorTestCase.class);
80: return getDeploySetup(GlobalReferenceTestCase.class,
81: "globalReference-ejb3.jar,globalReference.jar");
82: }
83:
84: }
|