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 2010/08/26 20:05:11 UTC

svn commit: r989853 - in /openejb/trunk/openejb3/container/openejb-core/src: main/java/org/apache/openejb/ main/java/org/apache/openejb/assembler/classic/ main/java/org/apache/openejb/config/ main/java/org/apache/openejb/core/ test/java/org/apache/open...

Author: dblevins
Date: Thu Aug 26 18:05:10 2010
New Revision: 989853

URL: http://svn.apache.org/viewvc?rev=989853&view=rev
Log:
Rebalanced JNDI name exposure and business interface processing to better account for implied @LocalBean
Removed automatic grouping of non-annotated interfaces as business local interfaces  -- if you want everything you can now use @LocalBean so this is less important
Temporarily commented out the InvalidEjbRefTest as we may not be able to do the 'is this class an exposed @LocalBean' test here exactly.  Really the EjbResolver is the only code that can determine that.

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/OpenEjbContainer.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/AppContext.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/BusinessInterfacesTest.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvalidEjbRefTest.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/OpenEjbContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/OpenEjbContainer.java?rev=989853&r1=989852&r2=989853&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/OpenEjbContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/OpenEjbContainer.java Thu Aug 26 18:05:10 2010
@@ -17,6 +17,7 @@
 package org.apache.openejb;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -84,7 +85,6 @@ public class OpenEjbContainer extends EJ
             String appId = (String) properties.get(EJBContainer.APP_NAME);
             try {
                 Properties props = new Properties();
-                props.put(AnnotationDeployer.ProcessAnnotatedBeans.STRICT_INTERFACE_DECLARATION, Boolean.toString(true));
                 props.put(DeploymentsResolver.DEPLOYMENTS_CLASSPATH_PROPERTY, Boolean.toString(false));
                 //This causes scan of the entire classpath except for default excludes.  This may be quite slow.
                 props.put(DeploymentsResolver.CLASSPATH_INCLUDE, ".*");
@@ -143,30 +143,19 @@ public class OpenEjbContainer extends EJ
                 if (moduleLocations.isEmpty()) {
                     throw new IllegalStateException("No modules to deploy found");
                 }
+
                 AppInfo appInfo = configurationFactory.configureApplication(classLoader, appId, moduleLocations);
 
                 Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
+
+                final AppContext appContext;
+
                 try {
-                    assembler.createApplication(appInfo, classLoader);
+                    appContext = assembler.createApplication(appInfo, classLoader);
                 } catch (Exception e) {
                     throw new IllegalStateException("Could not deploy embedded app", e);
                 }
-                Collection<AppInfo> apps = assembler.getDeployedApplications();
-                if (apps.size() != 1) {
-                    throw new IllegalStateException("not exactly one app deployed in embedded: " + apps.size());
-                }
-                ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
-                AppContext appContext = null;
-                DeploymentInfo[] infos = containerSystem.deployments();
-                for (DeploymentInfo info: infos) {
-                    if (info instanceof CoreDeploymentInfo) {
-                        appContext = ((CoreDeploymentInfo)info).getModuleContext().getAppContext();
-                        break;
-                    }
-                }
-                if (appContext == null) {
-                    throw new IllegalStateException("Could not locate app context");
-                }
+
                 final Context globalJndiContext = appContext.getGlobalJndiContext();
                 return new OpenEjbContainer(new ContextFlyweight() {
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=989853&r1=989852&r2=989853&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java Thu Aug 26 18:05:10 2010
@@ -453,15 +453,15 @@ public class Assembler extends Assembler
         createApplication(appInfo, classLoader);
     }
 
-    public void createApplication(AppInfo appInfo) throws OpenEJBException, IOException, NamingException {
-        createApplication(appInfo, createAppClassLoader(appInfo));
+    public AppContext createApplication(AppInfo appInfo) throws OpenEJBException, IOException, NamingException {
+        return createApplication(appInfo, createAppClassLoader(appInfo));
     }
 
-    public void createApplication(AppInfo appInfo, ClassLoader classLoader) throws OpenEJBException, IOException, NamingException {
-        createApplication(appInfo, classLoader, true);
+    public AppContext createApplication(AppInfo appInfo, ClassLoader classLoader) throws OpenEJBException, IOException, NamingException {
+        return createApplication(appInfo, classLoader, true);
     }
 
-    public List<DeploymentInfo> createApplication(AppInfo appInfo, ClassLoader classLoader, boolean start) throws OpenEJBException, IOException, NamingException {
+    public AppContext createApplication(AppInfo appInfo, ClassLoader classLoader, boolean start) throws OpenEJBException, IOException, NamingException {
         // The path is used in the UrlCache, command line deployer, JNDI name templates, tomcat integration and a few other places 
         if (appInfo.path == null) throw new IllegalArgumentException("AppInfo.path cannot be null");
         if (appInfo.appId == null) throw new IllegalArgumentException("AppInfo.appId cannot be null");
@@ -715,7 +715,9 @@ public class Assembler extends Assembler
             deployedApplications.put(appInfo.path, appInfo);
             fireAfterApplicationCreated(appInfo);
 
-            return allDeployments;
+            appContext.getDeployments().addAll(allDeployments);
+
+            return appContext;
         } catch (Throwable t) {
             try {
                 destroyApplication(appInfo);

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java?rev=989853&r1=989852&r2=989853&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java Thu Aug 26 18:05:10 2010
@@ -309,55 +309,46 @@ public class JndiBuilder {
         Bindings bindings = new Bindings();
         deployment.set(Bindings.class, bindings);
 
-        Reference singleRef = null;
-        int references = 0;
-        
-        Object id = deployment.getDeploymentID();
-        try {
-            Class homeInterface = deployment.getHomeInterface();
-            if (homeInterface != null) {
-
-                ObjectReference ref = new ObjectReference(deployment.getEJBHome());
+        Reference simpleNameRef = null;
 
-                String name = strategy.getName(homeInterface, JndiNameStrategy.Interface.REMOTE_HOME);
-                bind("openejb/local/" + name, ref, bindings, beanInfo, homeInterface);
-                bind("openejb/remote/" + name, ref, bindings, beanInfo, homeInterface);
-
-                name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getRemoteInterface().getName());
-                bind(name, ref, bindings, beanInfo, homeInterface);
+        Object id = deployment.getDeploymentID();
 
-                name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getRemoteInterface().getName(), InterfaceType.EJB_OBJECT);
-                bind(name, ref, bindings, beanInfo, homeInterface);
-                bindJava(cdi, homeInterface.getName(), ref);
-                
-                singleRef = ref;
-                references++;
-            }
-        } catch (NamingException e) {
-            throw new RuntimeException("Unable to bind remote home interface for deployment " + id, e);
-        }
+        // Our openejb.jndiname.format concept works such that there doesn't need to be one explicit jndi name
+        // for each view that the bean may offer.  If the user configured a name that results in few possible
+        // jndi names than views, this is ok.  The 'optionalBind' method will do its best and log the results.
+        // This openejb.jndiname.format affects only the OpenEJB-specific global jndi tree.
+        //
+        // Should there be a so described "deficit" of names, we give precedence to the most universal and local first
+        // Essentially this:
+        //     1. Local Bean view as it implements all business interfaces of the bean, local or remote
+        //     2. The business local view -- "the" is applicable as create proxies with all possible local interfaces
+        //     3. The business remote view -- same note on "the" as above
+        //     4. The EJBLocalHome
+        //     5. The EJBHome
+        //
+        // This ordering also has an affect on which view wins the "java:global/{app}/{module}/{ejbName}" jndi name.
+        // In the case that the bean has just one view, the name refers to that view.  Otherwise, the name is unspecified
 
         try {
-            Class localHomeInterface = deployment.getLocalHomeInterface();
-            if (localHomeInterface != null) {
+            if (cdi.isLocalbean()) {
+                Class beanClass = deployment.getBeanClass();
 
-                ObjectReference ref = new ObjectReference(deployment.getEJBLocalHome());
+                DeploymentInfo.BusinessLocalBeanHome home = deployment.getBusinessLocalBeanHome();
+                BusinessLocalBeanReference ref = new BusinessLocalBeanReference(home);
 
-                String name = strategy.getName(deployment.getLocalHomeInterface(), JndiNameStrategy.Interface.LOCAL_HOME);
-                bind("openejb/local/" + name, ref, bindings, beanInfo, localHomeInterface);
+                optionalBind(bindings, ref, "openejb/Deployment/" + format(deployment.getDeploymentID(), beanClass.getName(), InterfaceType.LOCALBEAN));
 
-                name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getLocalInterface().getName());
-                bind(name, ref, bindings, beanInfo, localHomeInterface);
+                String internalName = "openejb/Deployment/" + format(deployment.getDeploymentID(), beanClass.getName(), InterfaceType.BUSINESS_LOCALBEAN_HOME);
+                bind(internalName, ref, bindings, beanInfo, beanClass);
 
-                name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getLocalInterface().getName(), InterfaceType.EJB_LOCAL);
-                bind(name, ref, bindings, beanInfo, localHomeInterface);
-                bindJava(cdi, localHomeInterface.getName(), ref);
-                
-                singleRef = ref;
-                references++;
+                String name = strategy.getName(beanClass, JndiNameStrategy.Interface.LOCALBEAN);
+                bind("openejb/local/" + name, ref, bindings, beanInfo, beanClass);
+                bindJava(cdi, beanClass.getName(), ref);
+
+                simpleNameRef = ref;
             }
         } catch (NamingException e) {
-            throw new RuntimeException("Unable to bind local home interface for deployment " + id, e);
+            throw new RuntimeException("Unable to bind business remote deployment in jndi.", e);
         }
 
         try {
@@ -379,8 +370,7 @@ public class JndiBuilder {
                 bind(externalName, ref, bindings, beanInfo, interfce);
                 bindJava(cdi, interfce.getName(), ref);
                 
-                singleRef = ref;
-                references++;
+                if (simpleNameRef == null) simpleNameRef = ref;
             }
         } catch (NamingException e) {
             throw new RuntimeException("Unable to bind business local interface for deployment " + id, e);
@@ -407,44 +397,63 @@ public class JndiBuilder {
                 bind("openejb/remote/" + name, ref, bindings, beanInfo, interfce);
                 bindJava(cdi, interfce.getName(), ref);
                 
-                singleRef = ref;
-                references++;
+                if (simpleNameRef == null) simpleNameRef = ref;
             }
         } catch (NamingException e) {
             throw new RuntimeException("Unable to bind business remote deployment in jndi.", e);
         }
 
         try {
-            if (cdi.isLocalbean()) {
-                Class beanClass = deployment.getBeanClass();
+            Class localHomeInterface = deployment.getLocalHomeInterface();
+            if (localHomeInterface != null) {
 
-                DeploymentInfo.BusinessLocalBeanHome home = deployment.getBusinessLocalBeanHome();
-                BusinessLocalBeanReference ref = new BusinessLocalBeanReference(home);
+                ObjectReference ref = new ObjectReference(deployment.getEJBLocalHome());
 
-                optionalBind(bindings, ref, "openejb/Deployment/" + format(deployment.getDeploymentID(), beanClass.getName(), InterfaceType.LOCALBEAN));
+                String name = strategy.getName(deployment.getLocalHomeInterface(), JndiNameStrategy.Interface.LOCAL_HOME);
+                bind("openejb/local/" + name, ref, bindings, beanInfo, localHomeInterface);
 
-                String internalName = "openejb/Deployment/" + format(deployment.getDeploymentID(), beanClass.getName(), InterfaceType.BUSINESS_LOCALBEAN_HOME);
-                bind(internalName, ref, bindings, beanInfo, beanClass);
+                name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getLocalInterface().getName());
+                bind(name, ref, bindings, beanInfo, localHomeInterface);
 
-                String name = strategy.getName(beanClass, JndiNameStrategy.Interface.LOCALBEAN);
-                bind("openejb/local/" + name, ref, bindings, beanInfo, beanClass);
-                bindJava(cdi, beanClass.getName(), ref);
-                
-                singleRef = ref;
-                references++;
+                name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getLocalInterface().getName(), InterfaceType.EJB_LOCAL);
+                bind(name, ref, bindings, beanInfo, localHomeInterface);
+                bindJava(cdi, localHomeInterface.getName(), ref);
+
+                if (simpleNameRef == null) simpleNameRef = ref;
             }
         } catch (NamingException e) {
-            throw new RuntimeException("Unable to bind business remote deployment in jndi.", e);
+            throw new RuntimeException("Unable to bind local home interface for deployment " + id, e);
         }
 
-        if (references == 1) {
-            try {
-                bindJava(cdi, null, singleRef);
-            } catch (NamingException e) {
-                throw new RuntimeException("Unable to bind single interface in jndi", e);
+        try {
+            Class homeInterface = deployment.getHomeInterface();
+            if (homeInterface != null) {
+
+                ObjectReference ref = new ObjectReference(deployment.getEJBHome());
+
+                String name = strategy.getName(homeInterface, JndiNameStrategy.Interface.REMOTE_HOME);
+                bind("openejb/local/" + name, ref, bindings, beanInfo, homeInterface);
+                bind("openejb/remote/" + name, ref, bindings, beanInfo, homeInterface);
+
+                name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getRemoteInterface().getName());
+                bind(name, ref, bindings, beanInfo, homeInterface);
+
+                name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getRemoteInterface().getName(), InterfaceType.EJB_OBJECT);
+                bind(name, ref, bindings, beanInfo, homeInterface);
+                bindJava(cdi, homeInterface.getName(), ref);
+
+                if (simpleNameRef == null) simpleNameRef = ref;
             }
+        } catch (NamingException e) {
+            throw new RuntimeException("Unable to bind remote home interface for deployment " + id, e);
         }
-        
+
+        try {
+            bindJava(cdi, null, simpleNameRef);
+        } catch (NamingException e) {
+            throw new RuntimeException("Unable to bind simple java:global name in jndi", e);
+        }
+
         try {
             if (MessageListener.class.equals(deployment.getMdbInterface())) {
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=989853&r1=989852&r2=989853&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java Thu Aug 26 18:05:10 2010
@@ -1295,12 +1295,7 @@ public class AnnotationDeployer implemen
                          * @WebService
                          * @WebServiceProvider
                          */
-//                        boolean strict = getProperty(ejbModule, STRICT_INTERFACE_DECLARATION, false + "").equalsIgnoreCase("true");
-                        if (SystemInstance.get().hasProperty("openejb.geronimo.strict.interface.declaration")) {
-                            processSessionInterfacesStrict(sessionBean, clazz, ejbModule);
-                        } else {
-                            processSessionInterfaces(sessionBean, clazz, ejbModule);
-                        }
+                        processSessionInterfaces(sessionBean, clazz, ejbModule);
 
                         /*
                          * Allow for all session bean types
@@ -1586,6 +1581,10 @@ public class AnnotationDeployer implemen
             xml.addLocals(sessionBean.getBusinessLocal(), ejbModule.getClassLoader());
             xml.addRemotes(sessionBean.getBusinessRemote(), ejbModule.getClassLoader());
 
+            if (beanClass.getAnnotation(LocalBean.class) != null) {
+                sessionBean.setLocalBean(new Empty());
+            }
+            
             /**
              * Anything declared as both <business-local> and <business-remote> is invalid in strict mode
              */
@@ -1602,7 +1601,10 @@ public class AnnotationDeployer implemen
             all.local.addAll(xml.local);
             all.remote.addAll(xml.remote);
 
-            for (Class<?> clazz : ancestors(beanClass)) {
+            final List<Class<?>> classes = strict ? new ArrayList(asList(beanClass)) : ancestors(beanClass);
+
+            for (Class<?> clazz : classes) {
+
                 /*
                  * @WebService
                  * @WebServiceProvider
@@ -1693,20 +1695,7 @@ public class AnnotationDeployer implemen
                 interfaces.removeAll(bean.remote);
 
                 if (impliedLocal || impliedRemote) {
-                    if (interfaces.size() == 1) {
-                        Class<?> interfce = interfaces.remove(0);
-
-                        if (strict && impliedLocal && impliedRemote) {
-                            /**
-                             * Cannot imply @Local and @Remote at the same time with strict mode on
-                             */
-                            validation.fail(ejbName, "ann.localRemote.ambiguous", interfce.getName());
-                        } else {
-                            if (impliedLocal) bean.local.add(interfce);
-                            if (impliedRemote) bean.remote.add(interfce);
-                        }
-
-                    } else { // invalid
+                    if (interfaces.size() != 1) {
                         /**
                          * Cannot imply either @Local or @Remote and list multiple interfaces
                          */
@@ -1722,15 +1711,24 @@ public class AnnotationDeployer implemen
                          * This bean is invalid, so do not bother looking at the other interfaces or the superclass
                          */
                         return;
+                    } else if (strict && impliedLocal && impliedRemote) {
+                        Class<?> interfce = interfaces.remove(0);
+                        /**
+                         * Cannot imply @Local and @Remote at the same time with strict mode on
+                         */
+                        validation.fail(ejbName, "ann.localRemote.ambiguous", interfce.getName());
+                    } else {
+                        if (impliedLocal) bean.local.addAll(interfaces);
+                        if (impliedRemote) bean.remote.addAll(interfaces);
+
+                        interfaces.clear();
                     }
                 }
 
-
                 /**
                  * OK, now start checking the metadata of the interfaces implemented by this class
                  */
 
-
                 /**
                  * This set holds the list of interfaces that the bean implements
                  * that are annotated either as @Local or @Remote
@@ -1826,6 +1824,41 @@ public class AnnotationDeployer implemen
                 all.remote.addAll(implemented.remote);
 
 
+                // We only consider the top-most class (the bean class itself) when evaluating
+                // the case of absolutely no metadata at all and attempting to figure out the
+                // default view which will be implied as either @LocalBean or @Local
+                if (clazz == beanClass
+                        && sessionBean.getLocalBean() == null
+                        && sessionBean.getBusinessLocal().isEmpty()
+                        && sessionBean.getBusinessRemote().isEmpty()
+                        && sessionBean.getHome() == null
+                        && sessionBean.getRemote() == null
+                        && sessionBean.getLocalHome() == null
+                        && sessionBean.getLocal() == null
+                        && sessionBean.getServiceEndpoint() == null
+                        && all.local.isEmpty()
+                        && all.remote.isEmpty()
+                        ) {
+
+                    if (interfaces.size() == 0) {
+                        // No interfaces?  Then @LocalBean
+
+                        sessionBean.setLocalBean(new Empty());
+
+
+                    } else if (interfaces.size() == 1) {
+                        // One interface?  Then @Local
+
+                        all.local.add(interfaces.remove(0));
+
+                    } else {
+                        // Multiple interfaces?  Illegal
+                        // TODO -- create message
+                        validation.fail(ejbName, "TODO");
+                        return;
+                    }
+                }
+
                 /**
                  * Track any interfaces we didn't use
                  */
@@ -1844,198 +1877,11 @@ public class AnnotationDeployer implemen
             //
             // It goes a little beyond that, but no one has ever complained about having
             // more local interfaces.
-            for (Class interfce : all.unspecified) sessionBean.addBusinessLocal(interfce);
 
-            if (beanClass.getAnnotation(LocalBean.class) != null || beanClass.getInterfaces().length == 0) {
-                sessionBean.setLocalBean(new Empty());
-            }
-
-        }
-
-        private void processSessionInterfacesStrict(SessionBean sessionBean, Class<?> beanClass, EjbModule ejbModule) {
-
-            ValidationContext validation = ejbModule.getValidation();
-            String ejbName = sessionBean.getEjbName();
-
-//            boolean strict = getProperty(ejbModule, STRICT_INTERFACE_DECLARATION, false + "").equalsIgnoreCase("true");
-
-            /*
-             * Collect all interfaces explicitly declared via xml.
-             * We will subtract these from the interfaces implemented
-             * by the bean and do annotation scanning on the remainder.
-             */
-            List<String> descriptor = new ArrayList<String>();
-            descriptor.add(sessionBean.getHome());
-            descriptor.add(sessionBean.getRemote());
-            descriptor.add(sessionBean.getLocalHome());
-            descriptor.add(sessionBean.getLocal());
-            descriptor.addAll(sessionBean.getBusinessLocal());
-            descriptor.addAll(sessionBean.getBusinessRemote());
-            descriptor.add(sessionBean.getServiceEndpoint());
+            // TODO allow to be re-enabled with a flag  
+            //for (Class interfce : all.unspecified) sessionBean.addBusinessLocal(interfce);
 
-            BusinessInterfaces xml = new BusinessInterfaces();
-            xml.addLocals(sessionBean.getBusinessLocal(), ejbModule.getClassLoader());
-            xml.addRemotes(sessionBean.getBusinessRemote(), ejbModule.getClassLoader());
 
-            /**
-             * Anything declared as both <business-local> and <business-remote> is invalid in strict mode
-             */
-            for (Class interfce : xml.local) {
-                if (xml.remote.contains(interfce)) {
-                    validation.fail(ejbName, "xml.localRemote.conflict", interfce.getName());
-                }
-            }
-            
-            /*
-             * Merge the xml declared business interfaces into the complete set
-             */
-            BusinessInterfaces all = new BusinessInterfaces();
-            all.local.addAll(xml.local);
-            all.remote.addAll(xml.remote);
-
-            BusinessInterfaces annotated = new BusinessInterfaces();
-            LinkedHashSet<Class<?>> interfaces = new LinkedHashSet<Class<?>>();
-            boolean localBean = false;
-            /*
-            * @WebService
-            * @WebServiceProvider
-            */
-            if (sessionBean.getServiceEndpoint() == null) {
-                Class defaultEndpoint = DeploymentInfo.ServiceEndpoint.class;
-
-                for (Class interfce : beanClass.getInterfaces()) {
-                    if (interfce.isAnnotationPresent(WebService.class)) {
-                        defaultEndpoint = interfce;
-                    }
-                }
-
-                WebService webService = beanClass.getAnnotation(WebService.class);
-                if (webService != null) {
-
-                    String className = webService.endpointInterface();
-
-                    if (!className.equals("")) {
-                        sessionBean.setServiceEndpoint(className);
-                    } else {
-                        sessionBean.setServiceEndpoint(defaultEndpoint.getName());
-                    }
-                } else if (beanClass.isAnnotationPresent(WebServiceProvider.class)) {
-                    sessionBean.setServiceEndpoint(defaultEndpoint.getName());
-                } else if (!defaultEndpoint.equals(DeploymentInfo.ServiceEndpoint.class)) {
-                    sessionBean.setServiceEndpoint(defaultEndpoint.getName());
-                }
-            }
-            /*
-             * 4.9.2.1 client views are specified on the session bean class itself, not on any superclasses.
-             */
-
-            /*
-             * 4.9.7  par 5.3
-             * 4.9.8 par 1.3
-            * These interface types are not eligible to be business interfaces.
-            * java.io.Serializable
-            * java.io.Externalizable
-            * javax.ejb.*
-            */
-            for (Class<?> interfce : beanClass.getInterfaces()) {
-                String name = interfce.getName();
-                if (!name.equals("java.io.Serializable") &&
-                        !name.equals("java.io.Externalizable") &&
-                        !name.startsWith("javax.ejb.")) {
-                    interfaces.add(interfce);
-                }
-            }
-            localBean |= beanClass.getAnnotation(LocalBean.class) != null;
-            if (beanClass.getAnnotation(Local.class) != null) {
-                annotated.local.addAll(toList(beanClass.getAnnotation(Local.class).value()));
-            }
-            if (beanClass.getAnnotation(Remote.class) != null) {
-                annotated.remote.addAll(toList(beanClass.getAnnotation(Remote.class).value()));
-            }
-
-            if (localBean) {
-                sessionBean.setLocalBean(new Empty());
-            }
-            /**
-             * 4.9.8 implied local bean
-             */
-            if (sessionBean.getLocalBean() == null
-                    && beanClass.getInterfaces().length == 0
-                    && annotated.local.isEmpty()
-                    && annotated.remote.isEmpty()
-                    && xml.local.isEmpty()
-                    && xml.remote.isEmpty()
-                    && sessionBean.getHome() == null
-                    && sessionBean.getRemote() == null
-                    && sessionBean.getLocalHome() == null
-                    && sessionBean.getLocal() == null
-                    && sessionBean.getServiceEndpoint() == null) {
-                sessionBean.setLocalBean(new Empty());
-                //nothing else to do...
-                return;
-            }
-            /**
-             * 4.9.7 par 5.1 single interface.
-             * Requires: not no-interface, no interface specified by @Local or @Remote on a bean class(?) and only one implemented interface.
-             */
-            if (sessionBean.getLocalBean() == null
-                    && interfaces.size() == 1
-                    && annotated.local.isEmpty()
-                    && annotated.remote.isEmpty()
-                    && xml.local.isEmpty()
-                    && xml.remote.isEmpty()) {
-                Class<?> interfce = interfaces.iterator().next();
-                if (interfce.getAnnotation(Remote.class) != null) {
-                    validateRemoteInterface(interfce, validation, ejbName);
-                    sessionBean.getBusinessRemote().add(interfce.getName());
-                } else {
-                    validateLocalInterface(interfce, validation, ejbName);
-                    sessionBean.getBusinessLocal().add(interfce.getName());
-                }
-                return;
-            }
-
-            /**
-             * 4.9.7 par 5.2 and 5.5
-             * All other interfaces must be specified as local or remote on the interface or in the beans @Local/@Remote annotation
-             * (or the xml)
-             */
-            for (Class<?> interfce: interfaces) {
-                if (interfce.getAnnotation(Local.class) != null) {
-                    annotated.local.add(interfce);
-                }
-                if (interfce.getAnnotation(Remote.class) != null) {
-                    annotated.remote.add(interfce);
-                }
-            }
-
-            /**
-             * 4.9.7 par 5.4
-             * No interface can be both Local and Remote
-             */
-            // TODO This isn't right either, xml always wins over annotation so there can never be this mixed "some combination of xml and annotations" case
-            all.local.addAll(annotated.local);
-            all.remote.addAll(annotated.remote);
-            for (Class<?> local: all.local) {
-                if (all.remote.contains(local)) {
-                    validation.fail(ejbName, "ann.localRemote.generalconflict", local);
-                }
-            }
-
-            //add to xml
-            annotated.local.removeAll(xml.local);
-            annotated.remote.removeAll(xml.remote);
-            for (Class<?> local: annotated.local) {
-                sessionBean.getBusinessLocal().add(local.getName());
-            }
-            for (Class<?> remote: annotated.remote) {
-                sessionBean.getBusinessRemote().add(remote.getName());
-            }
-        }
-
-        private List<? extends Class> toList(Class[] classes) {
-            if (classes == null) return Collections.emptyList();
-            return asList(classes);
         }
 
         private static class BusinessInterfaces {
@@ -2707,7 +2553,7 @@ public class AnnotationDeployer implemen
                 interfce = (member == null) ? null : member.getType();
             }
 
-            boolean localbean = isLocalBean(interfce);
+            boolean localbean = isKnownLocalBean(interfce);
 
             if ((!localbean) && interfce != null && !isValidEjbInterface(name, interfce, ejbRef.getName())) {
                 return;
@@ -2809,7 +2655,7 @@ public class AnnotationDeployer implemen
             return "java:comp/env/" + refName;
         }
 
-        private boolean isLocalBean(Class clazz) {
+        private boolean isKnownLocalBean(Class clazz) {
             DeploymentModule module = getModule();
             if (module instanceof EjbModule) {
                 Set<String> localbeans = new HashSet<String>();
@@ -2833,24 +2679,24 @@ public class AnnotationDeployer implemen
         private boolean isValidEjbInterface(String b, Class clazz, String refName) {
             if (!clazz.isInterface()) {
 
-                DeploymentModule module = getModule();
-                if (module instanceof EjbModule) {
-                    Set<String> beanClasses = new HashSet<String>();
-                    EjbModule ejbModule = (EjbModule) module;
-                    for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
-                        beanClasses.add(bean.getEjbClass());
-                    }
-
-                    if (beanClasses.contains(clazz.getName())) {
-                        fail(b, "ann.ejb.beanClass", clazz.getName(), refName);
-                    } else {
-                        fail(b, "ann.ejb.notInterface", clazz.getName(), refName);
-                    }
-                } else {
-                    fail(b, "ann.ejb.notInterface", clazz.getName(), refName);
-                }
-
-                return false;
+//                DeploymentModule module = getModule();
+//                if (module instanceof EjbModule) {
+//                    Set<String> beanClasses = new HashSet<String>();
+//                    EjbModule ejbModule = (EjbModule) module;
+//                    for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+//                        beanClasses.add(bean.getEjbClass());
+//                    }
+//
+//                    if (beanClasses.contains(clazz.getName())) {
+//                        fail(b, "ann.ejb.beanClass", clazz.getName(), refName);
+//                    } else {
+//                        fail(b, "ann.ejb.notInterface", clazz.getName(), refName);
+//                    }
+//                } else {
+//                    fail(b, "ann.ejb.notInterface", clazz.getName(), refName);
+//                }
+//
+//                return false;
 
             } else if (EJBObject.class.isAssignableFrom(clazz)) {
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/AppContext.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/AppContext.java?rev=989853&r1=989852&r2=989853&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/AppContext.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/AppContext.java Thu Aug 26 18:05:10 2010
@@ -16,10 +16,13 @@
  */
 package org.apache.openejb.core;
 
+import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.loader.Options;
 
 import javax.naming.Context;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @version $Rev$ $Date$
@@ -31,6 +34,9 @@ public class AppContext extends Deployme
     private final Context appJndiContext;
     private final boolean standaloneModule;
 
+    // TODO perhaps to be deleted
+    private final List<DeploymentInfo> deployments = new ArrayList<DeploymentInfo>();
+
     public AppContext(String id, SystemInstance systemInstance, ClassLoader classLoader, Context globalJndiContext, Context appJndiContext, boolean standaloneModule) {
         super(id, systemInstance.getOptions());
         this.classLoader = classLoader;
@@ -49,6 +55,10 @@ public class AppContext extends Deployme
         return classLoader;
     }
 
+    public List<DeploymentInfo> getDeployments() {
+        return deployments;
+    }
+
     public SystemInstance getSystemInstance() {
         return systemInstance;
     }

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/BusinessInterfacesTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/BusinessInterfacesTest.java?rev=989853&r1=989852&r2=989853&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/BusinessInterfacesTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/BusinessInterfacesTest.java Thu Aug 26 18:05:10 2010
@@ -27,6 +27,7 @@ import org.apache.openejb.OpenEJBExcepti
 import org.apache.openejb.config.rules.ValidationAssertions;
 
 import javax.ejb.Local;
+import javax.ejb.LocalBean;
 import javax.ejb.Remote;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -117,13 +118,20 @@ public class BusinessInterfacesTest exte
     public static class YellowFiveBean implements YellowFiveRemote, Serializable {
     }
 
+
+    // - - -
+
+    public static class YellowSixBean implements Serializable {
+    }
+
+
     public void testYellow() throws Exception {
         // Results should be the same with strict on or off
         for (boolean strict : Arrays.asList(false, true)) {
             setUp();
             strict(strict);
 
-            Map<String, EnterpriseBeanInfo> beans = deploy(YellowOneBean.class, YellowTwoBean.class, YellowThreeBean.class, YellowFourBean.class, YellowFiveBean.class);
+            Map<String, EnterpriseBeanInfo> beans = deploy(YellowOneBean.class, YellowTwoBean.class, YellowThreeBean.class, YellowFourBean.class, YellowFiveBean.class, YellowSixBean.class);
 
             EnterpriseBeanInfo beanInfo;
 
@@ -131,30 +139,250 @@ public class BusinessInterfacesTest exte
 
             assertEquals(list(YellowOneLocal.class), sort(beanInfo.businessLocal));
             assertEquals(list(), sort(beanInfo.businessRemote));
+            assertFalse(beanInfo.localbean);
 
             beanInfo = beans.get("YellowTwoBean");
 
             assertEquals(list(), sort(beanInfo.businessLocal));
             assertEquals(list(YellowTwoRemote.class), sort(beanInfo.businessRemote));
+            assertFalse(beanInfo.localbean);
 
             beanInfo = beans.get("YellowThreeBean");
 
             assertEquals(list(YellowThreeUnspecified.class), sort(beanInfo.businessLocal));
             assertEquals(list(), sort(beanInfo.businessRemote));
+            assertFalse(beanInfo.localbean);
 
             beanInfo = beans.get("YellowFourBean");
 
             assertEquals(list(YellowFourLocal.class), sort(beanInfo.businessLocal));
             assertEquals(list(), sort(beanInfo.businessRemote));
+            assertFalse(beanInfo.localbean);
 
             beanInfo = beans.get("YellowFiveBean");
 
             assertEquals(list(), sort(beanInfo.businessLocal));
             assertEquals(list(YellowFiveRemote.class), sort(beanInfo.businessRemote));
+            assertFalse(beanInfo.localbean);
+
+            beanInfo = beans.get("YellowSixBean");
+
+            assertEquals(list(), sort(beanInfo.businessLocal));
+            assertEquals(list(), sort(beanInfo.businessRemote));
+            assertTrue(beanInfo.localbean);
+
+        }
+    }
+
+    // ----------------------------------------------------------------------------------------------------------------
+    //  Lemon -- implied LocalBean and subclassing
+    // ----------------------------------------------------------------------------------------------------------------
+
+    public static class LemonOneBean extends YellowOneBean {
+    }
+
+    public static class LemonTwoBean extends YellowTwoBean {
+    }
+
+    public static class LemonThreeBean extends YellowThreeBean {
+    }
+
+    public static class LemonFourBean extends YellowFourBean {
+    }
+
+    public static class LemonFiveBean extends YellowFiveBean {
+    }
+
+    public static class LemonSixBean extends YellowSixBean {
+    }
+
+    public void testLemon() throws Exception {
+        setUp();
+        strict(false);
+
+        Map<String, EnterpriseBeanInfo> beans = deploy(LemonOneBean.class, LemonTwoBean.class, LemonThreeBean.class, LemonFourBean.class, LemonFiveBean.class, LemonSixBean.class);
+
+        EnterpriseBeanInfo beanInfo;
+
+        beanInfo = beans.get("LemonOneBean");
+
+        assertEquals(list(YellowOneLocal.class), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonTwoBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(YellowTwoRemote.class), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonThreeBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonFourBean");
+
+        assertEquals(list(YellowFourLocal.class), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonFiveBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(YellowFiveRemote.class), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonSixBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+    }
+
+    public void testLemonStrict() throws Exception {
+        setUp();
+        strict(true);
+
+        Map<String, EnterpriseBeanInfo> beans = deploy(LemonOneBean.class, LemonTwoBean.class, LemonThreeBean.class, LemonFourBean.class, LemonFiveBean.class, LemonSixBean.class);
+
+        EnterpriseBeanInfo beanInfo;
+
+        beanInfo = beans.get("LemonOneBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonTwoBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonThreeBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonFourBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonFiveBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("LemonSixBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+    }
+
+    // ----------------------------------------------------------------------------------------------------------------
+    //  Magenta -- explicit @LocalBean
+    // ----------------------------------------------------------------------------------------------------------------
+
+    public static interface MagentaOneLocal {
+    }
+
+    @Local
+    @LocalBean
+    public static class MagentaOneBean implements MagentaOneLocal, Serializable {
+    }
+
+    // - - -
+
+    public static interface MagentaTwoRemote {
+    }
+
+    @Remote
+    @LocalBean
+    public static class MagentaTwoBean implements MagentaTwoRemote, Serializable {
+    }
+
+    // - - -
+
+    public static interface MagentaThreeUnspecified {
+    }
+
+    @LocalBean
+    public static class MagentaThreeBean implements MagentaThreeUnspecified, Serializable {
+    }
+
+    // - - -
+
+    @Local
+    public static interface MagentaFourLocal {
+    }
+
+    @LocalBean
+    public static class MagentaFourBean implements MagentaFourLocal, Serializable {
+    }
+
+    // - - -
+
+    @Remote
+    public static interface MagentaFiveRemote {
+    }
+
+    @LocalBean
+    public static class MagentaFiveBean implements MagentaFiveRemote, Serializable {
+    }
+
+    public void testMagenta() throws Exception {
+        // Results should be the same with strict on or off
+        for (boolean strict : Arrays.asList(false, true)) {
+            setUp();
+            strict(strict);
+
+            Map<String, EnterpriseBeanInfo> beans = deploy(MagentaOneBean.class, MagentaTwoBean.class, MagentaThreeBean.class, MagentaFourBean.class, MagentaFiveBean.class);
+
+            EnterpriseBeanInfo beanInfo;
+
+            beanInfo = beans.get("MagentaOneBean");
+
+            assertEquals(list(MagentaOneLocal.class), sort(beanInfo.businessLocal));
+            assertEquals(list(), sort(beanInfo.businessRemote));
+            assertTrue(beanInfo.localbean);
+
+            beanInfo = beans.get("MagentaTwoBean");
+
+            assertEquals(list(), sort(beanInfo.businessLocal));
+            assertEquals(list(MagentaTwoRemote.class), sort(beanInfo.businessRemote));
+            assertTrue(beanInfo.localbean);
+
+            beanInfo = beans.get("MagentaThreeBean");
+
+            assertEquals(list(), sort(beanInfo.businessLocal));
+            assertEquals(list(), sort(beanInfo.businessRemote));
+            assertTrue(beanInfo.localbean);
+
+            beanInfo = beans.get("MagentaFourBean");
+
+            assertEquals(list(MagentaFourLocal.class), sort(beanInfo.businessLocal));
+            assertEquals(list(), sort(beanInfo.businessRemote));
+            assertTrue(beanInfo.localbean);
+
+            beanInfo = beans.get("MagentaFiveBean");
+
+            assertEquals(list(), sort(beanInfo.businessLocal));
+            assertEquals(list(MagentaFiveRemote.class), sort(beanInfo.businessRemote));
+            assertTrue(beanInfo.localbean);
 
         }
     }
 
+
     // ----------------------------------------------------------------------------------------------------------------
     //  InvalidYellow
     // ----------------------------------------------------------------------------------------------------------------
@@ -316,12 +544,12 @@ public class BusinessInterfacesTest exte
 
         EnterpriseBeanInfo beanInfo = beans.get("OrangeOneBean");
 
-        assertEquals(list(OrangeOneLocal.class, OrangeOneBoth.class, OrangeOneUnspecified.class), sort(beanInfo.businessLocal));
+        assertEquals(list(OrangeOneLocal.class, OrangeOneBoth.class), sort(beanInfo.businessLocal));
         assertEquals(list(OrangeOneRemote.class, OrangeOneBoth.class), sort(beanInfo.businessRemote));
 
         beanInfo = beans.get("OrangeTwoBean");
 
-        assertEquals(list(OrangeTwoLocal.class, OrangeTwoBoth.class, OrangeTwoUnspecified.class), sort(beanInfo.businessLocal));
+        assertEquals(list(OrangeTwoLocal.class, OrangeTwoBoth.class), sort(beanInfo.businessLocal));
         assertEquals(list(OrangeTwoRemote.class, OrangeTwoBoth.class), sort(beanInfo.businessRemote));
     }
 
@@ -393,12 +621,12 @@ public class BusinessInterfacesTest exte
 
         EnterpriseBeanInfo beanInfo = beans.get("RedOneBean");
 
-        assertEquals(list(RedOneLocal.class, RedOneUnspecified.class), sort(beanInfo.businessLocal));
+        assertEquals(list(RedOneLocal.class), sort(beanInfo.businessLocal));
         assertEquals(list(RedOneRemote.class, RedOneOverridden.class), sort(beanInfo.businessRemote));
 
         beanInfo = beans.get("RedTwoBean");
 
-        assertEquals(list(RedTwoLocal.class, RedTwoOverridden.class, RedTwoUnspecified.class), sort(beanInfo.businessLocal));
+        assertEquals(list(RedTwoLocal.class, RedTwoOverridden.class), sort(beanInfo.businessLocal));
         assertEquals(list(RedTwoRemote.class), sort(beanInfo.businessRemote));
     }
 
@@ -414,16 +642,69 @@ public class BusinessInterfacesTest exte
 
         EnterpriseBeanInfo beanInfo = beans.get("RedOneBean");
 
-        assertEquals(list(RedOneLocal.class, RedOneUnspecified.class), sort(beanInfo.businessLocal));
+        assertEquals(list(RedOneLocal.class), sort(beanInfo.businessLocal));
         assertEquals(list(RedOneRemote.class, RedOneOverridden.class), sort(beanInfo.businessRemote));
 
         beanInfo = beans.get("RedTwoBean");
 
-        assertEquals(list(RedTwoLocal.class, RedTwoOverridden.class, RedTwoUnspecified.class), sort(beanInfo.businessLocal));
+        assertEquals(list(RedTwoLocal.class, RedTwoOverridden.class), sort(beanInfo.businessLocal));
         assertEquals(list(RedTwoRemote.class), sort(beanInfo.businessRemote));
     }
 
+    public static class CrimsonOneBean extends RedOneBean {
+    }
+    
+    public static class CrimsonTwoBean extends RedTwoBean {
+    }
+    
+
+    /**
+     * Super class definitions are retrieved 
+     * @throws Exception
+     */
+    public void testCrimsonNotStrict() throws Exception {
+        strict(false);
+
+        Map<String, EnterpriseBeanInfo> beans = deploy(CrimsonOneBean.class, CrimsonTwoBean.class);
+
+        EnterpriseBeanInfo beanInfo = beans.get("CrimsonOneBean");
+
+        assertEquals(list(RedOneLocal.class), sort(beanInfo.businessLocal));
+        assertEquals(list(RedOneRemote.class, RedOneOverridden.class), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+        
+        beanInfo = beans.get("CrimsonTwoBean");
+
+        assertEquals(list(RedTwoLocal.class, RedTwoOverridden.class), sort(beanInfo.businessLocal));
+        assertEquals(list(RedTwoRemote.class), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+    }
+
+    /**
+     * Test results should NOT be the same as above. Super class should not be consulted
+     * 
+     * @throws Exception
+     */
+    public void testCrimsonStrict() throws Exception {
+        strict(true);
+
+        Map<String, EnterpriseBeanInfo> beans = deploy(CrimsonOneBean.class, CrimsonTwoBean.class);
+
+        EnterpriseBeanInfo beanInfo = beans.get("CrimsonOneBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+
+        beanInfo = beans.get("CrimsonTwoBean");
+
+        assertEquals(list(), sort(beanInfo.businessLocal));
+        assertEquals(list(), sort(beanInfo.businessRemote));
+        assertTrue(beanInfo.localbean);
+    }
 
+    
+    
     private <T extends Comparable<? super T>> List<T> sort(List<T> list) {
         Collections.sort(list);
         return list;

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvalidEjbRefTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvalidEjbRefTest.java?rev=989853&r1=989852&r2=989853&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvalidEjbRefTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvalidEjbRefTest.java Thu Aug 26 18:05:10 2010
@@ -37,7 +37,7 @@ import org.junit.runner.RunWith;
 @RunWith(ValidationRunner.class)
 public class InvalidEjbRefTest extends TestCase {
     @Keys({@Key("ann.ejb.ejbObject"),@Key("ann.ejb.ejbLocalObject"),@Key("ann.ejb.beanClass"),@Key("ann.ejb.notInterface")})
-    public EjbJar test() throws Exception {
+    public EjbJar _test() throws Exception {
 
         EjbJar ejbJar = new EjbJar();