You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2008/03/20 04:52:08 UTC

svn commit: r639149 - in /openejb/branches/openejb-3.0/container: openejb-core/src/main/java/org/apache/openejb/assembler/classic/ openejb-core/src/main/java/org/apache/openejb/config/ openejb-core/src/main/java/org/apache/openejb/config/rules/ openejb...

Author: dblevins
Date: Wed Mar 19 20:51:58 2008
New Revision: 639149

URL: http://svn.apache.org/viewvc?rev=639149&view=rev
Log:
Merging r638255 - http://svn.apache.org/viewvc?rev=638255&view=rev

svn merge -r 638254:638255 https://svn.apache.org/repos/asf/openejb/trunk/openejb3 .

------------------------------------------------------------------------
r638255 | dblevins | 2008-03-18 01:02:11 -0700 (Tue, 18 Mar 2008) | 2 lines

Transaction Annotation inheritance and xml overriding

------------------------------------------------------------------------

Added:
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodAttributeInfo.java
      - copied unchanged from r638255, openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodAttributeInfo.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfoUtil.java
      - copied unchanged from r638255, openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfoUtil.java
    openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/TransactionAttributesTest.java
      - copied unchanged from r638255, openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/TransactionAttributesTest.java
Modified:
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfo.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodPermissionInfo.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionBuilder.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionInfo.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java
    openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java
    openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/MethodTransactionInfoComparatorTest.java
    openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/config/InheritenceTest.java
    openejb/branches/openejb-3.0/container/openejb-jee/src/main/java/org/apache/openejb/jee/Method.java

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java Wed Mar 19 20:51:58 2008
@@ -26,7 +26,6 @@
 import java.util.HashMap;
 import java.util.Properties;
 import java.util.List;
-import java.util.ArrayList;
 import java.util.Map;
 
 public class AssemblerTool {
@@ -51,79 +50,10 @@
         System.setProperty("noBanner", "true");
     }
 
-    protected static void resolveMethods(List<Method> methods, Class intrface, MethodInfo mi)
-            throws SecurityException {
-        /*TODO: Add better exception handling. There is a lot of complex code here, I'm sure something could go wrong the user
-         might want to know about.
-         At the very least, log a warning or two.
-         */
-
-        // todo local permissions cause exception
-        if (intrface == null) return;
-
-        if (mi.methodName.equals("*")) {
-            Method[] mthds = intrface.getMethods();
-            for (int i = 0; i < mthds.length; i++)
-                methods.add(mthds[i]);
-        } else if (mi.methodParams != null) {// there are paramters specified
-            try {
-                List<Class> params = new ArrayList<Class>();
-                ClassLoader cl = intrface.getClassLoader();
-                for (String methodParam : mi.methodParams) {
-                    try {
-                        params.add(getClassForParam(methodParam, cl));
-                    } catch (ClassNotFoundException cnfe) {
-
-                    }
-                }
-                Method m = intrface.getMethod(mi.methodName, params.toArray(new Class[params.size()]));
-                methods.add(m);
-            } catch (NoSuchMethodException nsme) {
-                /*
-                Do nothing.  Exceptions are not only possible they are expected to be a part of normall processing.
-                Normally exception handling should not be a part of business logic, but server start up doesn't need to be
-                as peformant as server runtime, so its allowed.
-                */
-            }
-        } else {// no paramters specified so may be several methods
-            Method[] ms = intrface.getMethods();
-            for (int i = 0; i < ms.length; i++) {
-                if (ms[i].getName().equals(mi.methodName))
-                    methods.add(ms[i]);
-            }
-        }
-
-    }
-
     protected static void checkImplementation(Class intrfce, Class factory, String serviceType, String serviceName) throws OpenEJBException {
         if (!intrfce.isAssignableFrom(factory)) {
             throw new OpenEJBException(messages.format("init.0100", serviceType, serviceName, factory.getName(), intrfce.getName()));
         }
     }
 
-    private static java.lang.Class getClassForParam(java.lang.String className, ClassLoader cl) throws ClassNotFoundException {
-        if (cl == null) {
-            cl = ClassLoader.getSystemClassLoader();
-        }
-
-        if (className.equals("int")) {
-            return java.lang.Integer.TYPE;
-        } else if (className.equals("double")) {
-            return java.lang.Double.TYPE;
-        } else if (className.equals("long")) {
-            return java.lang.Long.TYPE;
-        } else if (className.equals("boolean")) {
-            return java.lang.Boolean.TYPE;
-        } else if (className.equals("float")) {
-            return java.lang.Float.TYPE;
-        } else if (className.equals("char")) {
-            return java.lang.Character.TYPE;
-        } else if (className.equals("short")) {
-            return java.lang.Short.TYPE;
-        } else if (className.equals("byte")) {
-            return java.lang.Byte.TYPE;
-        } else
-            return cl.loadClass(className);
-
-    }
 }

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java Wed Mar 19 20:51:58 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.openejb.assembler.classic;
 
+import static org.apache.openejb.assembler.classic.MethodInfoUtil.matchingMethods;
 import org.apache.openejb.BeanType;
 import org.apache.openejb.Injection;
 import org.apache.openejb.OpenEJBException;
@@ -223,10 +224,10 @@
                     List<Method> finderMethods = new ArrayList<Method>();
 
                     if (home != null) {
-                        AssemblerTool.resolveMethods(finderMethods, home, query.method);
+                        finderMethods.addAll(matchingMethods(query.method, home));
                     }
                     if (localhome != null) {
-                        AssemblerTool.resolveMethods(finderMethods, localhome, query.method);
+                        finderMethods.addAll(matchingMethods(query.method, localhome));
                     }
 
                     for (Method method : finderMethods) {

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfo.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfo.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfo.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodInfo.java Wed Mar 19 20:51:58 2008
@@ -26,4 +26,5 @@
     public String methodIntf;
     public String methodName;
     public List<String> methodParams;
+    public String className;
 }

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodPermissionInfo.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodPermissionInfo.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodPermissionInfo.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodPermissionInfo.java Wed Mar 19 20:51:58 2008
@@ -19,11 +19,10 @@
 import java.util.List;
 import java.util.ArrayList;
 
