Index: src/test/java/org/jboss/ejb3/core/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java =================================================================== --- src/test/java/org/jboss/ejb3/core/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java (revision 0) +++ src/test/java/org/jboss/ejb3/core/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java (revision 0) @@ -0,0 +1,130 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2008, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2008, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ejb3.core.test.ejbthree1060.unit; + +import javax.naming.Context; +import javax.naming.InitialContext; + +import junit.framework.TestCase; + +import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase; +import org.jboss.ejb3.core.test.ejbthree1060.BusinessInterface1; +import org.jboss.ejb3.core.test.ejbthree1060.BusinessInterface2; +import org.jboss.ejb3.core.test.ejbthree1060.InvokedBusinessInterfaceBean; +import org.jboss.ejb3.stateless.StatelessContainer; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * InvokedBusinessInterfaceUnitTestCase + * + * Test Cases to validate SessionContext.getInvokedBusinessInterface + * + * @author ALR + * @version $Revision: $ + */ +public class InvokedBusinessInterfaceUnitTestCase extends AbstractEJB3TestCase +{ + // --------------------------------------------------------------------------------|| + // Class Members ------------------------------------------------------------------|| + // --------------------------------------------------------------------------------|| + + private static StatelessContainer container; + + // --------------------------------------------------------------------------------|| + // Lifecycle Methods --------------------------------------------------------------|| + // --------------------------------------------------------------------------------|| + + /** + * Tests that calls to getInvokedBusinessInterface + * succeed and return the correct business interface (as invoked). + * Defining method is declared by a common base class. + */ + @Test + public void testGetInvokedBusinessInterface() throws Throwable + { + // Define JNDI Targets for Lookup + String jndiNameBase = InvokedBusinessInterfaceBean.class.getSimpleName() + "/" + "local-"; + String jndiNameInterface1 = jndiNameBase + BusinessInterface1.class.getName(); + String jndiNameInterface2 = jndiNameBase + BusinessInterface2.class.getName(); + + // Get JNDI Context + Context context = new InitialContext(); + + // Obtain + BusinessInterface1 busiface1 = (BusinessInterface1) context.lookup(jndiNameInterface1); + BusinessInterface2 busiface2 = (BusinessInterface2) context.lookup(jndiNameInterface2); + + // Invoke getInvokedBusinessInterface + Class invoked1 = busiface1.getInvokedBusinessInterface(); + Class invoked2 = busiface2.getInvokedBusinessInterface(); + + // Test + TestCase.assertEquals(BusinessInterface1.class, invoked1); + TestCase.assertEquals(BusinessInterface2.class, invoked2); + } + + // --------------------------------------------------------------------------------|| + // Lifecycle Methods --------------------------------------------------------------|| + // --------------------------------------------------------------------------------|| + + @BeforeClass + public static void beforeClass() throws Exception + { + AbstractEJB3TestCase.beforeClass(); + + // Deploy the test SLSB + container = deploySlsb(InvokedBusinessInterfaceBean.class); + } + + @AfterClass + public static void afterClass() throws Exception + { + // Undeploy the test SLSB + undeployEjb(container); + + AbstractEJB3TestCase.afterClass(); + } + +} Index: src/test/java/org/jboss/ejb3/core/test/ejbthree1060/InvokedBusinessInterfaceBean.java =================================================================== --- src/test/java/org/jboss/ejb3/core/test/ejbthree1060/InvokedBusinessInterfaceBean.java (revision 0) +++ src/test/java/org/jboss/ejb3/core/test/ejbthree1060/InvokedBusinessInterfaceBean.java (revision 0) @@ -0,0 +1,76 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2008, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ejb3.core.test.ejbthree1060; + +import javax.annotation.Resource; +import javax.ejb.Local; +import javax.ejb.SessionContext; +import javax.ejb.Stateless; + +import org.jboss.logging.Logger; + +/** + * InvokedBusinessInterfaceBean + * + * A Simple EJB used for testing calls to obtain + * the Invoked Business interface when a common base is + * in play + * + * @author ALR + * @version $Revision: $ + */ +@Stateless +@Local( +{BusinessInterface1.class, BusinessInterface2.class}) +public class InvokedBusinessInterfaceBean implements BusinessInterface1, BusinessInterface2 +{ + + // --------------------------------------------------------------------------------|| + // Class Members ------------------------------------------------------------------|| + // --------------------------------------------------------------------------------|| + + private static final Logger log = Logger.getLogger(InvokedBusinessInterfaceBean.class); + + // --------------------------------------------------------------------------------|| + // Instance Members ---------------------------------------------------------------|| + // --------------------------------------------------------------------------------|| + + @Resource + public SessionContext context; + + // --------------------------------------------------------------------------------|| + // Required Implementations -------------------------------------------------------|| + // --------------------------------------------------------------------------------|| + + /** + * Returns the business interface invoked upon + * + * @return + */ + public Class getInvokedBusinessInterface() + { + Class invokedBusiface = context.getInvokedBusinessInterface(); + log.info("Invoked Business Interface: " + invokedBusiface); + return invokedBusiface; + } + +} Index: src/test/java/org/jboss/ejb3/core/test/ejbthree1060/CommonBusinessInterface.java =================================================================== --- src/test/java/org/jboss/ejb3/core/test/ejbthree1060/CommonBusinessInterface.java (revision 0) +++ src/test/java/org/jboss/ejb3/core/test/ejbthree1060/CommonBusinessInterface.java (revision 0) @@ -0,0 +1,42 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2008, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ejb3.core.test.ejbthree1060; + +/** + * CommonBusinessInterface + * + * A Common Business Interface to be used as a Base + * + * @author ALR + * @version $Revision: $ + */ +public interface CommonBusinessInterface +{ + + /** + * Returns the business interface invoked upon + * + * @return + */ + Class getInvokedBusinessInterface(); + +} Index: src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface1.java =================================================================== --- src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface1.java (revision 0) +++ src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface1.java (revision 0) @@ -0,0 +1,36 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2008, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ejb3.core.test.ejbthree1060; + +/** + * BusinessInterface1 + * + * A Simple Business interface extending from a + * shared base + * + * @author ALR + * @version $Revision: $ + */ +public interface BusinessInterface1 extends CommonBusinessInterface +{ + +} Index: src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface2.java =================================================================== --- src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface2.java (revision 0) +++ src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface2.java (revision 0) @@ -0,0 +1,36 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2008, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ejb3.core.test.ejbthree1060; + +/** + * BusinessInterface1 + * + * A Simple Business interface extending from a + * shared base + * + * @author ALR + * @version $Revision: $ + */ +public interface BusinessInterface2 extends CommonBusinessInterface +{ + +}