[jboss-cvs] JBossAS SVN: r62963 - in trunk/ejb3: src/resources/test and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 10 05:58:08 EDT 2007
Author: wolfc
Date: 2007-05-10 05:58:08 -0400 (Thu, 10 May 2007)
New Revision: 62963
Added:
trunk/ejb3/src/resources/test/ejbthree959/
trunk/ejb3/src/resources/test/ejbthree959/META-INF/
trunk/ejb3/src/resources/test/ejbthree959/META-INF/ejb-jar.xml
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStateful.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStatefulBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStatefulHome.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/unit/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/unit/EJB21TestCase.java
Modified:
trunk/ejb3/build-test.xml
Log:
EJBTHREE-959: unit test
Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml 2007-05-10 09:51:40 UTC (rev 62962)
+++ trunk/ejb3/build-test.xml 2007-05-10 09:58:08 UTC (rev 62963)
@@ -1948,11 +1948,11 @@
</copy>
</target>
- <target name="ejbthreeXXX"
+ <target name="ejbthree959"
description="Builds a simple jar files."
depends="compile-classes">
- <build-simple-jar name="ejbthreeXXX"/>
+ <build-simple-jar name="ejbthree959"/>
</target>
<target name="jaxws"
@@ -3273,7 +3273,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, ejbthree751, ejbthree921, ejbthree936, ejbthree939,
- ejbthree953, ejbthree957,
+ ejbthree953, ejbthree957, ejbthree959,
aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
securitydomain, enventry,
jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions,
@@ -4119,6 +4119,9 @@
<antcall target="test" inheritRefs="true">
<param name="test" value="ejbthree957"/>
</antcall>
+ <antcall target="test" inheritRefs="true">
+ <param name="test" value="ejbthree959"/>
+ </antcall>
</target>
<target name="entity-tests" depends="init" description="Execute all tests">
Added: trunk/ejb3/src/resources/test/ejbthree959/META-INF/ejb-jar.xml
===================================================================
--- trunk/ejb3/src/resources/test/ejbthree959/META-INF/ejb-jar.xml (rev 0)
+++ trunk/ejb3/src/resources/test/ejbthree959/META-INF/ejb-jar.xml 2007-05-10 09:58:08 UTC (rev 62963)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- we're going to force this down the ejb3 deployer -->
+<ejb-jar
+ 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://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+ <display-name>ejbthree959</display-name>
+ <enterprise-beans>
+ <session>
+ <ejb-name>MyStateful</ejb-name>
+ <home>org.jboss.ejb3.test.ejbthree959.MyStatefulHome</home>
+ <remote>org.jboss.ejb3.test.ejbthree959.MyStateful</remote>
+ <ejb-class>org.jboss.ejb3.test.ejbthree959.MyStatefulBean</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStateful.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStateful.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStateful.java 2007-05-10 09:58:08 UTC (rev 62963)
@@ -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.ejbthree959;
+
+import javax.ejb.EJBObject;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateful extends EJBObject
+{
+ String sayHi();
+ void setName(String name);
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStatefulBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStatefulBean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStatefulBean.java 2007-05-10 09:58:08 UTC (rev 62963)
@@ -0,0 +1,95 @@
+/*
+ * 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.ejbthree959;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+/**
+ * A 2.1 stateful bean.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MyStatefulBean implements SessionBean
+{
+ private static final long serialVersionUID = 1L;
+
+ @SuppressWarnings("unused")
+ private SessionContext ctx;
+
+ private String name;
+
+ /* plumbing */
+
+ 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;
+ }
+
+ /* home interface */
+
+ public void ejbCreate() throws CreateException, RemoteException
+ {
+ }
+
+ public void ejbPostCreate() throws CreateException, RemoteException
+ {
+ }
+
+ public void ejbCreate(String name) throws CreateException, RemoteException
+ {
+ setName(name);
+ }
+
+ public void ejbPostCreate(String name) throws CreateException, RemoteException
+ {
+ }
+
+ /* actual stuff */
+
+ public String sayHi()
+ {
+ return "Hi " + name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStatefulHome.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStatefulHome.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/MyStatefulHome.java 2007-05-10 09:58:08 UTC (rev 62963)
@@ -0,0 +1,39 @@
+/*
+ * 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.ejbthree959;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStatefulHome extends EJBHome
+{
+ MyStateful create() throws CreateException, RemoteException;
+ MyStateful create(String name) throws CreateException, RemoteException;
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/unit/EJB21TestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/unit/EJB21TestCase.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree959/unit/EJB21TestCase.java 2007-05-10 09:58:08 UTC (rev 62963)
@@ -0,0 +1,71 @@
+/*
+ * 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.ejbthree959.unit;
+
+import javax.rmi.PortableRemoteObject;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree959.MyStateful;
+import org.jboss.ejb3.test.ejbthree959.MyStatefulHome;
+import org.jboss.test.JBossTestCase;
+
+
+/**
+ * Test if an EJB 2.1 bean is properly deployed.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EJB21TestCase extends JBossTestCase
+{
+
+ public EJB21TestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testCreateNoArgs() throws Exception
+ {
+ MyStatefulHome home = (MyStatefulHome) PortableRemoteObject.narrow(getInitialContext().lookup("MyStateful/home"), MyStatefulHome.class);
+ MyStateful bean = home.create();
+ bean.setName("testCreateNoArgs");
+ String expected = "Hi testCreateNoArgs";
+ String actual = bean.sayHi();
+ assertEquals(expected, actual);
+ }
+
+ public void testCreateWithArgs() throws Exception
+ {
+ MyStatefulHome home = (MyStatefulHome) PortableRemoteObject.narrow(getInitialContext().lookup("MyStateful/home"), MyStatefulHome.class);
+ MyStateful bean = home.create("testCreateWithArgs");
+ String expected = "Hi testCreateWithArgs";
+ String actual = bean.sayHi();
+ assertEquals(expected, actual);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(EJB21TestCase.class, "ejbthree959.jar");
+ }
+
+}
More information about the jboss-cvs-commits
mailing list