-public class MethodPermissionInfo extends InfoObject {
+public class MethodPermissionInfo extends MethodAttributeInfo {
 
     public String description;
     public final List<String> roleNames = new ArrayList<String>();
-    public final List<MethodInfo> methods = new ArrayList<MethodInfo>();
     public boolean unchecked;
 
 }

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionBuilder.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionBuilder.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionBuilder.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionBuilder.java Wed Mar 19 20:51:58 2008
@@ -16,15 +16,18 @@
  */
 package org.apache.openejb.assembler.classic;
 
+import static org.apache.openejb.assembler.classic.MethodInfoUtil.resolveAttributes;
 import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.util.Logger;
+import org.apache.openejb.util.LogCategory;
 
-import java.util.Comparator;
 import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.lang.reflect.Method;
 
 /**
@@ -32,89 +35,26 @@
  */
 public class MethodTransactionBuilder {
 
+    public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, MethodTransactionBuilder.class);
+
     public void build(HashMap<String, DeploymentInfo> deployments, List<MethodTransactionInfo> methodTransactions) throws OpenEJBException {
         for (DeploymentInfo deploymentInfo : deployments.values()) {
             applyTransactionAttributes((CoreDeploymentInfo) deploymentInfo, methodTransactions);
         }
     }
 
-    public static void applyTransactionAttributes(CoreDeploymentInfo deploymentInfo, List<MethodTransactionInfo> mtis) throws OpenEJBException {
-        /*TODO: Add better exception handling.  This method doesn't throws any exceptions!!
-        there is a lot of complex code here, I'm sure something could go wrong the user
-        might want to know about.
-        */
-
-        mtis = normalize(mtis);
-
-        for (MethodTransactionInfo transInfo : mtis) {
-            for (MethodInfo methodInfo : transInfo.methods) {
-
-                if (methodInfo.ejbDeploymentId == null || methodInfo.ejbDeploymentId.equals(deploymentInfo.getDeploymentID())) {
-                    if (!deploymentInfo.isBeanManagedTransaction()) {
-
-                        List<Method> methods = new ArrayList<Method>();
-
-                        if (methodInfo.methodIntf == null) {
-                            AssemblerTool.resolveMethods(methods, deploymentInfo.getBeanClass(), methodInfo);
-                            if (deploymentInfo.getRemoteInterface() != null) {
-                                AssemblerTool.resolveMethods(methods, deploymentInfo.getRemoteInterface(), methodInfo);
-                            }
-                            if (deploymentInfo.getHomeInterface() != null) {
-                                AssemblerTool.resolveMethods(methods, deploymentInfo.getHomeInterface(), methodInfo);
-                            }
-                            if (deploymentInfo.getLocalInterface() != null) {
-                                AssemblerTool.resolveMethods(methods, deploymentInfo.getLocalInterface(), methodInfo);
-                            }
-                            if (deploymentInfo.getLocalHomeInterface() != null) {
-                                AssemblerTool.resolveMethods(methods, deploymentInfo.getLocalHomeInterface(), methodInfo);
-                            }
-                            if(deploymentInfo.getMdbInterface() != null) {
-                                AssemblerTool.resolveMethods(methods, deploymentInfo.getMdbInterface(), methodInfo);
-                            }
-                            if(deploymentInfo.getServiceEndpointInterface() != null) {
-                                AssemblerTool.resolveMethods(methods, deploymentInfo.getServiceEndpointInterface(), methodInfo);
-                            }
-                            for (Class intf : deploymentInfo.getBusinessRemoteInterfaces()) {
-                                AssemblerTool.resolveMethods(methods, intf, methodInfo);
-                            }
-                            for (Class intf : deploymentInfo.getBusinessLocalInterfaces()) {
-                                AssemblerTool.resolveMethods(methods, intf, methodInfo);
-                            }
-                        } else if (methodInfo.methodIntf.equals("Home")) {
-                            AssemblerTool.resolveMethods(methods, deploymentInfo.getHomeInterface(), methodInfo);
-                        } else if (methodInfo.methodIntf.equals("Remote")) {
-                            AssemblerTool.resolveMethods(methods, deploymentInfo.getRemoteInterface(), methodInfo);
-                            for (Class intf : deploymentInfo.getBusinessRemoteInterfaces()) {
-                                AssemblerTool.resolveMethods(methods, intf, methodInfo);
-                            }
-                        } else if (methodInfo.methodIntf.equals("LocalHome")) {
-                            AssemblerTool.resolveMethods(methods, deploymentInfo.getLocalHomeInterface(), methodInfo);
-                        } else if (methodInfo.methodIntf.equals("Local")) {
-                            AssemblerTool.resolveMethods(methods, deploymentInfo.getLocalInterface(), methodInfo);
-                            for (Class intf : deploymentInfo.getBusinessRemoteInterfaces()) {
-                                AssemblerTool.resolveMethods(methods, intf, methodInfo);
-                            }
-                        } else if (methodInfo.methodIntf.equals("ServiceEndpoint")) {
-                            AssemblerTool.resolveMethods(methods, deploymentInfo.getServiceEndpointInterface(), methodInfo);
-                        }
-
-                        for (Method method : methods) {
-                            if ((method.getDeclaringClass() == javax.ejb.EJBObject.class ||
-                                    method.getDeclaringClass() == javax.ejb.EJBHome.class) &&
-                                    !method.getName().equals("remove")) {
-                                continue;
-                            }
-                            deploymentInfo.setMethodTransactionAttribute(method, transInfo.transAttribute);
-                        }
-                    }
-                }
-            }
-        }
+    public static void applyTransactionAttributes(CoreDeploymentInfo deploymentInfo, List<MethodTransactionInfo> methodTransactionInfos) throws OpenEJBException {
 
-    }
+        methodTransactionInfos = normalize(methodTransactionInfos);
+
+        Map<Method, MethodAttributeInfo> attributes = resolveAttributes(methodTransactionInfos, deploymentInfo);
 
-    public static enum Level {
-        PACKAGE, CLASS, OVERLOADED_METHOD, EXACT_METHOD
+        for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
+            MethodTransactionInfo value = (MethodTransactionInfo) entry.getValue();
+
+//            logger.info(entry.getKey().toString() +"  "+ value.transAttribute);
+            deploymentInfo.setMethodTransactionAttribute(entry.getKey(), value.transAttribute);
+        }
     }
 
     /**
@@ -141,26 +81,15 @@
             }
         }
 
+        Collections.reverse(normalized);
         Collections.sort(normalized, new MethodTransactionComparator());
 
         return normalized;
     }
 
-    public static class MethodTransactionComparator implements Comparator<MethodTransactionInfo> {
+    public static class MethodTransactionComparator extends MethodInfoUtil.BaseComparator<MethodTransactionInfo> {
         public int compare(MethodTransactionInfo a, MethodTransactionInfo b) {
-            Level levelA = level(a);
-            Level levelB = level(b);
-
-            return levelA.ordinal() - levelB.ordinal();
+            return compare(a.methods.get(0), b.methods.get(0));
         }
     }
-
-    private static Level level(MethodTransactionInfo info) {
-        MethodInfo methodInfo = info.methods.get(0);
-        if (methodInfo.ejbName.equals("*")) return Level.PACKAGE;
-        if (methodInfo.methodName == null || methodInfo.methodName.equals("*")) return Level.CLASS;
-        if (methodInfo.methodParams == null) return Level.OVERLOADED_METHOD;
-        return Level.EXACT_METHOD;
-    }
-
 }

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionInfo.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionInfo.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionInfo.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/MethodTransactionInfo.java Wed Mar 19 20:51:58 2008
@@ -16,13 +16,9 @@
  */
 package org.apache.openejb.assembler.classic;
 
-import java.util.List;
-import java.util.ArrayList;
-
-public class MethodTransactionInfo extends InfoObject {
+public class MethodTransactionInfo extends MethodAttributeInfo {
 
     public String description;
     public String transAttribute;
-    public final List<MethodInfo> methods = new ArrayList<MethodInfo>();
 
 }

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java Wed Mar 19 20:51:58 2008
@@ -407,10 +407,17 @@
         EjbDeployment d = (EjbDeployment) ejbds.get(method.getEjbName());
 
         methodInfo.description = method.getDescription();
-        methodInfo.ejbDeploymentId = d.getDeploymentId();
+        methodInfo.ejbDeploymentId = (d == null)?null:d.getDeploymentId();
         methodInfo.ejbName = method.getEjbName();
         methodInfo.methodIntf = (method.getMethodIntf() == null) ? null : method.getMethodIntf().toString();
         methodInfo.methodName = method.getMethodName();
+        if (methodInfo.methodName == null || methodInfo.methodName.equals("")){
+            methodInfo.methodName = "*";
+        }
+        methodInfo.className = method.getClassName();
+        if (methodInfo.className == null || methodInfo.className.equals("")){
+            methodInfo.className = "*";
+        }
 
         MethodParams mp = method.getMethodParams();
         if (mp != null) {
@@ -611,6 +618,9 @@
                 query.queryStatement = q.getEjbQl().trim();
 
                 MethodInfo method = new MethodInfo();
+                method.ejbName = bean.ejbName;
+                method.className = "*";
+
                 QueryMethod qm = q.getQueryMethod();
                 method.methodName = qm.getMethodName();
                 if (qm.getMethodParams() != null) {
@@ -630,6 +640,8 @@
                 query.queryStatement = q.getObjectQl().trim();
 
                 MethodInfo method = new MethodInfo();
+                method.ejbName = bean.ejbName;
+                method.className = "*";
                 org.apache.openejb.jee.oejb3.QueryMethod qm = q.getQueryMethod();
                 method.methodName = qm.getMethodName();
                 if (qm.getMethodParams() != null) {

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAssemblyBindings.java Wed Mar 19 20:51:58 2008
@@ -62,6 +62,7 @@
             for (Method method : permission.getMethod()) {
                 if (method.getEjbName() == null) {
                     fail("MethodPermission", "methodPermission.ejbNameRequired", method.getMethodName(), join(",", permission.getRoleName()));
+                } else if (method.getEjbName().equals("*")){
                 } else if (!ejbsByName.containsKey(method.getEjbName())){
                     fail("MethodPermission", "methodPermission.noSuchEjbName", method.getEjbName(), method.getMethodName(), join(",", permission.getRoleName()));
                 }
@@ -72,6 +73,7 @@
             for (Method method : transaction.getMethod()) {
                 if (method.getEjbName() == null) {
                     fail("ContainerTransaction", "containerTransaction.ejbNameRequired", method.getMethodName(), transaction.getTransAttribute());
+                } else if (method.getEjbName().equals("*")){
                 } else if (!ejbsByName.containsKey(method.getEjbName())){
                     fail("ContainerTransaction", "containerTransaction.noSuchEjbName", method.getEjbName(), method.getMethodName(), transaction.getTransAttribute());
                 }

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java Wed Mar 19 20:51:58 2008
@@ -73,7 +73,7 @@
 
                 check_isEjbClass(b);
                 check_hasDependentClasses(b, b.getEjbClass(), "<ejb-class>");
-//                check_hasInterface(b);
+                check_hasInterface(b);
                 if (b.getHome() != null) {
                     check_hasHomeClass(b);
                     check_hasRemoteClass(b);

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java Wed Mar 19 20:51:58 2008
@@ -361,8 +361,14 @@
     public TransactionPolicy getTransactionPolicy(Method method) {
         TransactionPolicy policy = methodTransactionPolicies.get(method);
         if (policy == null && !isBeanManagedTransaction) {
+            Method beanMethod = getMatchingBeanMethod(method);
+            if (beanMethod != null){
+                policy = methodTransactionPolicies.get(beanMethod);
+            }
+        }
+        if (policy == null && !isBeanManagedTransaction) {
             Logger log = Logger.getInstance(LogCategory.OPENEJB, "org.apache.openejb.util.resources");
-            log.info("The following method doesn't have a transaction policy assigned: " + method);
+            log.debug("The following method doesn't have a transaction policy assigned: " + method);
         }
         if (policy == null && container instanceof TransactionContainer) {
             if (isBeanManagedTransaction) {

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/MethodTransactionInfoComparatorTest.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/MethodTransactionInfoComparatorTest.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/MethodTransactionInfoComparatorTest.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/MethodTransactionInfoComparatorTest.java Wed Mar 19 20:51:58 2008
@@ -39,6 +39,7 @@
         info.transAttribute = "Required";
         method = new MethodInfo();
         method.ejbName = "*";
+        method.className = "*";
         info.methods.add(method);
 
         // Class Interceptors ////////////////////////////////////////////
@@ -46,6 +47,7 @@
         info.transAttribute = "Required";
         method = new MethodInfo();
         method.ejbName = "PingEJB";
+        method.className = "*";
         method.methodName = "*";
         info.methods.add(method);
 
@@ -54,6 +56,7 @@
         info.transAttribute = "Required";
         method = new MethodInfo();
         method.ejbName = "PingEJB";
+        method.className = "*";
         method.methodName = "ping";
         info.methods.add(method);
 
@@ -62,6 +65,7 @@
         info.transAttribute = "Required";
         method = new MethodInfo();
         method.ejbName = "PingEJB";
+        method.className = "*";
         method.methodName = "ping";
         method.methodParams = new ArrayList<String>();
         method.methodParams.add("java.lang.String");

Modified: openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/config/InheritenceTest.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/config/InheritenceTest.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/config/InheritenceTest.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-core/src/test/java/org/apache/openejb/config/InheritenceTest.java Wed Mar 19 20:51:58 2008
@@ -18,23 +18,40 @@
 
 import junit.framework.TestCase;
 import org.apache.openejb.assembler.classic.Assembler;
+import org.apache.openejb.assembler.classic.CallbackInfo;
 import org.apache.openejb.assembler.classic.EjbJarInfo;
+import org.apache.openejb.assembler.classic.EjbLocalReferenceInfo;
+import org.apache.openejb.assembler.classic.EjbReferenceInfo;
+import org.apache.openejb.assembler.classic.EnvEntryInfo;
+import org.apache.openejb.assembler.classic.HandlerChainInfo;
+import org.apache.openejb.assembler.classic.HandlerInfo;
+import org.apache.openejb.assembler.classic.InitMethodInfo;
+import org.apache.openejb.assembler.classic.InjectionInfo;
+import org.apache.openejb.assembler.classic.JndiEncInfo;
+import org.apache.openejb.assembler.classic.NamedMethodInfo;
+import org.apache.openejb.assembler.classic.PersistenceContextReferenceInfo;
+import org.apache.openejb.assembler.classic.PersistenceUnitReferenceInfo;
+import org.apache.openejb.assembler.classic.PortRefInfo;
 import org.apache.openejb.assembler.classic.ProxyFactoryInfo;
+import org.apache.openejb.assembler.classic.ReferenceLocationInfo;
+import org.apache.openejb.assembler.classic.RemoveMethodInfo;
+import org.apache.openejb.assembler.classic.ResourceEnvReferenceInfo;
+import org.apache.openejb.assembler.classic.ResourceReferenceInfo;
+import org.apache.openejb.assembler.classic.SecurityRoleReferenceInfo;
 import org.apache.openejb.assembler.classic.SecurityServiceInfo;
+import org.apache.openejb.assembler.classic.ServiceReferenceInfo;
 import org.apache.openejb.assembler.classic.StatefulBeanInfo;
 import org.apache.openejb.assembler.classic.StatefulSessionContainerInfo;
 import org.apache.openejb.assembler.classic.TransactionServiceInfo;
-import org.apache.openejb.assembler.classic.CallbackInfo;
-import org.apache.openejb.assembler.classic.RemoveMethodInfo;
-import org.apache.openejb.assembler.classic.NamedMethodInfo;
-import org.apache.openejb.assembler.classic.InitMethodInfo;
 import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.jee.StatefulBean;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.annotation.Resource;
+import javax.annotation.security.DeclareRoles;
 import javax.annotation.security.RolesAllowed;
+import javax.annotation.security.RunAs;
 import javax.ejb.CreateException;
 import javax.ejb.EJB;
 import javax.ejb.EJBHome;
@@ -49,26 +66,25 @@
 import javax.ejb.Remote;
 import javax.ejb.RemoteHome;
 import javax.ejb.Remove;
+import javax.ejb.Timeout;
+import javax.ejb.Timer;
 import javax.ejb.TransactionAttribute;
 import javax.ejb.TransactionAttributeType;
 import javax.ejb.TransactionManagement;
 import javax.ejb.TransactionManagementType;
-import javax.sql.DataSource;
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.InvocationContext;
+import javax.jms.Topic;
+import javax.sql.DataSource;
 import java.rmi.RemoteException;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.Comparator;
 
 /**
  * @version $Rev$ $Date$
  */
 public class InheritenceTest extends TestCase {
 
-    public void testNoTest() {
-    }
-
     public void test() throws Exception {
         Assembler assembler = new Assembler();
         ConfigurationFactory config = new ConfigurationFactory();
@@ -87,6 +103,9 @@
         StatefulBeanInfo actual = (StatefulBeanInfo) ejbJarInfo.enterpriseBeans.get(1);
 
 
+        assertEquals("transactionType", expected.transactionType, actual.transactionType);
+        assertEquals("runAs", expected.runAs, actual.runAs);
+
         assertEquals("businessLocal", expected.businessLocal, actual.businessLocal);
         assertEquals("businessRemote", expected.businessRemote, actual.businessRemote);
         assertEquals("local", expected.local, actual.local);
@@ -94,6 +113,8 @@
         assertEquals("remote", expected.remote, actual.remote);
         assertEquals("home", expected.home, actual.home);
 
+        assertEquals("timeout", expected.timeoutMethod, actual.timeoutMethod);
+
         assertCallbackInfos("postActivate", expected.postActivate, actual.postActivate);
         assertCallbackInfos("prePassivate", expected.prePassivate, actual.prePassivate);
 
@@ -104,7 +125,9 @@
         assertRemoveMethodInfos("removeMethods", expected.removeMethods, actual.removeMethods);
         assertInitMethodInfos("initMethods", expected.initMethods, actual.initMethods);
 
+        assertSecurityRoleReferenceInfos("securityRoleReferences", expected.securityRoleReferences, actual.securityRoleReferences);
 
+        assertEquals("jndiEnc", expected.jndiEnc, actual.jndiEnc);
     }
 
     @Local
@@ -139,6 +162,8 @@
     @EJB(name = "colorClassEjb", beanInterface = ColorLocal.class)
     @Resource(name = "colorClassResource", type = DataSource.class)
     @RolesAllowed({"ColorManager"})
+    @DeclareRoles({"ColorGuy", "ColorGal"})
+    @RunAs("ColorManager")
     @TransactionManagement(TransactionManagementType.BEAN)
     @TransactionAttribute(TransactionAttributeType.MANDATORY)
     @Local({ColorLocal2.class})
@@ -153,6 +178,9 @@
         @Resource
         private DataSource colorFieldResource;
 
+        @Resource
+        private Topic colorFieldResourceEnv;
+
         public void methodOne() {
         }
 
@@ -165,6 +193,10 @@
         public void methodFour() {
         }
 
+        @Timeout
+        public void colorTimeout(Timer timer) {
+        }
+
         @AroundInvoke
         public Object invoke(InvocationContext context) throws Exception {
             return null;
@@ -202,89 +234,613 @@
     }
 
 
-
     // ------------------------------------------------------------------------------------------------------
     //
     //     Assert methods
     //
     // ------------------------------------------------------------------------------------------------------
 
+    public static void assertEquals(String m, JndiEncInfo a, JndiEncInfo b) {
+        assertTrue(m, equals(a, b));
+    }
 
-    public void assertCallbackInfos(String s, List<CallbackInfo> expected, List<CallbackInfo> actual){
-        assertTrue(s, compare(expected, actual, new Comparator<CallbackInfo>(){
-            public int compare(CallbackInfo a, CallbackInfo b) {
-                if (a.className != null ? !a.className.equals(b.className) : b.className != null) return -1;
-                if (a.method != null ? !a.method.equals(b.method) : b.method != null) return -1;
-                return 0;
-            }
-        }));
+    public static boolean equals(JndiEncInfo a, JndiEncInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (!equalsEnvEntryInfos(a.envEntries, b.envEntries)) return false;
+        if (!equalsEjbReferenceInfos(a.ejbReferences, b.ejbReferences)) return false;
+        if (!equalsEjbLocalReferenceInfos(a.ejbLocalReferences, b.ejbLocalReferences)) return false;
+        if (!equalsResourceReferenceInfos(a.resourceRefs, b.resourceRefs)) return false;
+        if (!equalsPersistenceUnitReferenceInfos(a.persistenceUnitRefs, b.persistenceUnitRefs)) return false;
+        if (!equalsPersistenceContextReferenceInfos(a.persistenceContextRefs, b.persistenceContextRefs)) return false;
+        if (!equalsResourceEnvReferenceInfos(a.resourceEnvRefs, b.resourceEnvRefs)) return false;
+        if (!equalsServiceReferenceInfos(a.serviceRefs, b.serviceRefs)) return false;
+
+        return true;
     }
 
-    public void assertRemoveMethodInfos(String s, List<RemoveMethodInfo> expected, List<RemoveMethodInfo> actual){
-        assertTrue(s, compare(expected, actual, new Comparator<RemoveMethodInfo>(){
-            public int compare(RemoveMethodInfo a, RemoveMethodInfo b) {
-                if (a.retainIfException != b.retainIfException) return -1;
-
-                NamedMethodInfo am = a.beanMethod;
-                NamedMethodInfo bm = b.beanMethod;
-
-                if (am != bm){
-                    if (am == null || bm == null) return -1;
-                    if (am.id != null ? !am.id.equals(bm.id) : bm.id != null) return -1;
-                    if (am.methodName != null ? !am.methodName.equals(bm.methodName) : bm.methodName != null) return -1;
-                    if (am.methodParams != null ? !am.methodParams.equals(bm.methodParams) : bm.methodParams != null) return -1;
-                }
-                return 0;
-            }
-        }));
+    // -- ReferenceLocationInfo --------------------------------//
+
+    public static void assertReferenceLocationInfos(String s, List<ReferenceLocationInfo> expected, List<ReferenceLocationInfo> actual) {
+        assertTrue(s, equalsReferenceLocationInfos(expected, actual));
     }
 
-    public void assertInitMethodInfos(String s, List<InitMethodInfo> expected, List<InitMethodInfo> actual){
-        assertTrue(s, compare(expected, actual, new Comparator<InitMethodInfo>(){
-            public int compare(InitMethodInfo a, InitMethodInfo b) {
-
-                {
-                    NamedMethodInfo am = a.beanMethod;
-                    NamedMethodInfo bm = b.beanMethod;
-
-                    if (am != bm){
-                        if (am == null || bm == null) return -1;
-                        if (am.id != null ? !am.id.equals(bm.id) : bm.id != null) return -1;
-                        if (am.methodName != null ? !am.methodName.equals(bm.methodName) : bm.methodName != null) return -1;
-                        if (am.methodParams != null ? !am.methodParams.equals(bm.methodParams) : bm.methodParams != null) return -1;
-                    }
-                }
+    public static boolean equalsReferenceLocationInfos(List<ReferenceLocationInfo> expected, List<ReferenceLocationInfo> actual) {
+        return new ReferenceLocationInfoComparator().compare(expected, actual);
+    }
 
-                {
-                    NamedMethodInfo am = a.createMethod;
-                    NamedMethodInfo bm = b.createMethod;
-
-                    if (am != bm){
-                        if (am == null || bm == null) return -1;
-                        if (am.id != null ? !am.id.equals(bm.id) : bm.id != null) return -1;
-                        if (am.methodName != null ? !am.methodName.equals(bm.methodName) : bm.methodName != null) return -1;
-                        if (am.methodParams != null ? !am.methodParams.equals(bm.methodParams) : bm.methodParams != null) return -1;
-                    }
-                }
-                return 0;
-            }
-        }));
+    public static class ReferenceLocationInfoComparator extends ListComparator<ReferenceLocationInfo> {
+        public boolean compare(ReferenceLocationInfo a, ReferenceLocationInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
     }
 
+    public static void assertEquals(String m, ReferenceLocationInfo a, ReferenceLocationInfo b) {
+        assertTrue(m, equals(a, b));
+    }
 
-    public boolean compare(List listA, List listB, Comparator comparator) {
-        if (listA == listB) return true;
+    public static boolean equals(ReferenceLocationInfo a, ReferenceLocationInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
 
-        ListIterator iA = listA.listIterator();
-        ListIterator iB = listB.listIterator();
-        while(iA.hasNext() && iB.hasNext()) {
-            Object a = iA.next();
-            Object b = iB.next();
-            if (!(a ==null ? b ==null : comparator.compare(a, b) == 0)){
-                return false;
-            }
+        if (a.jndiName != null ? !a.jndiName.equals(b.jndiName) : b.jndiName != null) return false;
+        if (a.jndiProviderId != null ? !a.jndiProviderId.equals(b.jndiProviderId) : b.jndiProviderId != null)
+            return false;
+
+        return true;
+    }
+
+    // -- EnvEntryInfo --------------------------------//
+
+    public static void assertEnvEntryInfos(String s, List<EnvEntryInfo> expected, List<EnvEntryInfo> actual) {
+        assertTrue(s, equalsEnvEntryInfos(expected, actual));
+    }
+
+    public static boolean equalsEnvEntryInfos(List<EnvEntryInfo> expected, List<EnvEntryInfo> actual) {
+        return new EnvEntryInfoComparator().compare(expected, actual);
+    }
+
+    public static class EnvEntryInfoComparator extends ListComparator<EnvEntryInfo> {
+        public boolean compare(EnvEntryInfo a, EnvEntryInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String m, EnvEntryInfo a, EnvEntryInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(EnvEntryInfo a, EnvEntryInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.name != null ? !a.name.equals(b.name) : b.name != null) return false;
+        if (a.type != null ? !a.type.equals(b.type) : b.type != null) return false;
+        if (a.value != null ? !a.value.equals(b.value) : b.value != null) return false;
+        if (!equals(a.location, b.location)) return false;
+        if (!equalsInjectionInfos(a.targets, b.targets)) return false;
+
+        return true;
+    }
+
+    // -- InjectionInfo --------------------------------//
+
+    public static void assertInjectionInfos(String s, List<InjectionInfo> expected, List<InjectionInfo> actual) {
+        assertTrue(s, equalsInjectionInfos(expected, actual));
+    }
+
+    public static boolean equalsInjectionInfos(List<InjectionInfo> expected, List<InjectionInfo> actual) {
+        return new InjectionInfoComparator().compare(expected, actual);
+    }
+
+    public static class InjectionInfoComparator extends ListComparator<InjectionInfo> {
+        public boolean compare(InjectionInfo a, InjectionInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String s, InjectionInfo a, InjectionInfo b) {
+        assertTrue(s, equals(a, b));
+    }
+
+    public static boolean equals(InjectionInfo a, InjectionInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.propertyName != null ? !a.propertyName.equals(b.propertyName) : b.propertyName != null) return false;
+        if (a.className != null ? !a.className.equals(b.className) : b.className != null) return false;
+
+        return true;
+    }
+
+    // -- EjbReferenceInfo --------------------------------//
+
+    public static void assertEjbReferenceInfos(String s, List<EjbReferenceInfo> expected, List<EjbReferenceInfo> actual) {
+        assertTrue(s, equalsEjbReferenceInfos(expected, actual));
+    }
+
+    public static boolean equalsEjbReferenceInfos(List<EjbReferenceInfo> expected, List<EjbReferenceInfo> actual) {
+        return new EjbReferenceInfoComparator().compare(expected, actual);
+    }
+
+    public static class EjbReferenceInfoComparator extends ListComparator<EjbReferenceInfo> {
+        public boolean compare(EjbReferenceInfo a, EjbReferenceInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String m, EjbReferenceInfo a, EjbReferenceInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(EjbReferenceInfo a, EjbReferenceInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.referenceName != null ? !a.referenceName.equals(b.referenceName) : b.referenceName != null) return false;
+        if (a.homeType != null ? !a.homeType.equals(b.homeType) : b.homeType != null) return false;
+        if (a.interfaceType != null ? !a.interfaceType.equals(b.interfaceType) : b.interfaceType != null) return false;
+        if (a.ejbDeploymentId != null ? !a.ejbDeploymentId.equals(b.ejbDeploymentId) : b.ejbDeploymentId != null)
+            return false;
+        if (a.link != null ? !a.link.equals(b.link) : b.link != null) return false;
+        if (a.externalReference != b.externalReference) return false;
+        if (!equals(a.location, b.location)) return false;
+        if (!equalsInjectionInfos(a.targets, b.targets)) return false;
+
+        return true;
+    }
+
+    // -- EjbLocalReferenceInfo --------------------------------//
+
+    public static void assertEjbLocalReferenceInfos(String s, List<EjbLocalReferenceInfo> expected, List<EjbLocalReferenceInfo> actual) {
+        assertTrue(s, equalsEjbLocalReferenceInfos(expected, actual));
+    }
+
+    public static boolean equalsEjbLocalReferenceInfos(List<EjbLocalReferenceInfo> expected, List<EjbLocalReferenceInfo> actual) {
+        return new EjbLocalReferenceInfoComparator().compare(expected, actual);
+    }
+
+    public static class EjbLocalReferenceInfoComparator extends ListComparator<EjbLocalReferenceInfo> {
+        public boolean compare(EjbLocalReferenceInfo a, EjbLocalReferenceInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    // -- ResourceReferenceInfo --------------------------------//
+
+    public static void assertResourceReferenceInfos(String s, List<ResourceReferenceInfo> expected, List<ResourceReferenceInfo> actual) {
+        assertTrue(s, equalsResourceReferenceInfos(expected, actual));
+    }
+
+    public static boolean equalsResourceReferenceInfos(List<ResourceReferenceInfo> expected, List<ResourceReferenceInfo> actual) {
+        return new ResourceReferenceInfoComparator().compare(expected, actual);
+    }
+
+    public static class ResourceReferenceInfoComparator extends ListComparator<ResourceReferenceInfo> {
+        public boolean compare(ResourceReferenceInfo a, ResourceReferenceInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String m, ResourceReferenceInfo a, ResourceReferenceInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(ResourceReferenceInfo a, ResourceReferenceInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.referenceName != null ? !a.referenceName.equals(b.referenceName) : b.referenceName != null) return false;
+        if (a.referenceType != null ? !a.referenceType.equals(b.referenceType) : b.referenceType != null) return false;
+        if (a.referenceAuth != null ? !a.referenceAuth.equals(b.referenceAuth) : b.referenceAuth != null) return false;
+        if (a.resourceID != null ? !a.resourceID.equals(b.resourceID) : b.resourceID != null) return false;
+        if (a.properties != null ? !a.properties.equals(b.properties) : b.properties != null) return false;
+        if (!equals(a.location, b.location)) return false;
+        if (!equalsInjectionInfos(a.targets, b.targets)) return false;
+
+        return true;
+    }
+
+    // -- PersistenceUnitReferenceInfo --------------------------------//
+
+    public static void assertPersistenceUnitReferenceInfos(String s, List<PersistenceUnitReferenceInfo> expected, List<PersistenceUnitReferenceInfo> actual) {
+        assertTrue(s, equalsPersistenceUnitReferenceInfos(expected, actual));
+    }
+
+    public static boolean equalsPersistenceUnitReferenceInfos(List<PersistenceUnitReferenceInfo> expected, List<PersistenceUnitReferenceInfo> actual) {
+        return new PersistenceUnitReferenceInfoComparator().compare(expected, actual);
+    }
+
+    public static class PersistenceUnitReferenceInfoComparator extends ListComparator<PersistenceUnitReferenceInfo> {
+        public boolean compare(PersistenceUnitReferenceInfo a, PersistenceUnitReferenceInfo b) {
+            return InheritenceTest.equals(a, b);
         }
-        return !(iA.hasNext() || iB.hasNext());
     }
 
+    public static void assertEquals(String m, PersistenceUnitReferenceInfo a, PersistenceUnitReferenceInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(PersistenceUnitReferenceInfo a, PersistenceUnitReferenceInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.referenceName != null ? !a.referenceName.equals(b.referenceName) : b.referenceName != null) return false;
+        if (a.persistenceUnitName != null ? !a.persistenceUnitName.equals(b.persistenceUnitName) : b.persistenceUnitName != null)
+            return false;
+        if (a.unitId != null ? !a.unitId.equals(b.unitId) : b.unitId != null) return false;
+        if (!equals(a.location, b.location)) return false;
+        if (!equalsInjectionInfos(a.targets, b.targets)) return false;
+
+        return true;
+    }
+
+    // -- PersistenceContextReferenceInfo --------------------------------//
+
+    public static void assertPersistenceContextReferenceInfos(String s, List<PersistenceContextReferenceInfo> expected, List<PersistenceContextReferenceInfo> actual) {
+        assertTrue(s, equalsPersistenceContextReferenceInfos(expected, actual));
+    }
+
+    public static boolean equalsPersistenceContextReferenceInfos(List<PersistenceContextReferenceInfo> expected, List<PersistenceContextReferenceInfo> actual) {
+        return new PersistenceContextReferenceInfoComparator().compare(expected, actual);
+    }
+
+    public static class PersistenceContextReferenceInfoComparator extends ListComparator<PersistenceContextReferenceInfo> {
+        public boolean compare(PersistenceContextReferenceInfo a, PersistenceContextReferenceInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String m, PersistenceContextReferenceInfo a, PersistenceContextReferenceInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(PersistenceContextReferenceInfo a, PersistenceContextReferenceInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.referenceName != null ? !a.referenceName.equals(b.referenceName) : b.referenceName != null) return false;
+        if (a.persistenceUnitName != null ? !a.persistenceUnitName.equals(b.persistenceUnitName) : b.persistenceUnitName != null)
+            return false;
+        if (a.unitId != null ? !a.unitId.equals(b.unitId) : b.unitId != null) return false;
+        if (a.extended != b.extended) return false;
+        if (a.properties != null ? !a.properties.equals(b.properties) : b.properties != null) return false;
+        if (!equals(a.location, b.location)) return false;
+        if (!equalsInjectionInfos(a.targets, b.targets)) return false;
+
+        return true;
+    }
+
+    // -- ResourceEnvReferenceInfo --------------------------------//
+
+    public static void assertResourceEnvReferenceInfos(String s, List<ResourceEnvReferenceInfo> expected, List<ResourceEnvReferenceInfo> actual) {
+        assertTrue(s, equalsResourceEnvReferenceInfos(expected, actual));
+    }
+
+    public static boolean equalsResourceEnvReferenceInfos(List<ResourceEnvReferenceInfo> expected, List<ResourceEnvReferenceInfo> actual) {
+        return new ResourceEnvReferenceInfoComparator().compare(expected, actual);
+    }
+
+    public static class ResourceEnvReferenceInfoComparator extends ListComparator<ResourceEnvReferenceInfo> {
+        public boolean compare(ResourceEnvReferenceInfo a, ResourceEnvReferenceInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String m, ResourceEnvReferenceInfo a, ResourceEnvReferenceInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(ResourceEnvReferenceInfo a, ResourceEnvReferenceInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.resourceEnvRefName != null ? !a.resourceEnvRefName.equals(b.resourceEnvRefName) : b.resourceEnvRefName != null)
+            return false;
+        if (a.resourceEnvRefType != null ? !a.resourceEnvRefType.equals(b.resourceEnvRefType) : b.resourceEnvRefType != null)
+            return false;
+        if (a.mappedName != null ? !a.mappedName.equals(b.mappedName) : b.mappedName != null) return false;
+        if (a.resourceID != null ? !a.resourceID.equals(b.resourceID) : b.resourceID != null) return false;
+        if (!equals(a.location, b.location)) return false;
+        if (!equalsInjectionInfos(a.targets, b.targets)) return false;
+
+        return true;
+    }
+
+    // -- ServiceReferenceInfo --------------------------------//
+
+    public static void assertServiceReferenceInfos(String s, List<ServiceReferenceInfo> expected, List<ServiceReferenceInfo> actual) {
+        assertTrue(s, equalsServiceReferenceInfos(expected, actual));
+    }
+
+    public static boolean equalsServiceReferenceInfos(List<ServiceReferenceInfo> expected, List<ServiceReferenceInfo> actual) {
+        return new ServiceReferenceInfoComparator().compare(expected, actual);
+    }
+
+    public static class ServiceReferenceInfoComparator extends ListComparator<ServiceReferenceInfo> {
+        public boolean compare(ServiceReferenceInfo a, ServiceReferenceInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+
+    public static void assertEquals(String m, ServiceReferenceInfo a, ServiceReferenceInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(ServiceReferenceInfo a, ServiceReferenceInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.referenceName != null ? !a.referenceName.equals(b.referenceName) : b.referenceName != null) return false;
+        if (a.serviceQName != null ? !a.serviceQName.equals(b.serviceQName) : b.serviceQName != null) return false;
+        if (a.serviceType != null ? !a.serviceType.equals(b.serviceType) : b.serviceType != null) return false;
+        if (a.portQName != null ? !a.portQName.equals(b.portQName) : b.portQName != null) return false;
+        if (a.referenceType != null ? !a.referenceType.equals(b.referenceType) : b.referenceType != null) return false;
+        if (a.wsdlFile != null ? !a.wsdlFile.equals(b.wsdlFile) : b.wsdlFile != null) return false;
+        if (a.jaxrpcMappingFile != null ? !a.jaxrpcMappingFile.equals(b.jaxrpcMappingFile) : b.jaxrpcMappingFile != null)
+            return false;
+        if (a.id != null ? !a.id.equals(b.id) : b.id != null) return false;
+        if (!equalsHandlerChainInfos(a.handlerChains, b.handlerChains)) return false;
+        if (!equalsPortRefInfos(a.portRefs, b.portRefs)) return false;
+        if (!equals(a.location, b.location)) return false;
+        if (!equalsInjectionInfos(a.targets, b.targets)) return false;
+
+        return true;
+    }
+
+    // -- HandlerChainInfo --------------------------------//
+
+    public static void assertHandlerChainInfos(String s, List<HandlerChainInfo> expected, List<HandlerChainInfo> actual) {
+        assertTrue(s, equalsHandlerChainInfos(expected, actual));
+    }
+
+    public static boolean equalsHandlerChainInfos(List<HandlerChainInfo> expected, List<HandlerChainInfo> actual) {
+        return new HandlerChainInfoComparator().compare(expected, actual);
+    }
+
+    public static class HandlerChainInfoComparator extends ListComparator<HandlerChainInfo> {
+        public boolean compare(HandlerChainInfo a, HandlerChainInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String s, HandlerChainInfo a, HandlerChainInfo b) {
+        assertTrue(s, equals(a, b));
+    }
+
+    public static boolean equals(HandlerChainInfo a, HandlerChainInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.serviceNamePattern != null ? !a.serviceNamePattern.equals(b.serviceNamePattern) : b.serviceNamePattern != null)
+            return false;
+        if (a.portNamePattern != null ? !a.portNamePattern.equals(b.portNamePattern) : b.portNamePattern != null)
+            return false;
+        if (a.protocolBindings != null ? !a.protocolBindings.equals(b.protocolBindings) : b.protocolBindings != null)
+            return false;
+        if (!equalsHandlerInfos(a.handlers, b.handlers)) return false;
+
+        return true;
+    }
+
+    // -- HandlerInfo --------------------------------//
+
+    public static void assertHandlerInfos(String s, List<HandlerInfo> expected, List<HandlerInfo> actual) {
+        assertTrue(s, equalsHandlerInfos(expected, actual));
+    }
+
+    public static boolean equalsHandlerInfos(List<HandlerInfo> expected, List<HandlerInfo> actual) {
+        return new HandlerInfoComparator().compare(expected, actual);
+    }
+
+    public static class HandlerInfoComparator extends ListComparator<HandlerInfo> {
+        public boolean compare(HandlerInfo a, HandlerInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String s, HandlerInfo a, HandlerInfo b) {
+        assertTrue(s, equals(a, b));
+    }
+
+    public static boolean equals(HandlerInfo a, HandlerInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.handlerClass != null ? !a.handlerClass.equals(b.handlerClass) : b.handlerClass != null) return false;
+        if (a.handlerName != null ? !a.handlerName.equals(b.handlerName) : b.handlerName != null) return false;
+        if (a.initParams != null ? !a.initParams.equals(b.initParams) : b.initParams != null) return false;
+        if (a.soapHeaders != null ? !a.soapHeaders.equals(b.soapHeaders) : b.soapHeaders != null) return false;
+        if (a.soapRoles != null ? !a.soapRoles.equals(b.soapRoles) : b.soapRoles != null) return false;
+
+        return true;
+    }
+
+    // -- PortRefInfo --------------------------------//
+
+    public static void assertPortRefInfos(String s, List<PortRefInfo> expected, List<PortRefInfo> actual) {
+        assertTrue(s, equalsPortRefInfos(expected, actual));
+    }
+
+    public static boolean equalsPortRefInfos(List<PortRefInfo> expected, List<PortRefInfo> actual) {
+        return new PortRefInfoComparator().compare(expected, actual);
+    }
+
+    public static class PortRefInfoComparator extends ListComparator<PortRefInfo> {
+        public boolean compare(PortRefInfo a, PortRefInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String s, PortRefInfo a, PortRefInfo b) {
+        assertTrue(s, equals(a, b));
+    }
+
+    public static boolean equals(PortRefInfo a, PortRefInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.qname != null ? !a.qname.equals(b.qname) : b.qname != null) return false;
+        if (a.serviceEndpointInterface != null ? !a.serviceEndpointInterface.equals(b.serviceEndpointInterface) : b.serviceEndpointInterface != null)
+            return false;
+        if (a.properties != null ? !a.properties.equals(b.properties) : b.properties != null) return false;
+        if (a.enableMtom != b.enableMtom) return false;
+
+        return true;
+    }
+
+    // -- CallbackInfo --------------------------------//
+
+    public static void assertCallbackInfos(String s, List<CallbackInfo> expected, List<CallbackInfo> actual) {
+        assertTrue(s, equalsCallbackInfos(expected, actual));
+    }
+
+    public static boolean equalsCallbackInfos(List<CallbackInfo> expected, List<CallbackInfo> actual) {
+        return new CallbackInfoComparator().compare(expected, actual);
+    }
+
+    public static class CallbackInfoComparator extends ListComparator<CallbackInfo> {
+        public boolean compare(CallbackInfo a, CallbackInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+
+    public static void assertEquals(String m, CallbackInfo a, CallbackInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(CallbackInfo a, CallbackInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+        if (a.className != null ? !a.className.equals(b.className) : b.className != null) return false;
+        if (a.method != null ? !a.method.equals(b.method) : b.method != null) return false;
+        return true;
+    }
+
+    // -- SecurityRoleReferenceInfo --------------------------------//
+
+    public static void assertSecurityRoleReferenceInfos(String s, List<SecurityRoleReferenceInfo> expected, List<SecurityRoleReferenceInfo> actual) {
+        assertTrue(s, equalsSecurityRoleReferenceInfos(expected, actual));
+    }
+
+    public static boolean equalsSecurityRoleReferenceInfos(List<SecurityRoleReferenceInfo> expected, List<SecurityRoleReferenceInfo> actual) {
+        return new SecurityRoleReferenceInfoComparator().compare(expected, actual);
+    }
+
+    public static class SecurityRoleReferenceInfoComparator extends ListComparator<SecurityRoleReferenceInfo> {
+        public boolean compare(SecurityRoleReferenceInfo a, SecurityRoleReferenceInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String m, SecurityRoleReferenceInfo a, SecurityRoleReferenceInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(SecurityRoleReferenceInfo a, SecurityRoleReferenceInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.roleName != null ? !a.roleName.equals(b.roleName) : b.roleName != null) return false;
+        if (a.roleLink != null ? !a.roleLink.equals(b.roleLink) : b.roleLink != null) return false;
+        return true;
+    }
+
+    // -- RemoveMethodInfo --------------------------------//
+
+    public static void assertRemoveMethodInfos(String s, List<RemoveMethodInfo> expected, List<RemoveMethodInfo> actual) {
+        assertTrue(s, equalsRemoveMethodInfos(expected, actual));
+    }
+
+    public static boolean equalsRemoveMethodInfos(List<RemoveMethodInfo> expected, List<RemoveMethodInfo> actual) {
+        return new RemoveMethodInfoComparator().compare(expected, actual);
+    }
+
+    public static class RemoveMethodInfoComparator extends ListComparator<RemoveMethodInfo> {
+        public boolean compare(RemoveMethodInfo a, RemoveMethodInfo b) {
+            return InheritenceTest.equals(a, b);
+        }
+    }
+
+    public static void assertEquals(String m, RemoveMethodInfo a, RemoveMethodInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(RemoveMethodInfo a, RemoveMethodInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.retainIfException != b.retainIfException) return false;
+
+        return equals(a.beanMethod, b.beanMethod);
+    }
+
+    public static void assertInitMethodInfos(final String s, List<InitMethodInfo> expected, List<InitMethodInfo> actual) {
+        assertTrue(s, equalsInitMethodInfos(expected, actual));
+    }
+
+    public static boolean equalsInitMethodInfos(List<InitMethodInfo> expected, List<InitMethodInfo> actual) {
+        return new InitMethodInfoComparator().compare(expected, actual);
+    }
+
+    public static class InitMethodInfoComparator extends ListComparator<InitMethodInfo> {
+        public boolean compare(InitMethodInfo o1, InitMethodInfo o2) {
+            return InheritenceTest.equals(o1, o2);
+        }
+    }
+
+    public static void assertEquals(String m, InitMethodInfo a, InitMethodInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(InitMethodInfo a, InitMethodInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (!equals(a.beanMethod, b.beanMethod)) return false;
+        if (!equals(a.createMethod, b.createMethod)) return false;
+        return true;
+    }
+
+    public static void assertEquals(String m, NamedMethodInfo a, NamedMethodInfo b) {
+        assertTrue(m, equals(a, b));
+    }
+
+    public static boolean equals(NamedMethodInfo a, NamedMethodInfo b) {
+        if (a == null && b == null) return true;
+        if (a == null || b == null) return false;
+
+        if (a.id != null ? !a.id.equals(b.id) : b.id != null) return false;
+        if (a.methodName != null ? !a.methodName.equals(b.methodName) : b.methodName != null) return false;
+        if (a.methodParams != null ? !a.methodParams.equals(b.methodParams) : b.methodParams != null) return false;
+        return true;
+    }
+
+    public static void assertList(final String s, List expected, List actual, ListComparator comparator) {
+        assertTrue(s, comparator.compare(expected, actual));
+    }
+
+    public static abstract class ListComparator<T> {
+
+        public boolean compare(List<T> listA, List<T> listB) {
+            if (listA == listB) return true;
+
+            ListIterator iA = listA.listIterator();
+            ListIterator iB = listB.listIterator();
+            while (iA.hasNext() && iB.hasNext()) {
+                T a = (T) iA.next();
+                T b = (T) iB.next();
+                if (!(a == null ? b == null : compare(a, b))) {
+                    return false;
+                }
+            }
+            return !(iA.hasNext() || iB.hasNext());
+        }
+
+        public abstract boolean compare(T o1, T o2);
+
+    }
 }

Modified: openejb/branches/openejb-3.0/container/openejb-jee/src/main/java/org/apache/openejb/jee/Method.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.0/container/openejb-jee/src/main/java/org/apache/openejb/jee/Method.java?rev=639149&r1=639148&r2=639149&view=diff
==============================================================================
--- openejb/branches/openejb-3.0/container/openejb-jee/src/main/java/org/apache/openejb/jee/Method.java (original)
+++ openejb/branches/openejb-3.0/container/openejb-jee/src/main/java/org/apache/openejb/jee/Method.java Wed Mar 19 20:51:58 2008
@@ -238,6 +238,7 @@
     public Method(String ejbName, java.lang.reflect.Method method) {
         this.ejbName = ejbName;
         this.methodName = method.getName();
+        this.className = method.getDeclaringClass().getName();
         MethodParams methodParams = new MethodParams();
         for (Class<?> type : method.getParameterTypes()) {
             methodParams.getMethodParam().add(type.getCanonicalName());