[jboss-cvs] JBossAS SVN: r63346 - 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 Jun 5 08:42:48 EDT 2007


Author: wolfc
Date: 2007-06-05 08:42:47 -0400 (Tue, 05 Jun 2007)
New Revision: 63346

Added:
   trunk/ejb3/src/resources/test/ejbthree985/
   trunk/ejb3/src/resources/test/ejbthree985/META-INF/
   trunk/ejb3/src/resources/test/ejbthree985/META-INF/ejb-jar.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntry.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntryBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/unit/OptionalEnvEntryTestCase.java
Modified:
   trunk/ejb3/build-test.xml
Log:
EJBTHREE-985: unit test

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2007-06-05 10:17:48 UTC (rev 63345)
+++ trunk/ejb3/build-test.xml	2007-06-05 12:42:47 UTC (rev 63346)
@@ -2014,6 +2014,13 @@
       </copy>
    </target>
    
+   <target name="ejbthree985"
+      description="Builds a simple jar file."
+      depends="compile-classes">
+      
+      <build-simple-jar name="ejbthree985"/>
+   </target>
+   
    <target name="jaxws"
       description="Builds a simple jar."
       depends="compile-classes">
@@ -3332,7 +3339,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, ejbthree963, ejbthree967, ejbthree971, ejbthree973,
+      ejbthree953, ejbthree957, ejbthree959, ejbthree963, ejbthree967, ejbthree971, ejbthree973, ejbthree985,
       aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, 
       securitydomain, enventry, 
       jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions, 
@@ -4196,6 +4203,9 @@
       <antcall target="test" inheritRefs="true">
          <param name="test" value="ejbthree973"/>
       </antcall>
+      <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree985"/>
+      </antcall>
    </target>
 
    <target name="entity-tests" depends="init" description="Execute all tests">

Added: trunk/ejb3/src/resources/test/ejbthree985/META-INF/ejb-jar.xml
===================================================================
--- trunk/ejb3/src/resources/test/ejbthree985/META-INF/ejb-jar.xml	                        (rev 0)
+++ trunk/ejb3/src/resources/test/ejbthree985/META-INF/ejb-jar.xml	2007-06-05 12:42:47 UTC (rev 63346)
@@ -0,0 +1,20 @@
+<?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" 
+  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>OptionalEnvEntryBean</ejb-name>
+      <env-entry>
+        <description>default env-entry</description>
+        <env-entry-name>entry</env-entry-name>
+        <env-entry-type>java.lang.Double</env-entry-type>
+        <injection-target>
+          <injection-target-class>org.jboss.ejb3.test.ejbthree985.OptionalEnvEntryBean</injection-target-class>
+          <injection-target-name>entry</injection-target-name>
+        </injection-target>
+      </env-entry>
+    </session>
+  </enterprise-beans>
+</ejb-jar>
\ No newline at end of file


Property changes on: trunk/ejb3/src/resources/test/ejbthree985/META-INF/ejb-jar.xml
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntry.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntry.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntry.java	2007-06-05 12:42:47 UTC (rev 63346)
@@ -0,0 +1,34 @@
+/*
+ * 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.ejbthree985;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface OptionalEnvEntry
+{
+   void checkLookup();
+   Double getEntry();
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntry.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntryBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntryBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntryBean.java	2007-06-05 12:42:47 UTC (rev 63346)
@@ -0,0 +1,65 @@
+/*
+ * 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.ejbthree985;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+
+/**
+ * Return the value of a burried env entry.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(OptionalEnvEntry.class)
+public class OptionalEnvEntryBean implements OptionalEnvEntry
+{
+   //@Resource(name="entry") 
+   private Double entry = 1.1;
+   
+   public void checkLookup()
+   {
+      try
+      {
+         InitialContext ctx = new InitialContext();
+         ctx.lookup("java:comp/env/entry");
+         throw new RuntimeException("Should have thrown a NameNotFoundException");
+      }
+      catch(NameNotFoundException e)
+      {
+         // okay
+      }
+      catch(NamingException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   public Double getEntry()
+   {
+      return entry;
+   }
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntryBean.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/unit/OptionalEnvEntryTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/unit/OptionalEnvEntryTestCase.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/unit/OptionalEnvEntryTestCase.java	2007-06-05 12:42:47 UTC (rev 63346)
@@ -0,0 +1,66 @@
+/*
+ * 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.ejbthree985.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree985.OptionalEnvEntry;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Test to see if optional env-entry-value works (16.4.1.3).
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision$
+ */
+public class OptionalEnvEntryTestCase extends JBossTestCase
+{
+
+   public OptionalEnvEntryTestCase(String name)
+   {
+      super(name);
+   }
+
+   private OptionalEnvEntry lookupBean() throws Exception
+   {
+      return (OptionalEnvEntry) getInitialContext().lookup("OptionalEnvEntryBean/remote");
+   }
+   
+   public void test1() throws Exception
+   {
+      OptionalEnvEntry bean = lookupBean();
+      Double actual = bean.getEntry();
+      // 1.1 is defined in OptionalEnvEntryBean
+      assertEquals(new Double(1.1), actual);
+   }
+   
+   public void testLookup() throws Exception
+   {
+      OptionalEnvEntry bean = lookupBean();
+      bean.checkLookup();
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(OptionalEnvEntryTestCase.class, "ejbthree985.jar");
+   }
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree985/unit/OptionalEnvEntryTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list