[jboss-cvs] JBossAS SVN: r58383 - in trunk/ejb3: . src/resources/test src/resources/test/ejbthree712 src/test/org/jboss/ejb3/test src/test/org/jboss/ejb3/test/ejbthree712 src/test/org/jboss/ejb3/test/ejbthree712/unit

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 15 05:26:18 EST 2006


Author: wolfc
Date: 2006-11-15 05:26:09 -0500 (Wed, 15 Nov 2006)
New Revision: 58383

Added:
   trunk/ejb3/src/resources/test/ejbthree712/
   trunk/ejb3/src/resources/test/ejbthree712/ejb-jar.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/InjectionTester.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/InjectionTesterBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/unit/InjectionTesterUnitTestCase.java
Modified:
   trunk/ejb3/build-test.xml
Log:
EJBTHREE-712: unit test

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2006-11-15 09:48:53 UTC (rev 58382)
+++ trunk/ejb3/build-test.xml	2006-11-15 10:26:09 UTC (rev 58383)
@@ -806,6 +806,12 @@
             <include name="org/jboss/ejb3/test/appclient/client/SimpleResourceClient.class"/>
          </fileset>
       </jar>
+      
+      <jar jarfile="${build.lib}/appclient-simpleresource.ear">
+         <fileset dir="${build.lib}">
+            <include name="appclient-simpleresource-client.jar"/>
+         </fileset>
+      </jar>
    </target>
 
    <target name="asynchronous"
@@ -1750,6 +1756,20 @@
       </jar>
    </target>
 
+   <target name="ejbthree712"
+      description="Builds all jar files."
+      depends="compile-classes">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/ejbthree712.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/ejbthree712/*.class"/>
+         </fileset>
+         <zipfileset dir="${build.resources}/test/ejbthree712" prefix="META-INF" includes="*"/>
+      </jar>
+   </target>
+
    <target name="ejbthree751"
       description="Builds all jar files."
       depends="compile-classes">
@@ -2770,7 +2790,7 @@
    
    <target name="jars" depends="arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440, 
-      ejbthree454, ejbthree653, ejbthree670, ejbthree751, aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, 
+      ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree751, aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, 
       securitydomain, enventry, 
       jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions, 
       exception, dd/override, stateless, standalone-jar, dd/mdb, bank, dd, longlived, xmlcfg, hbm, pkg, regressionHHH275, 
@@ -3489,6 +3509,9 @@
          <param name="test" value="microbench"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree712"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="ejbthree751"/>
       </antcall>
    </target>
@@ -3920,4 +3943,7 @@
       <!-- TODO: call sunorb-test, but the report gets overwritten -->
    </target>
    
+   <target name="stop-jboss">
+      <stop-jboss/>
+   </target>
 </project>

Added: trunk/ejb3/src/resources/test/ejbthree712/ejb-jar.xml
===================================================================
--- trunk/ejb3/src/resources/test/ejbthree712/ejb-jar.xml	2006-11-15 09:48:53 UTC (rev 58382)
+++ trunk/ejb3/src/resources/test/ejbthree712/ejb-jar.xml	2006-11-15 10:26:09 UTC (rev 58383)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	metadata-complete="false" 
+	version="3.0" 
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+	
+	<enterprise-beans>
+		<session>
+			<ejb-name>InjectionTesterBean</ejb-name>
+			<business-remote>org.jboss.ejb3.test.ejbthree712.InjectionTester</business-remote>
+			<ejb-class>org.jboss.ejb3.test.ejbthree712.InjectionTesterBean</ejb-class>
+			<session-type>Stateless</session-type>
+			<transaction-type>Container</transaction-type>
+			<resource-env-ref>
+				<resource-env-ref-name>ctx</resource-env-ref-name>
+				<resource-env-ref-type>javax.ejb.SessionContext</resource-env-ref-type>
+				<injection-target>
+					<injection-target-class>org.jboss.ejb3.test.ejbthree712.InjectionTesterBean</injection-target-class>
+					<injection-target-name>ctx</injection-target-name>
+				</injection-target>
+			</resource-env-ref>
+		</session>
+	</enterprise-beans>
+</ejb-jar>
\ No newline at end of file

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/InjectionTester.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/InjectionTester.java	2006-11-15 09:48:53 UTC (rev 58382)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/InjectionTester.java	2006-11-15 10:26:09 UTC (rev 58383)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.ejbthree712;
+
+import javax.ejb.Remote;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+//@Remote
+public interface InjectionTester
+{
+   void checkInjection() throws FailedException;
+   
+   @SuppressWarnings("serial")
+   static class FailedException extends Exception
+   {
+      
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/InjectionTesterBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/InjectionTesterBean.java	2006-11-15 09:48:53 UTC (rev 58382)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/InjectionTesterBean.java	2006-11-15 10:26:09 UTC (rev 58383)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.ejbthree712;
+
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+
+/**
+ * Checks whether injection via ejb-jar.xml of a SessionContext works.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+//@Stateless
+public class InjectionTesterBean implements InjectionTester
+{
+   // injected from ejb-jar.xml
+   private SessionContext ctx;
+   
+   public void checkInjection() throws FailedException
+   {
+      if(ctx == null)
+         throw new FailedException();
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/unit/InjectionTesterUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/unit/InjectionTesterUnitTestCase.java	2006-11-15 09:48:53 UTC (rev 58382)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree712/unit/InjectionTesterUnitTestCase.java	2006-11-15 10:26:09 UTC (rev 58383)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.ejbthree712.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree712.InjectionTester;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class InjectionTesterUnitTestCase extends JBossTestCase
+{
+
+   public InjectionTesterUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testInjection() throws Exception
+   {
+      InjectionTester session = (InjectionTester) getInitialContext().lookup("InjectionTesterBean/remote");
+      try
+      {
+         session.checkInjection();
+      }
+      catch(InjectionTester.FailedException e)
+      {
+         fail("SessionContext not injected");
+      }
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(InjectionTesterUnitTestCase.class, "ejbthree712.jar");
+   }
+}




More information about the jboss-cvs-commits mailing list