diff --git a/ejb3/build-test.xml b/ejb3/build-test.xml index 4275083..73b831e 100644 --- a/ejb3/build-test.xml +++ b/ejb3/build-test.xml @@ -2123,6 +2123,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -3857,6 +3880,7 @@ ejbthree1239, ejbthree1504, jbpapp584, + jbpapp933, jbpapp999, jbpapp1186, jbpapp1224, @@ -4496,6 +4520,9 @@ + + + diff --git a/ejb3/src/resources/test/jbpapp933/ear/application.xml b/ejb3/src/resources/test/jbpapp933/ear/application.xml new file mode 100644 index 0000000..222578c --- /dev/null +++ b/ejb3/src/resources/test/jbpapp933/ear/application.xml @@ -0,0 +1,16 @@ + + + + JBPAPP-933 + + + jbpapp933-ejb3.jar + + + + jbpapp933-ejb2.jar + + diff --git a/ejb3/src/resources/test/jbpapp933/ear/jboss-app.xml b/ejb3/src/resources/test/jbpapp933/ear/jboss-app.xml new file mode 100644 index 0000000..461b3cc --- /dev/null +++ b/ejb3/src/resources/test/jbpapp933/ear/jboss-app.xml @@ -0,0 +1,3 @@ + + strict + \ No newline at end of file diff --git a/ejb3/src/resources/test/jbpapp933/ejb2/ejb-jar.xml b/ejb3/src/resources/test/jbpapp933/ejb2/ejb-jar.xml new file mode 100644 index 0000000..c8caf1b --- /dev/null +++ b/ejb3/src/resources/test/jbpapp933/ejb2/ejb-jar.xml @@ -0,0 +1,55 @@ + + + + + + + SLSB2.1 + SLSB2.1 + + SLSB21TestEJB + + org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestHome + org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21Test + org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestEJB + Stateless + Container + + + Description + java.lang.String + number 1 + + + DefaultDS + javax.sql.DataSource + Container + + + + + SLSB2.1.2 + SLSB2.1.2 + + SLSB21Test2EJB + + org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestHome + org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21Test + org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestEJB + Stateless + Container + + + + Description + java.lang.String + number 2 + + + DefaultDS + javax.sql.DataSource + Container + + + + diff --git a/ejb3/src/resources/test/jbpapp933/ejb2/jboss.xml b/ejb3/src/resources/test/jbpapp933/ejb2/jboss.xml new file mode 100644 index 0000000..eb1d3f9 --- /dev/null +++ b/ejb3/src/resources/test/jbpapp933/ejb2/jboss.xml @@ -0,0 +1,22 @@ + + + + + + SLSB21Test2EJB + SLSB21Test2 + + DefaultDS + java:/DefaultDS + + + + SLSB21TestEJB + SLSB21Test + + DefaultDS + java:/DefaultDS + + + + \ No newline at end of file diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test.java new file mode 100644 index 0000000..28e712b --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test.java @@ -0,0 +1,35 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.ejb2; + +import java.rmi.RemoteException; + +import javax.ejb.EJBObject; + +/** + * @author David Stephan + * @version $Revision: $ + */ +public interface SLSB21Test extends EJBObject +{ + String getDescription() throws RemoteException; +} diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2.java new file mode 100644 index 0000000..c69fce0 --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2.java @@ -0,0 +1,32 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.ejb2; + +import javax.ejb.EJBObject; + +/** + * @author David Stephan + * @version $Revision: $ + */ +public interface SLSB21Test2 extends EJBObject +{ +} diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2EJB.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2EJB.java new file mode 100644 index 0000000..9468945 --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2EJB.java @@ -0,0 +1,67 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.ejb2; + +import java.rmi.RemoteException; + +import javax.ejb.CreateException; +import javax.ejb.EJBException; +import javax.ejb.SessionBean; +import javax.ejb.SessionContext; + +/** + * @author David Stephan + * @version $Revision: $ + */ +public class SLSB21Test2EJB implements SessionBean +{ + private static final long serialVersionUID = 1L; + + public void ejbCreate() throws CreateException + { + + } + + public void ejbActivate() throws EJBException, RemoteException + { + // TODO Auto-generated method stub + + } + + public void ejbPassivate() throws EJBException, RemoteException + { + // TODO Auto-generated method stub + + } + + public void ejbRemove() throws EJBException, RemoteException + { + // TODO Auto-generated method stub + + } + + public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException + { + // TODO Auto-generated method stub + + } +} \ No newline at end of file diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2Home.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2Home.java new file mode 100644 index 0000000..803d8d7 --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2Home.java @@ -0,0 +1,40 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.ejb2; + +import java.rmi.RemoteException; + +import javax.ejb.CreateException; +import javax.ejb.EJBHome; + +/** + * @author David Stephan + * @version $Revision: $ + */ +public interface SLSB21Test2Home extends EJBHome +{ + public static final String COMP_NAME = "java:comp/env/ejb/SLSB21Test2"; + public static final String JNDI_NAME = "SLSB21Test2EJB"; + + public SLSB21Test2 create() throws CreateException, RemoteException; + +} diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestEJB.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestEJB.java new file mode 100644 index 0000000..b588597 --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestEJB.java @@ -0,0 +1,73 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.ejb2; + +import java.rmi.RemoteException; + +import javax.ejb.CreateException; +import javax.ejb.EJBException; +import javax.ejb.SessionBean; +import javax.ejb.SessionContext; + +/** + * @author David Stephan + * @version $Revision: $ + */ +public class SLSB21TestEJB implements SessionBean +{ + private static final long serialVersionUID = 1L; + + private SessionContext ctx; + + public void ejbCreate() throws CreateException + { + + } + + public void ejbActivate() throws EJBException, RemoteException + { + // TODO Auto-generated method stub + + } + + public void ejbPassivate() throws EJBException, RemoteException + { + // TODO Auto-generated method stub + + } + + public void ejbRemove() throws EJBException, RemoteException + { + // TODO Auto-generated method stub + + } + + public String getDescription() throws RemoteException + { + return (String) ctx.lookup("java:comp/env/Description"); + } + + public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException + { + this.ctx = ctx; + } +} \ No newline at end of file diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestHome.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestHome.java new file mode 100644 index 0000000..5aa3b6e --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestHome.java @@ -0,0 +1,40 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.ejb2; + +import java.rmi.RemoteException; + +import javax.ejb.CreateException; +import javax.ejb.EJBHome; + +/** + * @author David Stephan + * @version $Revision: $ + */ +public interface SLSB21TestHome extends EJBHome +{ + public static final String COMP_NAME = "java:comp/env/ejb/SLSB21Test"; + public static final String JNDI_NAME = "SLSB21TestEJB"; + + public SLSB21Test create() throws CreateException, RemoteException; + +} diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceBean.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceBean.java new file mode 100644 index 0000000..7de696f --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceBean.java @@ -0,0 +1,49 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.ejb3; + +import javax.naming.InitialContext; + +import org.jboss.annotation.ejb.Management; +import org.jboss.annotation.ejb.Service; + +/** + * @author Carlo de Wolf + * @version $Revision: $ + */ +@Service +@Management(TestServiceMBean.class) +public class TestServiceBean implements TestServiceMBean, TestServiceRemote +{ + private boolean started = false; + + public void start() throws Exception + { + new InitialContext().lookup("java:comp/env"); + started = true; + } + + public boolean hasStarted() + { + return started; + } +} diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceMBean.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceMBean.java new file mode 100644 index 0000000..5c468c0 --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceMBean.java @@ -0,0 +1,31 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.ejb3; + +/** + * @author Carlo de Wolf + * @version $Revision: $ + */ +public interface TestServiceMBean +{ + void start() throws Exception; +} diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceRemote.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceRemote.java new file mode 100644 index 0000000..9c86777 --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceRemote.java @@ -0,0 +1,34 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.ejb3; + +import javax.ejb.Remote; + +/** + * @author Carlo de Wolf + * @version $Revision: $ + */ +@Remote +public interface TestServiceRemote +{ + boolean hasStarted(); +} diff --git a/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/unit/JavaENCUnitTestCase.java b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/unit/JavaENCUnitTestCase.java new file mode 100644 index 0000000..f29fe6b --- /dev/null +++ b/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/unit/JavaENCUnitTestCase.java @@ -0,0 +1,90 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, 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.test.jbpapp933.unit; + +import javax.naming.NameNotFoundException; + +import junit.framework.Test; + +import org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21Test; +import org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestHome; +import org.jboss.ejb3.test.jbpapp933.ejb3.TestServiceRemote; +import org.jboss.test.JBossTestCase; + +/** + * @author Carlo de Wolf + * @version $Revision: $ + */ +public class JavaENCUnitTestCase extends JBossTestCase +{ + /** + * @param name + */ + public JavaENCUnitTestCase(String name) + { + super(name); + } + + /** + * java:comp/env/SLSB21TestEJB has been bound to different entries, let's see. + */ + public void testOverlap1() throws Exception + { + SLSB21TestHome home = (SLSB21TestHome) getInitialContext().lookup("SLSB21Test"); + SLSB21Test bean = home.create(); + String actual = bean.getDescription(); + assertEquals("number 1", actual); + } + + public void testOverlap2() throws Exception + { + try + { + SLSB21TestHome home = (SLSB21TestHome) getInitialContext().lookup("SLSB21Test2"); + SLSB21Test bean = home.create(); + String actual = bean.getDescription(); + assertEquals("number 2", actual); + } + catch(NameNotFoundException e) + { + // if we can't find SLSB21Test2 then the test has failed, + // because the most likely cause is java:comp/env already bound. + fail(e.getMessage()); + } + } + + public void testService() throws Exception + { + TestServiceRemote bean = (TestServiceRemote) getInitialContext().lookup("jbpapp933/TestServiceBean/remote"); + assertTrue(bean.hasStarted()); + } + + public void testServerFound() throws Exception + { + serverFound(); + } + + public static Test suite() throws Exception + { + return getDeploySetup(JavaENCUnitTestCase.class, "jbpapp933.ear"); + } +}