[jboss-cvs] JBossAS SVN: r67307 - in trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122: unit and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 20 16:16:56 EST 2007
Author: ALRubinger
Date: 2007-11-20 16:16:56 -0500 (Tue, 20 Nov 2007)
New Revision: 67307
Added:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestLocalBusinessInterface.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestRemoteBusinessInterface.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestServiceBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestStatefulBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestStatelessBean.java
Removed:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBusinessInterface.java
Modified:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBaseClass.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java
Log:
[EJBTHREE-1122] Added tests and deployments to check across both local and remote for Service, Stateless, and Stateful
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBaseClass.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBaseClass.java 2007-11-20 19:37:05 UTC (rev 67306)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBaseClass.java 2007-11-20 21:16:56 UTC (rev 67307)
@@ -22,16 +22,25 @@
package org.jboss.ejb3.test.ejbthree1122;
/**
- * Test Base, implementing @Remote business interface
+ * Test Base, implementing @Remote and @Local business interfaces
*
* @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
* @version $Revision: $
*/
-public class TestBaseClass implements TestBusinessInterface
+public abstract class TestBaseClass implements TestRemoteBusinessInterface, TestLocalBusinessInterface
{
+ // Required Implementations
public void test()
{
}
+ public void testLocal()
+ {
+ this.getLocal().test();
+ }
+
+ // Contracts
+
+ public abstract TestLocalBusinessInterface getLocal();
}
Deleted: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBean.java 2007-11-20 19:37:05 UTC (rev 67306)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBean.java 2007-11-20 21:16:56 UTC (rev 67307)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, 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.ejbthree1122;
-
-import javax.ejb.Stateless;
-
-/**
- * A Test EJB both directly implementing a remote business interface
- * and extending from a base class that also implements a remote
- * business interface
- *
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision: $
- */
- at Stateless
-public class TestBean extends TestBaseClass implements TestBusinessInterface
-{
-
-}
Deleted: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBusinessInterface.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBusinessInterface.java 2007-11-20 19:37:05 UTC (rev 67306)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBusinessInterface.java 2007-11-20 21:16:56 UTC (rev 67307)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, 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.ejbthree1122;
-
-import javax.ejb.Remote;
-
-import org.jboss.annotation.ejb.RemoteBinding;
-
-/**
- * Test Remote Business Interface
- *
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision: $
- */
- at Remote
- at RemoteBinding(jndiBinding=TestBusinessInterface.JNDI_NAME)
-public interface TestBusinessInterface
-{
- String JNDI_NAME = "TestBean/remote";
-
- void test();
-}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestLocalBusinessInterface.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestLocalBusinessInterface.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestLocalBusinessInterface.java 2007-11-20 21:16:56 UTC (rev 67307)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1122;
+
+import javax.ejb.Local;
+
+/**
+ * Test Local Business Interface
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Local
+public interface TestLocalBusinessInterface
+{
+ String JNDI_NAME_STATELESS_LOCAL = "TestBean/stateless/local";
+
+ String JNDI_NAME_STATEFUL_LOCAL = "TestBean/stateful/local";
+
+ String JNDI_NAME_SERVICE_LOCAL = "TestBean/service/local";
+
+ void test();
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestLocalBusinessInterface.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestRemoteBusinessInterface.java (from rev 67301, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBusinessInterface.java)
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestRemoteBusinessInterface.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestRemoteBusinessInterface.java 2007-11-20 21:16:56 UTC (rev 67307)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1122;
+
+import javax.ejb.Remote;
+
+/**
+ * Test Remote Business Interface
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Remote
+public interface TestRemoteBusinessInterface
+{
+ String JNDI_NAME_STATELESS_REMOTE = "TestBean/stateless/remote";
+
+ String JNDI_NAME_STATEFUL_REMOTE = "TestBean/stateful/remote";
+
+ String JNDI_NAME_SERVICE_REMOTE = "TestBean/service/remote";
+
+ void test();
+
+ void testLocal();
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestServiceBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestServiceBean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestServiceBean.java 2007-11-20 21:16:56 UTC (rev 67307)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1122;
+
+import javax.ejb.EJB;
+
+import org.jboss.annotation.ejb.LocalBinding;
+import org.jboss.annotation.ejb.RemoteBinding;
+import org.jboss.annotation.ejb.Service;
+
+/**
+ * A Service/Singleton/Mbean Test EJB both directly implementing a remote business interface
+ * and extending from a base class that also implements a remote
+ * business interface
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Service
+ at RemoteBinding(jndiBinding = TestRemoteBusinessInterface.JNDI_NAME_SERVICE_REMOTE)
+ at LocalBinding(jndiBinding = TestLocalBusinessInterface.JNDI_NAME_SERVICE_LOCAL)
+public class TestServiceBean extends TestBaseClass implements TestRemoteBusinessInterface, TestLocalBusinessInterface
+{
+ // Instance Members
+ @EJB(mappedName = TestLocalBusinessInterface.JNDI_NAME_SERVICE_LOCAL)
+ TestLocalBusinessInterface localRef;
+
+ public TestLocalBusinessInterface getLocal()
+ {
+ return localRef;
+ }
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestServiceBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestStatefulBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestStatefulBean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestStatefulBean.java 2007-11-20 21:16:56 UTC (rev 67307)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1122;
+
+import javax.ejb.Stateful;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.annotation.ejb.LocalBinding;
+import org.jboss.annotation.ejb.RemoteBinding;
+
+/**
+ * A Stateful Test EJB both directly implementing a remote business interface
+ * and extending from a base class that also implements a remote
+ * business interface
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at RemoteBinding(jndiBinding = TestRemoteBusinessInterface.JNDI_NAME_STATEFUL_REMOTE)
+ at LocalBinding(jndiBinding = TestLocalBusinessInterface.JNDI_NAME_STATEFUL_LOCAL)
+public class TestStatefulBean extends TestBaseClass implements TestRemoteBusinessInterface, TestLocalBusinessInterface
+{
+ public TestLocalBusinessInterface getLocal()
+ {
+ try
+ {
+ return (TestLocalBusinessInterface) new InitialContext()
+ .lookup(TestLocalBusinessInterface.JNDI_NAME_STATEFUL_LOCAL);
+ }
+ catch (NamingException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestStatefulBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestStatelessBean.java (from rev 67301, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestBean.java)
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestStatelessBean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/TestStatelessBean.java 2007-11-20 21:16:56 UTC (rev 67307)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1122;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+
+import org.jboss.annotation.ejb.LocalBinding;
+import org.jboss.annotation.ejb.RemoteBinding;
+
+/**
+ * A Stateless Test EJB both directly implementing a remote business interface
+ * and extending from a base class that also implements a remote
+ * business interface
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at RemoteBinding(jndiBinding = TestRemoteBusinessInterface.JNDI_NAME_STATELESS_REMOTE)
+ at LocalBinding(jndiBinding = TestLocalBusinessInterface.JNDI_NAME_STATELESS_LOCAL)
+public class TestStatelessBean extends TestBaseClass implements TestRemoteBusinessInterface, TestLocalBusinessInterface
+{
+ // Instance Members
+ @EJB(mappedName = TestLocalBusinessInterface.JNDI_NAME_STATELESS_LOCAL)
+ TestLocalBusinessInterface localRef;
+
+ public TestLocalBusinessInterface getLocal()
+ {
+ return localRef;
+ }
+}
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java 2007-11-20 19:37:05 UTC (rev 67306)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java 2007-11-20 21:16:56 UTC (rev 67307)
@@ -23,6 +23,8 @@
import junit.framework.Test;
+import org.jboss.ejb3.test.ejbthree1122.TestLocalBusinessInterface;
+import org.jboss.ejb3.test.ejbthree1122.TestRemoteBusinessInterface;
import org.jboss.test.JBossTestCase;
/**
@@ -40,12 +42,124 @@
{
super(name);
}
-
+
// Suite
public static Test suite() throws Exception
{
return getDeploySetup(MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.class, "ejbthree1122.jar");
}
-
-
+
+ // Tests
+
+ /**
+ * Test the Stateless Remote EJB
+ */
+ public void testTestStatelessRemoteEjb() throws Exception
+ {
+ this.internalTestRemoteView(TestRemoteBusinessInterface.JNDI_NAME_STATELESS_REMOTE);
+ }
+
+ /**
+ * Test the Stateless Local EJB
+ */
+ public void testTestStatelessLocalEjb() throws Exception
+ {
+ this.internalTestLocalView(TestRemoteBusinessInterface.JNDI_NAME_STATELESS_REMOTE);
+ }
+
+ /**
+ * Test the Service Remote EJB
+ */
+ public void testTestServiceRemoteEjb() throws Exception
+ {
+ this.internalTestRemoteView(TestRemoteBusinessInterface.JNDI_NAME_SERVICE_REMOTE);
+ }
+
+ /**
+ * Test the Service Local EJB
+ */
+ public void testTestServiceLocalEjb() throws Exception
+ {
+ this.internalTestLocalView(TestRemoteBusinessInterface.JNDI_NAME_SERVICE_REMOTE);
+ }
+
+ /**
+ * Test the Stateful Remote EJB
+ */
+ public void testTestStatefulRemoteEjb() throws Exception
+ {
+ this.internalTestRemoteView(TestRemoteBusinessInterface.JNDI_NAME_STATEFUL_REMOTE);
+ }
+
+ /**
+ * Test the Stateful Local EJB
+ */
+ public void testTestStatefulLocalEjb() throws Exception
+ {
+ this.internalTestLocalView(TestRemoteBusinessInterface.JNDI_NAME_STATEFUL_REMOTE);
+ }
+
+ // Internal Helper Methods
+
+ private void internalTestRemoteView(String jndiName)
+ {
+ // Initialize
+ TestRemoteBusinessInterface test = null;
+
+ // Lookup
+ try
+ {
+ test = (TestRemoteBusinessInterface) this.getInitialContext().lookup(
+ jndiName);
+ }
+ catch (Throwable t)
+ {
+ log.error(t);
+ JBossTestCase.fail(t.getMessage());
+ }
+ // Ensure lookup succeeds; bean is deployed
+ JBossTestCase.assertNotNull(test);
+
+ // Invoke
+ try
+ {
+ test.test();
+ }
+ catch (Throwable t)
+ {
+ log.error(t);
+ JBossTestCase.fail("Invocation failed: " + t.getMessage());
+ }
+ }
+
+ private void internalTestLocalView(String remoteDelegateJndiName)
+ {
+ // Initialize
+ TestRemoteBusinessInterface test = null;
+
+ // Lookup
+ try
+ {
+ test = (TestRemoteBusinessInterface) this.getInitialContext().lookup(remoteDelegateJndiName);
+ }
+ catch (Throwable t)
+ {
+ log.error(t);
+ JBossTestCase.fail(t.getMessage());
+ }
+ // Ensure lookup succeeds; bean is deployed
+ JBossTestCase.assertNotNull(test);
+
+ // Invoke on local
+ try
+ {
+ test.testLocal();
+ }
+ catch (Throwable t)
+ {
+ log.error(t);
+ JBossTestCase.fail("Invocation failed: " + t.getMessage());
+ }
+ }
+
}
More information about the jboss-cvs-commits
mailing list