[jboss-cvs] JBossAS SVN: r80352 - in projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143: unit and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Nov 2 17:29:21 EST 2008


Author: ALRubinger
Date: 2008-11-02 17:29:20 -0500 (Sun, 02 Nov 2008)
New Revision: 80352

Added:
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyServiceBean.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyStatelessBean.java
Removed:
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyLocalBean.java
Modified:
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/unit/LocalBindingSetsLocalJndiNameTestCase.java
Log:
[JBMETA-143] Add test for @LocalBinding on @Service

Deleted: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyLocalBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyLocalBean.java	2008-11-02 18:53:56 UTC (rev 80351)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyLocalBean.java	2008-11-02 22:29:20 UTC (rev 80352)
@@ -1,43 +0,0 @@
-/*
- * 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.test.metadata.jbmeta143;
-
-import javax.ejb.Local;
-import javax.ejb.Stateless;
-
-import org.jboss.ejb3.annotation.LocalBinding;
-
-/**
- * MyLocalBean
- * 
- * A test SLSB declaring an explicit Local JNDI Binding
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
- at Stateless
- at Local(MyLocal.class)
- at LocalBinding(jndiBinding = MyLocal.JNDI_NAME)
-public class MyLocalBean implements MyLocal
-{
-
-}

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyServiceBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyServiceBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyServiceBean.java	2008-11-02 22:29:20 UTC (rev 80352)
@@ -0,0 +1,40 @@
+/*
+ * 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.test.metadata.jbmeta143;
+
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.Service;
+
+/**
+ * MyServiceBean
+ * 
+ * A test @Service bean defining a @LocalBinding
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Service
+ at LocalBinding(jndiBinding = MyServiceBean.JNDI_NAME)
+public class MyServiceBean
+{
+   public static final String JNDI_NAME = "OverriddenServiceJNDIName";
+}

Copied: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyStatelessBean.java (from rev 80349, projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyLocalBean.java)
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyStatelessBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/MyStatelessBean.java	2008-11-02 22:29:20 UTC (rev 80352)
@@ -0,0 +1,43 @@
+/*
+ * 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.test.metadata.jbmeta143;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.LocalBinding;
+
+/**
+ * MyLocalBean
+ * 
+ * A test SLSB declaring an explicit Local JNDI Binding
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Local(MyLocal.class)
+ at LocalBinding(jndiBinding = MyLocal.JNDI_NAME)
+public class MyStatelessBean implements MyLocal
+{
+
+}

Modified: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/unit/LocalBindingSetsLocalJndiNameTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/unit/LocalBindingSetsLocalJndiNameTestCase.java	2008-11-02 18:53:56 UTC (rev 80351)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta143/unit/LocalBindingSetsLocalJndiNameTestCase.java	2008-11-02 22:29:20 UTC (rev 80352)
@@ -36,7 +36,9 @@
 import org.jboss.metadata.process.processor.JBossMetaDataProcessor;
 import org.jboss.metadata.process.processor.ejb.jboss.SetExplicitLocalJndiNameProcessor;
 import org.jboss.test.metadata.jbmeta143.MyLocal;
-import org.jboss.test.metadata.jbmeta143.MyLocalBean;
+import org.jboss.test.metadata.jbmeta143.MyServiceBean;
+import org.jboss.test.metadata.jbmeta143.MyStatelessBean;
+import org.junit.BeforeClass;
 
 /**
  * LocalBindingSetsLocalJndiNameTestCase
@@ -57,6 +59,8 @@
 
    private static final Logger log = Logger.getLogger(LocalBindingSetsLocalJndiNameTestCase.class);
 
+   private static JBoss50MetaData ejbs = null;
+
    // -------------------------------------------------------------------||
    // Tests -------------------------------------------------------------||
    // -------------------------------------------------------------------||
@@ -66,11 +70,35 @@
     * JNDI name set in metadata
     */
    @SuppressWarnings("unchecked")
-   public void testLocalBindingDeclaredSetsLocalJndiName() throws Throwable
+   public void testLocalBindingDeclaredOnSlsbSetsLocalJndiName() throws Throwable
    {
-      // Set up EJB Impl class
-      final Class<?> ejbImplClass = MyLocalBean.class;
+      // Get the EJB
+      JBossEnterpriseBeanMetaData ejb = ejbs.getEnterpriseBean(MyStatelessBean.class.getSimpleName());
 
+      // Ensure JNDI name is set up as expected
+      String expectedLocalJndiName = MyLocal.JNDI_NAME;
+      TestCase.assertEquals("@LocalBinding.jndiName should result in metadata local JNDI name to be set",
+            expectedLocalJndiName, ejb.getLocalJndiName());
+   }
+
+   /**
+    * Tests that an EJB with a @LocalBinding declared has a local
+    * JNDI name set in metadata
+    */
+   @SuppressWarnings("unchecked")
+   public void testLocalBindingDeclaredOnServiceSetsLocalJndiName() throws Throwable
+   {
+      // Get the EJB
+      JBossEnterpriseBeanMetaData ejb = ejbs.getEnterpriseBean(MyServiceBean.class.getSimpleName());
+
+      // Ensure JNDI name is set up as expected
+      String expectedLocalJndiName = MyServiceBean.JNDI_NAME;
+      TestCase.assertEquals("@LocalBinding.jndiName should result in metadata local JNDI name to be set",
+            expectedLocalJndiName, ejb.getLocalJndiName());
+   }
+
+   protected void setUp()
+   {
       /*
        * Set up a JBoss Metadata Creator
        */
@@ -78,9 +106,10 @@
       // Make an annotation finder
       AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
 
-      // Configure to scan the test EJB
+      // Configure to scan the test EJBs
       Collection<Class<?>> classes = new ArrayList<Class<?>>();
-      classes.add(ejbImplClass);
+      classes.add(MyStatelessBean.class);
+      classes.add(MyServiceBean.class);
       JBoss50Creator creator = new JBoss50Creator(finder);
 
       // Make the metadata
@@ -90,13 +119,8 @@
       JBossMetaDataProcessor<JBoss50MetaData> processor = SetExplicitLocalJndiNameProcessor.INSTANCE;
       md = processor.process(md);
 
-      // Get the EJB
-      JBossEnterpriseBeanMetaData ejb = md.getEnterpriseBean(MyLocalBean.class.getSimpleName());
-
-      // Ensure JNDI name is set up as expected
-      String expectedLocalJndiName = MyLocal.JNDI_NAME;
-      TestCase.assertEquals("@LocalBinding.jndiName should result in metadata local JNDI name to be set",
-            expectedLocalJndiName, ejb.getLocalJndiName());
+      // Set the EJBs
+      ejbs = md;
    }
 
 }




More information about the jboss-cvs-commits mailing list