[jboss-cvs] JBossAS SVN: r71130 - in projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test: ejbthree1222 and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 21 01:40:17 EDT 2008
Author: ALRubinger
Date: 2008-03-21 01:40:17 -0400 (Fri, 21 Mar 2008)
New Revision: 71130
Added:
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/TestStatefulWithRemoveMethodBean.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/TestStatefulWithRemoveMethodRemote.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/unit/
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/unit/RegularRemoveMethodUnitTestCase.java
Log:
[EJBTHREE-1222] Added Unit Test isolating this case for SFSB, passes
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/TestStatefulWithRemoveMethodBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/TestStatefulWithRemoveMethodBean.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/TestStatefulWithRemoveMethodBean.java 2008-03-21 05:40:17 UTC (rev 71130)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejbthree1222;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+
+/**
+ * TestStatefulWithRemoveMethodBean
+ *
+ * A SFSB with remote view that defines a "void remove()" method
+ * that is not annotated with @Remove, and should therefore act like
+ * any plain method.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at Remote(TestStatefulWithRemoveMethodRemote.class)
+ at RemoteBinding(jndiBinding = TestStatefulWithRemoveMethodRemote.JNDI_NAME)
+public class TestStatefulWithRemoveMethodBean implements TestStatefulWithRemoveMethodRemote
+{
+ // Class Members
+
+ public static int CALLS = 0;
+
+ // Required Implementations
+
+ /**
+ * Increments the number of calls
+ */
+ public void remove()
+ {
+ TestStatefulWithRemoveMethodBean.CALLS++;
+ }
+
+ public void reset()
+ {
+ TestStatefulWithRemoveMethodBean.CALLS = 0;
+ }
+
+ public int getCalls()
+ {
+ return TestStatefulWithRemoveMethodBean.CALLS;
+ }
+}
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/TestStatefulWithRemoveMethodRemote.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/TestStatefulWithRemoveMethodRemote.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/TestStatefulWithRemoveMethodRemote.java 2008-03-21 05:40:17 UTC (rev 71130)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejbthree1222;
+
+/**
+ * TestStatefulWithRemoveMethodRemote
+ *
+ * Defines a remote business interface for a Session Bean
+ * with a "void remove()" method
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface TestStatefulWithRemoveMethodRemote
+{
+ String JNDI_NAME="TestStatefulWithRemoveMethod/remote";
+
+ void remove();
+
+ void reset();
+
+ int getCalls();
+}
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/unit/RegularRemoveMethodUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/unit/RegularRemoveMethodUnitTestCase.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree1222/unit/RegularRemoveMethodUnitTestCase.java 2008-03-21 05:40:17 UTC (rev 71130)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejbthree1222.unit;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.ejb3.test.ejbthree1222.TestStatefulWithRemoveMethodRemote;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * RegularRemoveMethodUnitTestCase
+ *
+ * Tests that "void remove()" method not annotated as
+ * @Remove acts like any plain, traditional method
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class RegularRemoveMethodUnitTestCase extends JBossTestCase
+{
+ // Class Members
+ private static final Log logger = LogFactory.getLog(RegularRemoveMethodUnitTestCase.class);
+
+ // Constructor
+
+ public RegularRemoveMethodUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Tests
+
+ /**
+ * Tests that a call to an unannotated "void remove()"
+ * method is a traditional call
+ */
+ public void testHasBeenIntercepted() throws Exception
+ {
+ // Lookup Bean
+ TestStatefulWithRemoveMethodRemote bean = (TestStatefulWithRemoveMethodRemote) this.getInitialContext().lookup(
+ TestStatefulWithRemoveMethodRemote.JNDI_NAME);
+
+ // Reset the number of calls, if any
+ bean.reset();
+
+ // Make a call
+ try
+ {
+ bean.remove();
+ }
+ catch (Exception e)
+ {
+ logger.error(e.getMessage(), e);
+ TestCase.fail(e.getMessage());
+ }
+
+ // Ensure the call was received and the bean instance is still available
+ TestCase.assertEquals(1, bean.getCalls());
+ }
+
+ // Suite
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(RegularRemoveMethodUnitTestCase.class, "ejbthree1222.jar");
+ }
+}
More information about the jboss-cvs-commits
mailing list