[jboss-cvs] JBossAS SVN: r101777 - in projects/ejb3/trunk/common/src: test/java/org/jboss/ejb3/test/common/resolvers and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 3 11:18:07 EST 2010


Author: wolfc
Date: 2010-03-03 11:18:07 -0500 (Wed, 03 Mar 2010)
New Revision: 101777

Added:
   projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/ChildServiceBean.java
   projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/ChildServiceLocal.java
Modified:
   projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/resolvers/spi/EjbReferenceResolverBase.java
   projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/unit/EjbReferenceResolverUnitTestCaseBase.java
Log:
EJBTHREE-2033: resolve all session bean references

Modified: projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/resolvers/spi/EjbReferenceResolverBase.java
===================================================================
--- projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/resolvers/spi/EjbReferenceResolverBase.java	2010-03-03 14:59:36 UTC (rev 101776)
+++ projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/resolvers/spi/EjbReferenceResolverBase.java	2010-03-03 16:18:07 UTC (rev 101777)
@@ -110,7 +110,7 @@
       for (JBossEnterpriseBeanMetaData bean : beans)
       {
          // We only can inject Session Beans (Entity and MDB are not targets)
-         if (!bean.isSession())
+         if (!(bean instanceof JBossSessionBeanMetaData))
          {
             continue;
          }

Added: projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/ChildServiceBean.java
===================================================================
--- projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/ChildServiceBean.java	                        (rev 0)
+++ projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/ChildServiceBean.java	2010-03-03 16:18:07 UTC (rev 101777)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., 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.common.resolvers;
+
+import org.jboss.ejb3.annotation.Service;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Service
+ at Local(ChildServiceLocal.class)
+public class ChildServiceBean
+{
+}


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

Added: projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/ChildServiceLocal.java
===================================================================
--- projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/ChildServiceLocal.java	                        (rev 0)
+++ projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/ChildServiceLocal.java	2010-03-03 16:18:07 UTC (rev 101777)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., 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.common.resolvers;
+
+import javax.ejb.Local;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Local
+public interface ChildServiceLocal
+{
+}


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

Modified: projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/unit/EjbReferenceResolverUnitTestCaseBase.java
===================================================================
--- projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/unit/EjbReferenceResolverUnitTestCaseBase.java	2010-03-03 14:59:36 UTC (rev 101776)
+++ projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/resolvers/unit/EjbReferenceResolverUnitTestCaseBase.java	2010-03-03 16:18:07 UTC (rev 101777)
@@ -42,16 +42,7 @@
  */
 package org.jboss.ejb3.test.common.resolvers.unit;
 
-import java.lang.reflect.AnnotatedElement;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import junit.framework.TestCase;
-
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
 import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
@@ -71,6 +62,8 @@
 import org.jboss.ejb3.test.common.resolvers.Child2LocalBusiness;
 import org.jboss.ejb3.test.common.resolvers.Child3Bean;
 import org.jboss.ejb3.test.common.resolvers.Child3LocalBusiness;
+import org.jboss.ejb3.test.common.resolvers.ChildServiceBean;
+import org.jboss.ejb3.test.common.resolvers.ChildServiceLocal;
 import org.jboss.ejb3.test.common.resolvers.NestedChildBean;
 import org.jboss.ejb3.test.common.resolvers.NestedChildLocalBusiness;
 import org.jboss.ejb3.test.common.resolvers.ParentBean;
@@ -84,6 +77,17 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.lang.reflect.AnnotatedElement;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
 /**
  * EjbReferenceResolverUnitTestCaseBase
  * 
@@ -137,7 +141,7 @@
    public void testDeploymentUnitRelationships() throws Throwable
    {
       // Parent should have 2 children
-      TestCase.assertEquals("Parent DU does not have expected number of children", 2, parentDu.getChildren().size());
+      TestCase.assertEquals("Parent DU does not have expected number of children", 3, parentDu.getChildren().size());
 
       // Children should have parent of parentDU
       TestCase.assertEquals("Child1 DU should have parent of Parent DU", parentDu, child1Du.getParent());
@@ -158,6 +162,15 @@
       TestCase.assertEquals("Nested Child DU should have parent of Child1 DU", child1Du, nestedChildDu.getParent());
    }
 
+   @Test
+   public void testEJBTHREE2033()
+   {
+      EjbReference ref = new EjbReference(null, ChildServiceLocal.class.getName(), null);
+
+      String name = resolver.resolveEjb(parentDu, ref);
+      assertEquals("ChildServiceBean/local-org.jboss.ejb3.test.common.resolvers.ChildServiceLocal", name);
+   }
+
    /**
     * Ensures that the parent can resolve itself and children by bean 
     * interface alone (business and homes)
@@ -394,11 +407,13 @@
       JBoss50MetaData child1Md = creator.create(child1Classes);
       JBoss50MetaData child2Md = creator.create(child2Classes);
       JBoss50MetaData nestedChildMd = creator.create(nestedChildClasses);
+      JBoss50MetaData serviceMd = creator.create(Arrays.<Class<?>>asList(ChildServiceBean.class));
       Collection<JBossMetaData> mds = new ArrayList<JBossMetaData>();
       mds.add(parentMd);
       mds.add(child1Md);
       mds.add(child2Md);
       mds.add(nestedChildMd);
+      mds.add(serviceMd);
 
       // Decorate all EJBs w/ JNDI Policy
       for (JBossMetaData md : mds)
@@ -419,6 +434,10 @@
       child2Du = new MockDeploymentUnit("Child 2", parentDu);
       child2Du.addAttachment(AttachmentNames.PROCESSED_METADATA, child2Md);
 
+      // Service Bean DU
+      MockDeploymentUnit serviceDu = new MockDeploymentUnit("Child Service", parentDu);
+      serviceDu.addAttachment(AttachmentNames.PROCESSED_METADATA, serviceMd);
+
       // Nested Child DU
       nestedChildDu = new MockDeploymentUnit("Nested Child", child1Du);
       nestedChildDu.addAttachment(AttachmentNames.PROCESSED_METADATA, nestedChildMd);
@@ -426,6 +445,7 @@
       // Set children of parents for bi-directional support
       parentDu.addChild(child1Du);
       parentDu.addChild(child2Du);
+      parentDu.addChild(serviceDu);
       child1Du.addChild(nestedChildDu);
 
       // Set Resolver




More information about the jboss-cvs-commits mailing list