[jboss-cvs] JBossAS SVN: r67210 - in trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext: unit and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 16 17:32:41 EST 2007
Author: ALRubinger
Date: 2007-11-16 17:32:41 -0500 (Fri, 16 Nov 2007)
New Revision: 67210
Added:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessBusinessRemote.java
Removed:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/Stateless.java
Modified:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/Stateful.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocal.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessLocal.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessRemote.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java
Log:
[EJBTHREE-1121] Resolved JNDI Naming conflicts preventing test JAR from deployment, exposed root of failures
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/Stateful.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/Stateful.java 2007-11-16 22:30:32 UTC (rev 67209)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/Stateful.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -36,6 +36,8 @@
@Remote
public interface Stateful extends Base
{
+ String JNDI_NAME = "Stateful/remote";
+
public void testEjbContext() throws Exception;
public void test();
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulBean.java 2007-11-16 22:30:32 UTC (rev 67209)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulBean.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -49,14 +49,16 @@
@RemoteHome(StatefulRemoteHome.class)
@Remote({org.jboss.ejb3.test.ejbcontext.Stateful.class, StatefulRemoteBusiness.class,StatefulRemote.class})
@Local(StatefulLocal.class)
- at LocalBinding(jndiBinding="StatefulLocal")
- at RemoteBindings({@RemoteBinding(jndiBinding = "Stateful"), @RemoteBinding(jndiBinding = "StatefulRemote")})
+ at LocalBinding(jndiBinding = StatefulLocal.JNDI_NAME)
+ at RemoteBindings(
+{@RemoteBinding(jndiBinding = StatefulRemoteBusiness.JNDI_NAME),
+ @RemoteBinding(jndiBinding = org.jboss.ejb3.test.ejbcontext.Stateful.JNDI_NAME)})
public class StatefulBean extends BaseBean
implements org.jboss.ejb3.test.ejbcontext.Stateful, StatefulRemoteBusiness
{
private static final Logger log = Logger.getLogger(StatefulBean.class);
- @EJB(mappedName="StatefulRemote")
+ @EJB(mappedName=StatefulRemoteBusiness.JNDI_NAME)
StatefulRemoteBusiness statefulRemote = null;
@EJB StatefulLocalOnly statefulLocalOnly;
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocal.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocal.java 2007-11-16 22:30:32 UTC (rev 67209)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocal.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -29,6 +29,8 @@
*/
public interface StatefulLocal extends EJBLocalObject
{
+ String JNDI_NAME = "StatefulBean/local";
+
String getState();
void setState(String state);
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness.java 2007-11-16 22:30:32 UTC (rev 67209)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -33,6 +33,8 @@
@Remote
public interface StatefulRemoteBusiness
{
+ String JNDI_NAME = "StatefulBean/remote";
+
public Class testInvokedBusinessInterface2() throws Exception;
Object testLocalOnlyGetBusinessObject() throws Exception;
Deleted: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/Stateless.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/Stateless.java 2007-11-16 22:30:32 UTC (rev 67209)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/Stateless.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.ejbcontext;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public interface Stateless extends Base
-{
- public void testEjbContextLookup() throws Exception;
-
- public Class testInvokedBusinessInterface() throws Exception;
-
- public void testEjbObject() throws Exception;
-
- public void testEjbLocalObject() throws Exception;
-
- public void noop();
-
- void testSessionContext() throws Exception;
-}
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessBean.java 2007-11-16 22:30:32 UTC (rev 67209)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessBean.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -35,6 +35,7 @@
import org.jboss.annotation.ejb.LocalBinding;
import org.jboss.annotation.ejb.RemoteBinding;
+import org.jboss.annotation.ejb.RemoteBindings;
import org.jboss.logging.Logger;
@@ -48,11 +49,13 @@
@LocalHome(StatelessLocalHome.class)
@RemoteHome(StatelessRemoteHome.class)
@Local({StatelessLocalBusiness.class,StatelessLocal.class})
- at Remote({org.jboss.ejb3.test.ejbcontext.Stateless.class,StatelessRemote.class})
- at LocalBinding(jndiBinding = "StatelessLocal")
- at RemoteBinding(jndiBinding = "Stateless")
+ at Remote({StatelessBusinessRemote.class,StatelessRemote.class})
+ at LocalBinding(jndiBinding = StatelessLocal.JNDI_NAME)
+ at RemoteBindings({
+ at RemoteBinding(jndiBinding = StatelessRemote.JNDI_NAME),
+ at RemoteBinding(jndiBinding = StatelessBusinessRemote.JNDI_NAME)})
public class StatelessBean extends BaseBean
- implements org.jboss.ejb3.test.ejbcontext.Stateless, StatelessLocalBusiness
+ implements org.jboss.ejb3.test.ejbcontext.StatelessBusinessRemote, StatelessLocalBusiness
{
@SuppressWarnings("unused")
private static final Logger log = Logger.getLogger(StatelessBean.class);
@@ -61,7 +64,7 @@
SessionContext sessionContext;
StatelessLocalBusiness ejbLocalObject;
- org.jboss.ejb3.test.ejbcontext.Stateless ejbObject;
+ org.jboss.ejb3.test.ejbcontext.StatelessBusinessRemote ejbObject;
public void noop()
{
@@ -70,7 +73,7 @@
public void testEjbContextLookup() throws Exception
{
- Stateful stateful = (Stateful)sessionContext.lookup("Stateful");
+ Stateful stateful = (Stateful)sessionContext.lookup(Stateful.JNDI_NAME);
stateful.test();
}
@@ -94,7 +97,7 @@
public void testSessionContext() throws Exception
{
InitialContext jndiContext = new InitialContext();
- Stateful stateful = (Stateful)jndiContext.lookup("Stateful");
+ Stateful stateful = (Stateful)jndiContext.lookup(Stateful.JNDI_NAME);
stateful.setState("testSessionContext");
EJBLocalObject ejbLocalObject = stateful.getEJBLocalObject();
@@ -119,7 +122,7 @@
public void postConstruct()
{
ejbLocalObject = (StatelessLocalBusiness)sessionContext.getEJBLocalObject();
- ejbObject = (org.jboss.ejb3.test.ejbcontext.Stateless)sessionContext.getEJBObject();
+ ejbObject = (org.jboss.ejb3.test.ejbcontext.StatelessBusinessRemote)sessionContext.getEJBObject();
}
}
Copied: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessBusinessRemote.java (from rev 67199, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/Stateless.java)
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessBusinessRemote.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessBusinessRemote.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejbcontext;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision$
+ */
+public interface StatelessBusinessRemote extends Base
+{
+ String JNDI_NAME = "Stateless/remote";
+
+ public void testEjbContextLookup() throws Exception;
+
+ public Class<?> testInvokedBusinessInterface() throws Exception;
+
+ public void testEjbObject() throws Exception;
+
+ public void testEjbLocalObject() throws Exception;
+
+ public void noop();
+
+ void testSessionContext() throws Exception;
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessBusinessRemote.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessLocal.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessLocal.java 2007-11-16 22:30:32 UTC (rev 67209)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessLocal.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -10,5 +10,5 @@
public interface StatelessLocal extends EJBLocalObject
{
-
+ String JNDI_NAME = "Stateless/local";
}
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessRemote.java 2007-11-16 22:30:32 UTC (rev 67209)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatelessRemote.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -17,5 +17,7 @@
*/
public interface StatelessRemote extends EJBObject
{
-
+ String JNDI_NAME = "Stateless/remote";
+
+ public Class<?> testInvokedBusinessInterface() throws Exception;
}
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java 2007-11-16 22:30:32 UTC (rev 67209)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java 2007-11-16 22:32:41 UTC (rev 67210)
@@ -23,21 +23,22 @@
import javax.ejb.EJBException;
+import junit.framework.Test;
+
import org.jboss.ejb3.test.ejbcontext.Stateful;
import org.jboss.ejb3.test.ejbcontext.StatefulRemoteBusiness;
-import org.jboss.ejb3.test.ejbcontext.Stateless;
+import org.jboss.ejb3.test.ejbcontext.StatelessBusinessRemote;
+import org.jboss.ejb3.test.ejbcontext.StatelessRemote;
import org.jboss.logging.Logger;
import org.jboss.test.JBossTestCase;
-import junit.framework.Test;
/**
* Comment
*
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>StatelessBusinessRemote
* @version $Revision$
*/
-public class EjbContextUnitTestCase
-extends JBossTestCase
+public class EjbContextUnitTestCase extends JBossTestCase
{
private static final Logger log = Logger.getLogger(EjbContextUnitTestCase.class);
@@ -45,28 +46,30 @@
{
super(name);
}
-
+
public void testEjbContextJndi() throws Exception
{
- Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
- stateful.testEjbContext();
+ Stateful stateful = (Stateful) getInitialContext().lookup(Stateful.JNDI_NAME);
+ stateful.testEjbContext();
}
-
+
public void testEjbContextLookup() throws Exception
{
- Stateless stateless = (Stateless)getInitialContext().lookup("Stateless");
- stateless.testEjbContextLookup();
+ StatelessBusinessRemote stateless = (StatelessBusinessRemote) getInitialContext().lookup(
+ StatelessBusinessRemote.JNDI_NAME);
+ stateless.testEjbContextLookup();
}
-
+
public void testSessionContext() throws Exception
{
- Stateless stateless = (Stateless)getInitialContext().lookup("Stateless");
+ StatelessBusinessRemote stateless = (StatelessBusinessRemote) getInitialContext().lookup(
+ StatelessBusinessRemote.JNDI_NAME);
stateless.testSessionContext();
}
-
+
public void testConcurrentInvokedBusinessInterface() throws Exception
- {
- for (int i = 0 ; i < 100 ; ++i)
+ {
+ for (int i = 0; i < 100; ++i)
{
Runnable r = new Runnable()
{
@@ -74,32 +77,37 @@
{
try
{
- Stateless stateless1 = (Stateless)getInitialContext().lookup("Stateless");
- Stateless stateless2 = (Stateless)getInitialContext().lookup("Stateless");
-
+ StatelessBusinessRemote stateless1 = (StatelessBusinessRemote) getInitialContext().lookup(
+ StatelessBusinessRemote.JNDI_NAME);
+ StatelessBusinessRemote stateless2 = (StatelessBusinessRemote) getInitialContext().lookup(
+ StatelessBusinessRemote.JNDI_NAME);
+
Class interfc = stateless1.testInvokedBusinessInterface();
- assertEquals(interfc, Stateless.class);
-
+ assertEquals(interfc, StatelessBusinessRemote.class);
+
interfc = stateless2.testInvokedBusinessInterface();
- assertEquals(interfc, Stateless.class);
-
- Stateless stateless = (Stateless)stateless1.testBusinessObject(Stateless.class);
+ assertEquals(interfc, StatelessBusinessRemote.class);
+
+ StatelessBusinessRemote stateless = (StatelessBusinessRemote) stateless1
+ .testBusinessObject(StatelessBusinessRemote.class);
stateless.noop();
-
- assertEquals(interfc, Stateless.class);
-
- try{
+
+ assertEquals(interfc, StatelessBusinessRemote.class);
+
+ try
+ {
stateless1.testBusinessObject(Stateful.class);
fail("IllegalStateException not thrown");
}
catch (javax.ejb.EJBException e)
{
- if (!(e.getCause() instanceof IllegalStateException)) throw e;
+ if (!(e.getCause() instanceof IllegalStateException))
+ throw e;
assertEquals(IllegalStateException.class, e.getCause().getClass());
}
-
+
stateless1.testEjbObject();
-
+
stateless1.testEjbLocalObject();
}
catch (Exception e)
@@ -109,102 +117,108 @@
}
}
};
-
+
new Thread(r).start();
}
-
+
Thread.sleep(5 * 1000);
}
-
+
public void testStatelessInvokedBusinessInterface() throws Exception
{
- Stateless stateless1 = (Stateless)getInitialContext().lookup("Stateless");
- Stateless stateless2 = (Stateless)getInitialContext().lookup("Stateless");
-
- Class interfc = stateless1.testInvokedBusinessInterface();
- assertEquals(interfc, Stateless.class);
-
+ StatelessBusinessRemote stateless1 = (StatelessBusinessRemote) getInitialContext().lookup(
+ StatelessBusinessRemote.JNDI_NAME);
+ StatelessRemote stateless2 = (StatelessRemote) getInitialContext().lookup(StatelessRemote.JNDI_NAME);
+
+ Class<?> interfc = stateless1.testInvokedBusinessInterface();
+ assertEquals(interfc, StatelessBusinessRemote.class);
+
interfc = stateless2.testInvokedBusinessInterface();
- assertEquals(interfc, Stateless.class);
-
- Stateless stateless = (Stateless)stateless1.testBusinessObject(Stateless.class);
+ assertEquals(interfc, StatelessRemote.class);
+
+ StatelessBusinessRemote stateless = (StatelessBusinessRemote) stateless1
+ .testBusinessObject(StatelessBusinessRemote.class);
stateless.noop();
- assertEquals(interfc, Stateless.class);
-
- try{
+ assertEquals(interfc, StatelessBusinessRemote.class);
+
+ try
+ {
stateless1.testBusinessObject(Stateful.class);
fail("IllegalStateException not thrown");
}
catch (javax.ejb.EJBException e)
{
- if (!(e.getCause() instanceof IllegalStateException)) throw e;
+ if (!(e.getCause() instanceof IllegalStateException))
+ throw e;
assertEquals(IllegalStateException.class, e.getCause().getClass());
}
-
+
stateless1.testEjbObject();
-
+
stateless1.testEjbLocalObject();
}
-
+
public void testStatefulInvokedBusinessInterface() throws Exception
{
- Stateful stateful1 = (Stateful)getInitialContext().lookup("Stateful");
- StatefulRemoteBusiness stateful2 = (StatefulRemoteBusiness)getInitialContext().lookup("StatefulRemote");
-
+ Stateful stateful1 = (Stateful) getInitialContext().lookup(Stateful.JNDI_NAME);
+ StatefulRemoteBusiness stateful2 = (StatefulRemoteBusiness) getInitialContext().lookup(
+ StatefulRemoteBusiness.JNDI_NAME);
+
Class interfc = stateful1.testInvokedBusinessInterface();
assertEquals(interfc, Stateful.class);
-
+
interfc = stateful2.testInvokedBusinessInterface2();
assertEquals(interfc, StatefulRemoteBusiness.class);
-
+
interfc = stateful1.testLocalInvokedBusinessInterface();
assertEquals(interfc, StatefulRemoteBusiness.class);
-
+
stateful1.setState("same");
- Stateful stateful3 = (Stateful)stateful1.getBusinessObject();
+ Stateful stateful3 = (Stateful) stateful1.getBusinessObject();
assertEquals("same", stateful3.getState());
-
}
public void testGetBusinessObjectNullStateful() throws Exception
{
- Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
+ Stateful stateful = (Stateful) getInitialContext().lookup(Stateful.JNDI_NAME);
try
{
stateful.testBusinessObject(null);
fail("Expected an EJBException");
}
- catch(EJBException e)
+ catch (EJBException e)
{
assertNotNull(e.getCause());
assertEquals(e.getCause().getClass(), IllegalStateException.class);
}
}
-
+
public void testGetBusinessObjectNullStateless() throws Exception
{
- Stateless stateless = (Stateless)getInitialContext().lookup("Stateless");
+ StatelessBusinessRemote stateless = (StatelessBusinessRemote) getInitialContext().lookup(
+ StatelessBusinessRemote.JNDI_NAME);
try
{
stateless.testBusinessObject(null);
fail("Expected an EJBException");
}
- catch(EJBException e)
+ catch (EJBException e)
{
assertNotNull(e.getCause());
assertEquals(e.getCause().getClass(), IllegalStateException.class);
}
}
-
+
public void testLocalOnlyGetBusinessObject() throws Exception
{
- StatefulRemoteBusiness sfsb = (StatefulRemoteBusiness)getInitialContext().lookup("StatefulRemote");
- Object o = sfsb.testLocalOnlyGetBusinessObject();
- assertNotNull(o);
+ StatefulRemoteBusiness sfsb = (StatefulRemoteBusiness) getInitialContext().lookup(
+ StatefulRemoteBusiness.JNDI_NAME);
+ Object o = sfsb.testLocalOnlyGetBusinessObject();
+ assertNotNull(o);
}
-
+
public static Test suite() throws Exception
{
return getDeploySetup(EjbContextUnitTestCase.class, "ejbcontext.jar");
More information about the jboss-cvs-commits
mailing list