[jboss-cvs] JBossAS SVN: r68207 - in trunk/ejb3: src/test/org/jboss/ejb3/test and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 12 18:01:10 EST 2007
Author: ALRubinger
Date: 2007-12-12 18:01:09 -0500 (Wed, 12 Dec 2007)
New Revision: 68207
Added:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/TestBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/TestRemoteBusiness.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/unit/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/unit/EjbCreateWithout21ViewUnitTestCase.java
Modified:
trunk/ejb3/build-test.xml
Log:
[EJBTHREE-1148] Added Unit Tests
Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml 2007-12-12 22:54:12 UTC (rev 68206)
+++ trunk/ejb3/build-test.xml 2007-12-12 23:01:09 UTC (rev 68207)
@@ -2242,6 +2242,10 @@
<build-simple-jar name="ejbthree1146"/>
</target>
+ <target name="ejbthree1148" depends="compile-classes">
+ <build-simple-jar name="ejbthree1148"/>
+ </target>
+
<target name="ejbthree1154" depends="compile-classes">
<build-simple-jar name="ejbthree1154"/>
</target>
@@ -3936,7 +3940,7 @@
ejbthree1057, ejbthree1060,
ejbthree1062,
ejbthree1066, ejbthree1071, ejbthree1075, ejbthree1082, ejbthree1090, ejbthree1092, ejbthree1119, ejbthree1122, ejbthree1123, ejbthree1127,
- ejbthree1146, ejbthree1154, ejbthree1155, ejbthree1157, jaxws, jbas4489,
+ ejbthree1146, ejbthree1148, ejbthree1154, ejbthree1155, ejbthree1157, jaxws, jbas4489,
aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
securitydomain, enventry, security5,
jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions,
@@ -4935,6 +4939,9 @@
<param name="test" value="ejbthree1146"/>
</antcall>
<antcall target="test" inheritRefs="true">
+ <param name="test" value="ejbthree1148"/>
+ </antcall>
+ <antcall target="test" inheritRefs="true">
<param name="test" value="ejbthree1154"/>
</antcall>
<antcall target="test" inheritRefs="true">
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/TestBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/TestBean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/TestBean.java 2007-12-12 23:01:09 UTC (rev 68207)
@@ -0,0 +1,63 @@
+/*
+ * 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.ejbthree1148;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.logging.Logger;
+
+/**
+ * A Test Stateless EJB w/ an ejbCreate() method and
+ * no 2.1 View
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(TestRemoteBusiness.class)
+ at RemoteBinding(jndiBinding = TestRemoteBusiness.JNDI_NAME)
+public class TestBean implements TestRemoteBusiness
+{
+ // Class Members
+ private static final Logger logger = Logger.getLogger(TestBean.class);
+
+ // Instance Members
+
+ private int returnValue = TestRemoteBusiness.RETURN_VALUE;
+
+ // Required Implementations
+ public int test()
+ {
+ return returnValue;
+ }
+
+ // ejbCreate()
+ public void ejbCreate()
+ {
+ // Set return value to unexpected result, proving this was used as a callback
+ returnValue = TestRemoteBusiness.RETURN_VALUE - 1;
+ // Log the error
+ logger.error("ejbCreate SHOULD NOT BE USED AS CALLBACK WITH NO 2.1 VIEW");
+ }
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/TestRemoteBusiness.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/TestRemoteBusiness.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/TestRemoteBusiness.java 2007-12-12 23:01:09 UTC (rev 68207)
@@ -0,0 +1,37 @@
+/*
+ * 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.ejbthree1148;
+
+/**
+ * A Test Remote Business Interface
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public interface TestRemoteBusiness
+{
+ String JNDI_NAME = "TestBean/remote";
+
+ int RETURN_VALUE = 1;
+
+ int test();
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/unit/EjbCreateWithout21ViewUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/unit/EjbCreateWithout21ViewUnitTestCase.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1148/unit/EjbCreateWithout21ViewUnitTestCase.java 2007-12-12 23:01:09 UTC (rev 68207)
@@ -0,0 +1,63 @@
+/*
+ * 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.ejbthree1148.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1148.TestRemoteBusiness;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Tests that a Stateless EJB with an ejbCreate callback
+ * is not called when the EJB has no 2.1 View
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public class EjbCreateWithout21ViewUnitTestCase extends JBossTestCase
+{
+ // Constructor
+ public EjbCreateWithout21ViewUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Suite
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(EjbCreateWithout21ViewUnitTestCase.class, "ejbthree1148.jar");
+ }
+
+ // Tests
+
+ /**
+ * Ensure ejbCreate() is not used as a valid callback when no 2.1 view is defined
+ */
+ public void testRemoteInterfaceNotExplicitlyDefined() throws Exception
+ {
+ // Lookup Business Interface
+ TestRemoteBusiness ejb = (TestRemoteBusiness) this.getInitialContext().lookup(TestRemoteBusiness.JNDI_NAME);
+
+ // Invoke on it, ensuring value is expected
+ assertEquals(ejb.test(), TestRemoteBusiness.RETURN_VALUE);
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list