[jboss-cvs] JBossAS SVN: r82287 - in projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext: unit and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Dec 15 15:07:40 EST 2008
Author: ALRubinger
Date: 2008-12-15 15:07:40 -0500 (Mon, 15 Dec 2008)
New Revision: 82287
Added:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulLocalBusiness1.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulLocalBusiness2.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness1.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness2.java
Removed:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness.java
Modified:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/Stateful.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulBean.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatelessBean.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java
Log:
[EJBTHREE-1241] Fix "ejbcontext" tests
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/Stateful.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/Stateful.java 2008-12-15 19:06:25 UTC (rev 82286)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/Stateful.java 2008-12-15 20:07:40 UTC (rev 82287)
@@ -24,28 +24,23 @@
import javax.ejb.EJBLocalObject;
import javax.ejb.EJBObject;
-import javax.ejb.Remote;
-
/**
* Comment
*
* @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
* @version $Revision$
*/
- at Remote
public interface Stateful extends Base
-{
- String JNDI_NAME = "Stateful/remote";
-
+{
public void testEjbContext() throws Exception;
public void test();
- public Class testInvokedBusinessInterface() throws Exception;
+ public Class<?> testInvokedBusinessInterface() throws Exception;
+
+ public Class<?> testInvokedBusinessInterface2() throws Exception;
- public Class testLocalInvokedBusinessInterface() throws Exception;
-
public Object getBusinessObject() throws Exception;
String getState();
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulBean.java 2008-12-15 19:06:25 UTC (rev 82286)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulBean.java 2008-12-15 20:07:40 UTC (rev 82287)
@@ -26,10 +26,12 @@
import javax.ejb.EJBContext;
import javax.ejb.EJBLocalObject;
import javax.ejb.EJBObject;
+import javax.ejb.Local;
import javax.ejb.LocalHome;
import javax.ejb.Remote;
import javax.ejb.RemoteHome;
import javax.ejb.Stateful;
+import javax.naming.Context;
import javax.naming.InitialContext;
import org.jboss.logging.Logger;
@@ -40,12 +42,13 @@
* @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
* @version $Revision$
*/
- at Stateful(name="Stateful")
+ at Stateful
@LocalHome(StatefulLocalHome.class)
@RemoteHome(StatefulRemoteHome.class)
- at Remote({org.jboss.ejb3.test.ejbcontext.Stateful.class, StatefulRemoteBusiness.class})
+ at Local({ StatefulLocalBusiness1.class, StatefulLocalBusiness2.class})
+ at Remote({org.jboss.ejb3.test.ejbcontext.Stateful.class, StatefulRemoteBusiness1.class, StatefulRemoteBusiness2.class})
public class StatefulBean extends BaseBean
- implements org.jboss.ejb3.test.ejbcontext.Stateful, StatefulRemoteBusiness
+ implements org.jboss.ejb3.test.ejbcontext.Stateful, StatefulRemoteBusiness1, StatefulLocalBusiness1
{
private static final Logger log = Logger.getLogger(StatefulBean.class);
@@ -93,19 +96,25 @@
}
- public Class testInvokedBusinessInterface() throws Exception
+ public Class<?> testInvokedBusinessInterface() throws Exception
{
return sessionContext.getInvokedBusinessInterface();
}
- public Class testInvokedBusinessInterface2() throws Exception
+ public Class<?> testInvokedBusinessInterface2() throws Exception
{
return sessionContext.getInvokedBusinessInterface();
}
- public Class testLocalInvokedBusinessInterface() throws Exception
+ public Class<?> testLocalInvokedBusinessInterface() throws Exception
{
- return sessionContext.getBusinessObject(StatefulRemoteBusiness.class).testInvokedBusinessInterface2();
+ // Get a new session
+ Context context = new InitialContext();
+ StatefulLocalBusiness1 bean = (StatefulLocalBusiness1) context.lookup(this.getClass().getSimpleName() + "/local-"
+ + StatefulLocalBusiness1.class.getName());
+
+ // Test
+ return bean.testInvokedBusinessInterface();
}
@PostConstruct
Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulLocalBusiness1.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulLocalBusiness1.java (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulLocalBusiness1.java 2008-12-15 20:07:40 UTC (rev 82287)
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * StatefulLocalBusiness1
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface StatefulLocalBusiness1 extends Stateful
+{
+
+}
Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulLocalBusiness2.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulLocalBusiness2.java (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulLocalBusiness2.java 2008-12-15 20:07:40 UTC (rev 82287)
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * StatefulLocalBusiness2
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface StatefulLocalBusiness2 extends Stateful
+{
+
+}
Deleted: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness.java 2008-12-15 19:06:25 UTC (rev 82286)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness.java 2008-12-15 20:07:40 UTC (rev 82287)
@@ -1,41 +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;
-
-import javax.ejb.Remote;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
- at Remote
-public interface StatefulRemoteBusiness
-{
- String JNDI_NAME = "Stateful/remote";
-
- public Class testInvokedBusinessInterface2() throws Exception;
-
- Object testLocalOnlyGetBusinessObject() throws Exception;
-}
Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness1.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness1.java (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness1.java 2008-12-15 20:07:40 UTC (rev 82287)
@@ -0,0 +1,36 @@
+/*
+ * 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: 79019 $
+ */
+public interface StatefulRemoteBusiness1 extends Stateful
+{
+ Object testLocalOnlyGetBusinessObject() throws Exception;
+
+ public Class<?> testLocalInvokedBusinessInterface() throws Exception;
+}
Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness2.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness2.java (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatefulRemoteBusiness2.java 2008-12-15 20:07:40 UTC (rev 82287)
@@ -0,0 +1,36 @@
+/*
+ * 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: 79019 $
+ */
+public interface StatefulRemoteBusiness2 extends Stateful
+{
+ Object testLocalOnlyGetBusinessObject() throws Exception;
+
+ public Class<?> testLocalInvokedBusinessInterface() throws Exception;
+}
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatelessBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatelessBean.java 2008-12-15 19:06:25 UTC (rev 82286)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/StatelessBean.java 2008-12-15 20:07:40 UTC (rev 82287)
@@ -66,11 +66,11 @@
public void testEjbContextLookup() throws Exception
{
- Stateful stateful = (Stateful)sessionContext.lookup(Stateful.JNDI_NAME);
+ Stateful stateful = (Stateful) sessionContext.lookup(StatefulBean.class.getSimpleName() + "/remote");
stateful.test();
}
- public Class testInvokedBusinessInterface() throws Exception
+ public Class<?> testInvokedBusinessInterface() throws Exception
{
return sessionContext.getInvokedBusinessInterface();
}
@@ -90,7 +90,7 @@
public void testSessionContext() throws Exception
{
InitialContext jndiContext = new InitialContext();
- Stateful stateful = (Stateful)jndiContext.lookup(Stateful.JNDI_NAME);
+ Stateful stateful = (Stateful) jndiContext.lookup(StatefulBean.class.getSimpleName() + "/remote");
stateful.setState("testSessionContext");
EJBLocalObject ejbLocalObject = stateful.getEJBLocalObject();
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java 2008-12-15 19:06:25 UTC (rev 82286)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java 2008-12-15 20:07:40 UTC (rev 82287)
@@ -26,7 +26,10 @@
import junit.framework.Test;
import org.jboss.ejb3.test.ejbcontext.Stateful;
-import org.jboss.ejb3.test.ejbcontext.StatefulRemoteBusiness;
+import org.jboss.ejb3.test.ejbcontext.StatefulBean;
+import org.jboss.ejb3.test.ejbcontext.StatefulLocalBusiness1;
+import org.jboss.ejb3.test.ejbcontext.StatefulRemoteBusiness1;
+import org.jboss.ejb3.test.ejbcontext.StatefulRemoteBusiness2;
import org.jboss.ejb3.test.ejbcontext.StatelessBusinessRemote;
import org.jboss.ejb3.test.ejbcontext.StatelessRemote;
import org.jboss.ejb3.test.ejbcontext.StatelessRemoteHome;
@@ -50,7 +53,7 @@
public void testEjbContextJndi() throws Exception
{
- Stateful stateful = (Stateful) getInitialContext().lookup(Stateful.JNDI_NAME);
+ Stateful stateful = (Stateful) getInitialContext().lookup(StatefulBean.class.getSimpleName() + "/remote");
stateful.testEjbContext();
}
@@ -83,7 +86,7 @@
StatelessBusinessRemote stateless2 = (StatelessBusinessRemote) getInitialContext().lookup(
StatelessBusinessRemote.JNDI_NAME);
- Class interfc = stateless1.testInvokedBusinessInterface();
+ Class<?> interfc = stateless1.testInvokedBusinessInterface();
assertEquals(interfc, StatelessBusinessRemote.class);
interfc = stateless2.testInvokedBusinessInterface();
@@ -170,18 +173,19 @@
public void testStatefulInvokedBusinessInterface() throws Exception
{
- Stateful stateful1 = (Stateful) getInitialContext().lookup(Stateful.JNDI_NAME);
- StatefulRemoteBusiness stateful2 = (StatefulRemoteBusiness) getInitialContext().lookup(
- StatefulRemoteBusiness.JNDI_NAME);
+ Stateful stateful1 = (Stateful) getInitialContext().lookup(
+ StatefulBean.class.getSimpleName() + "/remote-" + Stateful.class.getName());
+ StatefulRemoteBusiness2 stateful2 = (StatefulRemoteBusiness2) getInitialContext().lookup(
+ StatefulBean.class.getSimpleName() + "/remote-" + StatefulRemoteBusiness2.class.getName());
- Class interfc = stateful1.testInvokedBusinessInterface();
+ Class<?> interfc = stateful1.testInvokedBusinessInterface();
assertEquals(interfc, Stateful.class);
interfc = stateful2.testInvokedBusinessInterface2();
- assertEquals(interfc, StatefulRemoteBusiness.class);
+ assertEquals(interfc, StatefulRemoteBusiness2.class);
- interfc = stateful1.testLocalInvokedBusinessInterface();
- assertEquals(interfc, StatefulRemoteBusiness.class);
+ interfc = stateful2.testLocalInvokedBusinessInterface();
+ assertEquals(interfc, StatefulLocalBusiness1.class);
stateful1.setState("same");
Stateful stateful3 = (Stateful) stateful1.getBusinessObject();
@@ -191,7 +195,7 @@
public void testGetBusinessObjectNullStateful() throws Exception
{
- Stateful stateful = (Stateful) getInitialContext().lookup(Stateful.JNDI_NAME);
+ Stateful stateful = (Stateful) getInitialContext().lookup(StatefulBean.class.getSimpleName() + "/remote");
try
{
stateful.testBusinessObject(null);
@@ -222,8 +226,8 @@
public void testLocalOnlyGetBusinessObject() throws Exception
{
- StatefulRemoteBusiness sfsb = (StatefulRemoteBusiness) getInitialContext().lookup(
- StatefulRemoteBusiness.JNDI_NAME);
+ StatefulRemoteBusiness1 sfsb = (StatefulRemoteBusiness1) getInitialContext().lookup(
+ StatefulBean.class.getSimpleName() + "/remote-" + StatefulRemoteBusiness1.class.getName());
Object o = sfsb.testLocalOnlyGetBusinessObject();
assertNotNull(o);
}
More information about the jboss-cvs-commits
mailing list