[jboss-cvs] JBossAS SVN: r63054 - in trunk/ejb3: src/resources/test and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 15 11:39:39 EDT 2007


Author: wolfc
Date: 2007-05-15 11:39:39 -0400 (Tue, 15 May 2007)
New Revision: 63054

Added:
   trunk/ejb3/src/resources/test/ejbthree963/
   trunk/ejb3/src/resources/test/ejbthree963/META-INF/
   trunk/ejb3/src/resources/test/ejbthree963/META-INF/jboss.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/MyStateful.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/MyStatefulBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/unit/NoEjbCreateTestCase.java
Modified:
   trunk/ejb3/build-test.xml
Log:
EJBTHREE-963: unit test

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2007-05-15 15:22:31 UTC (rev 63053)
+++ trunk/ejb3/build-test.xml	2007-05-15 15:39:39 UTC (rev 63054)
@@ -1979,6 +1979,13 @@
       <build-simple-jar name="ejbthree959"/>
    </target>
    
+   <target name="ejbthree963"
+      description="Builds a simple jar files."
+      depends="compile-classes">
+      
+      <build-simple-jar name="ejbthree963"/>
+   </target>
+   
    <target name="jaxws"
       description="Builds a simple jar."
       depends="compile-classes">
@@ -3297,7 +3304,7 @@
    <target name="jars" depends="appclient, tck5sec, invalidtxmdb, descriptortypo, libdeployment, homeinterface, timestampentity, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440, 
       ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751, ejbthree921, ejbthree936, ejbthree939,
-      ejbthree953, ejbthree957, ejbthree959,
+      ejbthree953, ejbthree957, ejbthree959, ejbthree963,
       aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, 
       securitydomain, enventry, 
       jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions, 
@@ -4149,6 +4156,9 @@
       <antcall target="test" inheritRefs="true">
          <param name="test" value="ejbthree959"/>
       </antcall>
+      <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree963"/>
+      </antcall>
    </target>
 
    <target name="entity-tests" depends="init" description="Execute all tests">

Added: trunk/ejb3/src/resources/test/ejbthree963/META-INF/jboss.xml
===================================================================
--- trunk/ejb3/src/resources/test/ejbthree963/META-INF/jboss.xml	                        (rev 0)
+++ trunk/ejb3/src/resources/test/ejbthree963/META-INF/jboss.xml	2007-05-15 15:39:39 UTC (rev 63054)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<jboss
+        xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
+        version="3.0">
+   <enterprise-beans>
+      <session>
+         <ejb-name>MyStatefulBean</ejb-name>
+         <jndi-name>MyStatefulBean</jndi-name>
+      </session>
+   </enterprise-beans>
+</jboss>
\ No newline at end of file

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/MyStateful.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/MyStateful.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/MyStateful.java	2007-05-15 15:39:39 UTC (rev 63054)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ejbthree963;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * @author carlo
+ *
+ */
+ at javax.ejb.Remote
+public interface MyStateful extends Remote
+{
+   String sayHi() throws RemoteException;
+   void setName(String name) throws RemoteException;
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/MyStatefulBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/MyStatefulBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/MyStatefulBean.java	2007-05-15 15:39:39 UTC (rev 63054)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ejbthree963;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateful;
+
+/**
+ * @author carlo
+ *
+ */
+ at Stateful
+public class MyStatefulBean implements MyStateful, SessionBean
+{
+   private static final long serialVersionUID = 1L;
+   
+   private SessionContext ctx;
+   private String name;
+
+   public String sayHi() throws RemoteException
+   {
+      if(ctx == null)
+         throw new IllegalStateException("ctx is null");
+      return "Hi " + name;
+   }
+
+   public void setName(String name) throws RemoteException
+   {
+      this.name = name;
+   }
+
+   // this one is optional
+//   public void ejbCreate() //throws EJBException, RemoteException
+//   {
+//   }
+   
+   public void ejbActivate() //throws EJBException, RemoteException
+   {
+   }
+
+   public void ejbPassivate() //throws EJBException, RemoteException
+   {
+   }
+
+   public void ejbRemove() //throws EJBException, RemoteException
+   {
+   }
+
+   public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+   {
+      this.ctx = ctx;
+   }
+
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/unit/NoEjbCreateTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/unit/NoEjbCreateTestCase.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree963/unit/NoEjbCreateTestCase.java	2007-05-15 15:39:39 UTC (rev 63054)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ejbthree963.unit;
+
+import javax.rmi.PortableRemoteObject;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree963.MyStateful;
+import org.jboss.test.JBossTestCase;
+
+
+/**
+ * Test if an EJB 2.1 bean without ejbCreate is properly deployed.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class NoEjbCreateTestCase extends JBossTestCase
+{
+
+   public NoEjbCreateTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testCreateNoArgs() throws Exception
+   {
+      MyStateful bean = (MyStateful) getInitialContext().lookup("MyStatefulBean");
+      bean.setName("testCreateNoArgs");
+      String expected = "Hi testCreateNoArgs";
+      String actual = bean.sayHi();
+      assertEquals(expected, actual);
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(NoEjbCreateTestCase.class, "ejbthree963.jar");
+   }
+
+}




More information about the jboss-cvs-commits mailing list