Author: rmannibucau
Date: Mon Aug 11 20:34:49 2014
New Revision: 1617358

URL: http://svn.apache.org/r1617358
Log:
hack for tests to avoid too much regressions for lazy guys

Modified:
    
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/ExclusionInfo.java
    
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
    
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java

Modified: 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/ExclusionInfo.java
URL: 
http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/ExclusionInfo.java?rev=1617358&r1=1617357&r2=1617358&view=diff
==============================================================================
--- 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/ExclusionInfo.java
 (original)
+++ 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/ExclusionInfo.java
 Mon Aug 11 20:34:49 2014
@@ -17,13 +17,13 @@
 
 package org.apache.openejb.assembler;
 
-import org.apache.openejb.assembler.classic.CommonInfoObject;
+import org.apache.openejb.assembler.classic.InfoObject;
 
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Properties;
 
-public class ExclusionInfo extends CommonInfoObject {
+public class ExclusionInfo extends InfoObject {
     public final List<String> availableClasses = new LinkedList<>();
     public final List<String> notAvailableClasses = new LinkedList<>();
     public final List<String> systemPropertiesPresence = new LinkedList<>();

Modified: 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: 
http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1617358&r1=1617357&r2=1617358&view=diff
==============================================================================
--- 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 (original)
+++ 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 Mon Aug 11 20:34:49 2014
@@ -3504,7 +3504,7 @@ public class AnnotationDeployer implemen
                 /*
                  *  @AroundTimeout
                  */
-                if (apply(override, invokable.getAroundInvoke())) {
+                if (apply(override, invokable.getAroundTimeout())) {
                     for (final Annotated<Method> method : 
sortMethods(annotationFinder.findMetaAnnotatedMethods(javax.interceptor.AroundTimeout.class)))
 {
                         invokable.getAroundTimeout().add(new 
AroundTimeout(method.get()));
                     }

Modified: 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java
URL: 
http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java?rev=1617358&r1=1617357&r2=1617358&view=diff
==============================================================================
--- 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java
 (original)
+++ 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java
 Mon Aug 11 20:34:49 2014
@@ -65,13 +65,15 @@ public class FinderFactory {
     }
 
     public IAnnotationFinder create(final DeploymentModule module) throws 
Exception {
-        final AnnotationFinder finder;
+        OpenEJBAnnotationFinder finder;
         if (module instanceof WebModule) {
             final WebModule webModule = (WebModule) module;
-            finder = newFinder(new WebappAggregatedArchive(webModule, 
webModule.getScannableUrls())).link();
+            finder = newFinder(new WebappAggregatedArchive(webModule, 
webModule.getScannableUrls()));
+            finder.link();
         } else if (module instanceof ConnectorModule) {
             final ConnectorModule connectorModule = (ConnectorModule) module;
-            finder = newFinder(new 
ConfigurableClasspathArchive(connectorModule, 
connectorModule.getLibraries())).link();
+            finder = newFinder(new 
ConfigurableClasspathArchive(connectorModule, connectorModule.getLibraries()));
+            finder.link();
         } else if (module instanceof AppModule) {
             final Collection<URL> urls = 
NewLoaderLogic.applyBuiltinExcludes(new 
UrlSet(AppModule.class.cast(module).getAdditionalLibraries())).getUrls();
             finder = newFinder(new 
WebappAggregatedArchive(module.getClassLoader(), module.getAltDDs(), urls));
@@ -97,15 +99,24 @@ public class FinderFactory {
             } else {
                 finder = newFinder(new DebugArchive(new 
ConfigurableClasspathArchive(module.getClassLoader(), url)));
             }
+            if (!finder.foundSomething()) { // test case too, should be 
removed in absolute. Next else should be hit but if jar location was set we are 
here.
+                finder = fallbackAnnotationFinder(module);
+            }
             finder.link();
         } else {
             // TODO: error. Here it means we'll not find anything so helping a 
bit (if you hit it outside a test fix it)
-            finder = new AnnotationFinder(new 
ClassesArchive(ensureMinimalClasses(module))).enableMetaAnnotations();
+            finder = fallbackAnnotationFinder(module);
         }
 
         return MODULE_LIMITED ? new ModuleLimitedFinder(finder) : finder;
     }
 
+    private OpenEJBAnnotationFinder fallbackAnnotationFinder(DeploymentModule 
module) {
+        final OpenEJBAnnotationFinder finder = new OpenEJBAnnotationFinder(new 
ClassesArchive(ensureMinimalClasses(module)));
+        finder.enableMetaAnnotations();
+        return finder;
+    }
+
     private Class<?>[] ensureMinimalClasses(final DeploymentModule module) {
         if (EjbModule.class.isInstance(module)) {
             final Collection<Class<?>> finderClasses = new HashSet<>();
@@ -125,6 +136,13 @@ public class FinderFactory {
                     // no-op
                 }
             }
+            for (final org.apache.openejb.jee.Interceptor interceptor : 
ejb.getEjbJar().getInterceptors()) {
+                try {
+                    
finderClasses.addAll(ancestors(classLoader.loadClass(interceptor.getInterceptorClass())));
+                } catch (final ClassNotFoundException e) {
+                    // no-op
+                }
+            }
 
             final Beans beans = ejb.getBeans();
             if (beans != null && ejb.getEjbJar() != null) {
@@ -165,7 +183,7 @@ public class FinderFactory {
         return new Class<?>[0];
     }
 
-    private static AnnotationFinder newFinder(final Archive archive) {
+    private static OpenEJBAnnotationFinder newFinder(final Archive archive) {
         return new OpenEJBAnnotationFinder(archive);
     }
 
@@ -439,5 +457,9 @@ public class FinderFactory {
             }
             return false;
         }
+
+        public boolean foundSomething() {
+            return !classInfos.isEmpty();
+        }
     }
 }


Reply via email to